Dependency Graph
View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001479 | mantisbt | public | 2002-01-25 14:08 | 2004-02-29 07:16 | |
| Reporter | epu | Assigned To | yarick123 | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | IE v6.0.2600.000 | OS | win2k | OS Version | mantis .16.1 |
| Product Version | 0.17.0 | ||||
| Summary | 0001479: Users receive foreign-language e-mail | ||||
| Description | When a bugnote is added and e-mail is sent, it arrives in the sender's set language. E-mail needs to arrive in the receiver's set language. | ||||
| Additional Information | fix: Now it is used default language for all e-mails. | ||||
| Tags | No tags attached. | ||||
| Attached Files | mantis01801_common_lang_email.patch (6,075 bytes)
diff -rc mantis-0.18.1/core/email_api.php mantis/core/email_api.php
*** mantis-0.18.1/core/email_api.php 2004-02-05 22:10:46.000000000 +0100
--- mantis/core/email_api.php 2004-02-24 12:15:14.000000000 +0100
***************
*** 348,396 ****
# send notices when a new bug is added
function email_new_bug( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'new' );
! email_bug_info( $p_bug_id, lang_get( 'new_bug_msg' ), $t_bcc );
}
# --------------------
# send notices when a new bugnote
function email_bugnote_add( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'bugnote' );
! email_bug_info( $p_bug_id, lang_get( 'email_bugnote_msg' ), $t_bcc );
}
# --------------------
# send notices when a bug is RESOLVED
function email_resolved( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'resolved' );
! email_bug_info( $p_bug_id, lang_get( 'email_resolved_msg' ), $t_bcc );
}
# --------------------
# send notices when a bug is CLOSED
function email_close( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'closed' );
! email_bug_info( $p_bug_id, lang_get( 'email_close_msg' ), $t_bcc );
}
# --------------------
# send notices when a bug is set to FEEDBACK
function email_feedback( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'feedback' );
! email_bug_info( $p_bug_id, lang_get( 'email_feedback_msg' ), $t_bcc );
}
# --------------------
# send notices when a bug is REOPENED
function email_reopen( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'reopened' );
! email_bug_info( $p_bug_id, lang_get( 'email_reopen_msg' ), $t_bcc );
}
# --------------------
# send notices when a bug is ASSIGNED
function email_assign( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'assigned' );
! email_bug_info( $p_bug_id, lang_get( 'email_assigned_msg' ), $t_bcc );
}
# --------------------
# send notices when a bug is DELETED
function email_bug_deleted( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'deleted' );
! email_bug_info( $p_bug_id, lang_get( 'email_bug_deleted_msg' ), $t_bcc );
}
# --------------------
# Build the bug info part of the message
--- 348,396 ----
# send notices when a new bug is added
function email_new_bug( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'new' );
! email_bug_info( $p_bug_id, 'new_bug_msg', $t_bcc );
}
# --------------------
# send notices when a new bugnote
function email_bugnote_add( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'bugnote' );
! email_bug_info( $p_bug_id, 'email_bugnote_msg', $t_bcc );
}
# --------------------
# send notices when a bug is RESOLVED
function email_resolved( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'resolved' );
! email_bug_info( $p_bug_id, 'email_resolved_msg', $t_bcc );
}
# --------------------
# send notices when a bug is CLOSED
function email_close( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'closed' );
! email_bug_info( $p_bug_id, 'email_close_msg', $t_bcc );
}
# --------------------
# send notices when a bug is set to FEEDBACK
function email_feedback( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'feedback' );
! email_bug_info( $p_bug_id, 'email_feedback_msg', $t_bcc );
}
# --------------------
# send notices when a bug is REOPENED
function email_reopen( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'reopened' );
! email_bug_info( $p_bug_id, 'email_reopen_msg', $t_bcc );
}
# --------------------
# send notices when a bug is ASSIGNED
function email_assign( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'assigned' );
! email_bug_info( $p_bug_id, 'email_assigned_msg', $t_bcc );
}
# --------------------
# send notices when a bug is DELETED
function email_bug_deleted( $p_bug_id ) {
$t_bcc = email_build_bcc_list( $p_bug_id, 'deleted' );
! email_bug_info( $p_bug_id, 'email_bug_deleted_msg', $t_bcc );
}
# --------------------
# Build the bug info part of the message
***************
*** 537,543 ****
# --------------------
# Send bug info to reporter and handler
function email_bug_info( $p_bug_id, $p_message, $p_headers='' ) {
! global $g_to_email, $g_use_bcc;
# build subject
$t_subject = email_build_subject( $p_bug_id );
--- 545,560 ----
# --------------------
# Send bug info to reporter and handler
function email_bug_info( $p_bug_id, $p_message, $p_headers='' ) {
! global $g_to_email, $g_use_bcc, $g_email_language, $g_default_language, $g_lang_current;
!
! # get common email language
! $t_email_language = isset( $g_email_language ) ? $g_email_language : $g_default_language;
!
! $t_saved_lang_current = $g_lang_current; // save current language before changing to email-language
! if( $t_email_language !== $g_lang_current )
! lang_load( $g_email_language );
!
! $p_message = lang_get( $p_message );
# build subject
$t_subject = email_build_subject( $p_bug_id );
***************
*** 566,571 ****
--- 583,592 ----
$res1 = email_send( $g_to_email, $t_subject, $t_message, $p_headers, $t_category );
}
}
+
+ # restore user language after sending email
+ if( $t_saved_lang_current !== $t_email_language )
+ lang_load( $t_saved_lang_current ? $t_saved_lang_current : $g_default_language );
}
# --------------------
# this function sends the actual email
diff -rc mantis-0.18.1/config_inc.php.sample mantis/config_inc.php.sample
*** mantis-0.18.1/config_inc.php.sample 2004-01-11 08:16:06.000000000 +0100
--- mantis/config_inc.php.sample 2004-02-24 12:21:58.000000000 +0100
***************
*** 35,40 ****
--- 35,41 ----
$g_database_name = "bugtracker";
# --- email variables -------------
+ $g_email_language = $g_default_language;
$g_administrator_email = 'administrator@example.com';
$g_webmaster_email = 'webmaster@example.com';
mantisHEAD040225_common_mail_language.patch (9,664 bytes)
diff -rc cvs-mantisbt/core/bug_api.php mantisbt/core/bug_api.php
*** cvs-mantisbt/core/bug_api.php 2004-02-22 05:26:47.000000000 +0100
--- mantisbt/core/bug_api.php 2004-02-25 14:00:12.000000000 +0100
***************
*** 558,567 ****
$t_status_prefix = 'email_notification_title_for_status_bug_';
# bug assigned
! if ( $t_old_data->handler_id != $p_bug_data->handler_id )
! {
! $t_message = lang_get_defaulted( $t_action_prefix . 'assigned', '' );
! email_generic( $p_bug_id, 'assigned', $t_message );
return true;
}
--- 558,565 ----
$t_status_prefix = 'email_notification_title_for_status_bug_';
# bug assigned
! if ( $t_old_data->handler_id != $p_bug_data->handler_id ) {
! email_generic( $p_bug_id, 'assigned', $t_action_prefix . 'assigned' );
return true;
}
***************
*** 569,584 ****
if ( $t_old_data->status != $p_bug_data->status ) {
$t_status = get_enum_to_string( config_get( 'status_enum_string' ), $p_bug_data->status );
$t_status = str_replace( ' ', '', $t_status );
! $t_message = lang_get_defaulted( $t_status_prefix . $t_status, '' );
! email_generic( $p_bug_id, 'status_' . $t_status, $t_message );
return true;
}
# @@@ handle priority change if it requires special handling
# generic update notification
! $t_message = lang_get_defaulted( $t_action_prefix . 'updated' , '' );
! email_generic( $p_bug_id, 'updated', $t_message );
return true;
}
--- 567,580 ----
if ( $t_old_data->status != $p_bug_data->status ) {
$t_status = get_enum_to_string( config_get( 'status_enum_string' ), $p_bug_data->status );
$t_status = str_replace( ' ', '', $t_status );
! email_generic( $p_bug_id, 'status_' . $t_status, $t_status_prefix . $t_status );
return true;
}
# @@@ handle priority change if it requires special handling
# generic update notification
! email_generic( $p_bug_id, 'updated', $t_action_prefix . 'updated' );
return true;
}
diff -rc cvs-mantisbt/core/email_api.php mantisbt/core/email_api.php
*** cvs-mantisbt/core/email_api.php 2004-02-25 14:19:57.000000000 +0100
--- mantisbt/core/email_api.php 2004-02-25 14:15:12.000000000 +0100
***************
*** 347,395 ****
# --------------------
# send a generic email
# $p_notify_type: use check who she get notified of such event.
! # $p_message: message to be included at the top of the email message.
! function email_generic( $p_bug_id, $p_notify_type, $p_message = null ) {
$t_bcc = email_build_bcc_list( $p_bug_id, $p_notify_type );
! email_bug_info( $p_bug_id, $p_message, $t_bcc );
}
# --------------------
# send notices when a new bug is added
function email_new_bug( $p_bug_id ) {
! email_generic( $p_bug_id, 'new', lang_get( 'email_notification_title_for_action_bug_submitted' ) );
}
# --------------------
# send notices when a new bugnote
function email_bugnote_add( $p_bug_id ) {
! email_generic( $p_bug_id, 'bugnote', lang_get( 'email_notification_title_for_action_bugnote_submitted' ) );
}
# --------------------
# send notices when a bug is RESOLVED
function email_resolved( $p_bug_id ) {
! email_generic( $p_bug_id, 'status_resolved', lang_get( 'email_notification_title_for_status_bug_resolved' ) );
}
# --------------------
# send notices when a bug is CLOSED
function email_close( $p_bug_id ) {
! email_generic( $p_bug_id, 'status_closed', lang_get( 'email_notification_title_for_status_bug_closed' ) );
}
# --------------------
# send notices when a bug is REOPENED
function email_reopen( $p_bug_id ) {
! email_generic( $p_bug_id, 'reopened', lang_get( 'email_notification_title_for_action_bug_reopened' ) );
}
# --------------------
# send notices when a bug is ASSIGNED
function email_assign( $p_bug_id ) {
! email_generic( $p_bug_id, 'assigned', lang_get( 'email_notification_title_for_action_bug_assigned' ) );
}
# --------------------
# send notices when a bug is DELETED
function email_bug_deleted( $p_bug_id ) {
! email_generic( $p_bug_id, 'deleted', lang_get( 'email_notification_title_for_action_bug_deleted' ) );
}
# --------------------
# Build the bug info part of the message
! function email_build_bug_message( $p_bug_id, $p_message, &$p_category ) {
global $g_complete_date_format, $g_show_view,
$g_bugnote_order,
$g_email_separator1, $g_email_padding_length;
--- 347,395 ----
# --------------------
# send a generic email
# $p_notify_type: use check who she get notified of such event.
! # $p_message_id: message id to be translated and included at the top of the email message.
! function email_generic( $p_bug_id, $p_notify_type, $p_message_id = null ) {
$t_bcc = email_build_bcc_list( $p_bug_id, $p_notify_type );
! email_bug_info( $p_bug_id, $p_message_id, $t_bcc );
}
# --------------------
# send notices when a new bug is added
function email_new_bug( $p_bug_id ) {
! email_generic( $p_bug_id, 'new', 'email_notification_title_for_action_bug_submitted' );
}
# --------------------
# send notices when a new bugnote
function email_bugnote_add( $p_bug_id ) {
! email_generic( $p_bug_id, 'bugnote', 'email_notification_title_for_action_bugnote_submitted' );
}
# --------------------
# send notices when a bug is RESOLVED
function email_resolved( $p_bug_id ) {
! email_generic( $p_bug_id, 'status_resolved', 'email_notification_title_for_status_bug_resolved' );
}
# --------------------
# send notices when a bug is CLOSED
function email_close( $p_bug_id ) {
! email_generic( $p_bug_id, 'status_closed', 'email_notification_title_for_status_bug_closed' );
}
# --------------------
# send notices when a bug is REOPENED
function email_reopen( $p_bug_id ) {
! email_generic( $p_bug_id, 'reopened', 'email_notification_title_for_action_bug_reopened' );
}
# --------------------
# send notices when a bug is ASSIGNED
function email_assign( $p_bug_id ) {
! email_generic( $p_bug_id, 'assigned', 'email_notification_title_for_action_bug_assigned' );
}
# --------------------
# send notices when a bug is DELETED
function email_bug_deleted( $p_bug_id ) {
! email_generic( $p_bug_id, 'deleted', 'email_notification_title_for_action_bug_deleted' );
}
# --------------------
# Build the bug info part of the message
! function email_build_bug_message( $p_bug_id, $p_message_id, &$p_category ) {
global $g_complete_date_format, $g_show_view,
$g_bugnote_order,
$g_email_separator1, $g_email_padding_length;
***************
*** 414,420 ****
$t_sta_str = get_enum_element( 'status', $v_status );
$t_rep_str = get_enum_element( 'reproducibility', $v_reproducibility );
$t_message = $g_email_separator1."\n";
! if ( $p_message != lang_get( 'email_notification_title_for_action_bug_deleted' ) ) {
$t_message .= string_get_bug_view_url_with_fqdn( $p_bug_id ) . "\n";
$t_message .= $g_email_separator1."\n";
}
--- 414,420 ----
$t_sta_str = get_enum_element( 'status', $v_status );
$t_rep_str = get_enum_element( 'reproducibility', $v_reproducibility );
$t_message = $g_email_separator1."\n";
! if ( $p_message_id !== 'email_notification_title_for_action_bug_deleted' ) {
$t_message .= string_get_bug_view_url_with_fqdn( $p_bug_id ) . "\n";
$t_message .= $g_email_separator1."\n";
}
***************
*** 531,549 ****
}
# --------------------
# Send bug info to reporter and handler
! function email_bug_info( $p_bug_id, $p_message, $p_headers='' ) {
! global $g_to_email, $g_use_bcc;
# build subject
$t_subject = email_build_subject( $p_bug_id );
# build message
$t_category = '';
! $t_message = '';
! if ( ( $p_message !== null ) && ( !is_blank( $p_message ) ) ) {
! $t_message .= $p_message."\n";
}
! $t_message .= email_build_bug_message( $p_bug_id, $p_message, $t_category );
$t_message .= email_build_bugnote_message( $p_bug_id );
$t_message .= email_build_history_message( $p_bug_id );
--- 531,556 ----
}
# --------------------
# Send bug info to reporter and handler
! function email_bug_info( $p_bug_id, $p_message_id, $p_headers='' ) {
! global $g_to_email, $g_use_bcc, $g_default_language, $g_lang_current;
!
! # load default language in order to send all emails with the same language
! $t_saved_lang_current = $g_lang_current; // save current language before changing to email-language
! if ( $g_default_language !== $g_lang_current ) {
! lang_load( $g_default_language );
! }
# build subject
$t_subject = email_build_subject( $p_bug_id );
# build message
$t_category = '';
! ## default message == '' not to show internal constants like 'email_notification_title_for_status_bug_confirmed' in email
! $t_message = lang_get_defaulted( $p_message_id, '' );
! if ( ( $t_message !== null ) && ( !is_blank( $t_message ) ) ) {
! $t_message .= "\n";
}
! $t_message .= email_build_bug_message( $p_bug_id, $t_message, $t_category );
$t_message .= email_build_bugnote_message( $p_bug_id );
$t_message .= email_build_history_message( $p_bug_id );
***************
*** 564,569 ****
--- 571,581 ----
$res1 = email_send( $g_to_email, $t_subject, $t_message, $p_headers, $t_category );
}
}
+
+ # restore user language after sending email
+ if ( !is_blank( $t_saved_lang_current ) && $t_saved_lang_current !== $g_default_language ) {
+ lang_load( $t_saved_lang_current );
+ }
}
# --------------------
# this function sends the actual email
| ||||
| has duplicate | 0001652 | closed | prescience | Email notifications to 3rd parties keep the Localization setting of the user who submitted the bug/bugnote |
| has duplicate | 0001767 | closed | vboctor | EMails not localized |
| has duplicate | 0002029 | closed | jlatour | Mails are sent out in the wrong language |
| has duplicate | 0002748 | closed | vboctor | E-mails should be sent in the language of the recipient of the mail |
| has duplicate | 0003057 | closed | jlatour | mistery: got once a german notification email, while my language settings are 'english' |
| has duplicate | 0003091 | closed | jlatour | E-mail notification not in English? |
| has duplicate | 0003392 | closed | jlatour | E-mail are sent in the language of the reporter |
| has duplicate | 0003403 | closed | vboctor | email notifications sent in poster's language |
| has duplicate | 0003549 | closed | vboctor | email notification not in the language as set in the profile |
|
I've struggled with this for a while. The primary issue is that I wanted to cut down on email traffic by using the BCC: send methods. naturally this means everyone receives the same messages. One thought I had was to deliver everything in the sitewide default language instead of the reporter's default. I may end up chucking the bcc method and just issuing one email per user. Not sure how much of a performance hit that would be though (especially on a large, busy site). |
|
|
Sitewide is good medium-term solution, since users of a site share that language in common. |
|
|
What about the option of sending an e-mail per language? Given that a site will have users of typically 1-3 languages, it shouldn't be that much of a performance penalty. The only disadvantage is that if the site is using To: rather than Bcc:, the list in the To: will not be the complete list of recipients. |
|
|
What about a combined email from the used languages the recipients have set in there settings. The first part can be the "default" language, and after that the language settings of the receivers are used, but beware of duplicate languages. |
|
|
vboctor wrote: "The only disadvantage is that if the site is using To: rather than Bcc:, the list in the To: will not be the complete list of recipients." I'd consider that an advantage rather than a disadvantage. For privacy reasons, the system should hide email addresses from other users as much as possible and hence also try to avoid using To: If it's really not possible to avoid using To: instead of Bcc: then revealing fewer addresses is still better than reveailing all addresses. |
|
|
I'd like to second prescience and epu. Sitewide is good solution period. And it would seem easy enough to implement. |
|
|
bump Is there a solution for this problem? |
|
|
the same patch for current CVS version (2004-02-25) |
|
|
MantisBT: master ad2cbac7 2004-02-26 09:36 yarick123 Details Diff |
Fix 0001479: Users receive foreign-language e-mail. fix: Now it is used default language for all e-mails. git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2394 <a class="text" href="/?p=mantisbt.git;a=object;h=f5dc347c">f5dc347c</a>-c33d-0410-90a0-b07cc1902cb9 |
Affected Issues 0001479 |
|
| mod - doc/ChangeLog | Diff File | ||
| mod - core/email_api.php | Diff File | ||
| mod - core/bug_api.php | Diff File | ||
related to
child of
duplicate of