]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 223880: "marked a duplicate" messages cannot be localized
authormkanat%bugzilla.org <>
Tue, 19 Sep 2006 01:56:38 +0000 (01:56 +0000)
committermkanat%bugzilla.org <>
Tue, 19 Sep 2006 01:56:38 +0000 (01:56 +0000)
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk

Bugzilla.pm
Bugzilla/BugMail.pm
Bugzilla/Template.pm
Bugzilla/Util.pm
process_bug.cgi
template/en/default/global/messages.html.tmpl

index c4300b0b541a35181b824d14411205a1339b2570..ef67643af783483867afd8edb9c461a1463de093 100644 (file)
@@ -146,6 +146,12 @@ sub template {
     return request_cache()->{template};
 }
 
+sub template_inner {
+    my $class = shift;
+    $class->request_cache->{template_inner} ||= Bugzilla::Template->create();
+    return $class->request_cache->{template_inner};
+}
+
 sub cgi {
     my $class = shift;
     request_cache()->{cgi} ||= new Bugzilla::CGI();
@@ -452,6 +458,11 @@ that.
 
 The current C<Template> object, to be used for output
 
+=item C<template_inner>
+
+If you ever need a L<Bugzilla::Template> object while you're already
+processing a template, use this.
+
 =item C<cgi>
 
 The current C<cgi> object. Note that modules should B<not> be using this in
index 35b05d231a17a28af63c6a4b584c54fc7604280b..2fc8b0f723a0bfe4b088d851125e2abcc9ee616c 100644 (file)
@@ -645,7 +645,7 @@ sub sendMail {
     };
 
     my $msg;
-    my $template = Bugzilla::Template->create();
+    my $template = Bugzilla->template_inner;
     $template->process("email/newchangedmail.txt.tmpl", $vars, \$msg)
       || ThrowTemplateError($template->error());
 
index a60a453d6c06cd622578eddd2e10bc2a379815e7..b54c4a0f20ca2860c2508e0410f9199990f21890 100644 (file)
@@ -331,7 +331,8 @@ sub quoteUrls {
     # we have to do this in one pattern, and so this is semi-messy.
     # Also, we can't use $bug_re?$comment_re? because that will match the
     # empty string
-    my $bug_re = qr/bug\s*\#?\s*(\d+)/i;
+    my $bug_word = get_text('term', { term => 'bug' });
+    my $bug_re = qr/\Q$bug_word\E\s*\#?\s*(\d+)/i;
     my $comment_re = qr/comment\s*\#?\s*(\d+)/i;
     $text =~ s~\b($bug_re(?:\s*,?\s*$comment_re)?|$comment_re)
               ~ # We have several choices. $1 here is the link, and $2-4 are set
@@ -340,7 +341,8 @@ sub quoteUrls {
                               "<a href=\"$current_bugurl#c$4\">$1</a>")
               ~egox;
 
-    # Old duplicate markers
+    # Old duplicate markers. These don't use $bug_word because they are old
+    # and were never customizable.
     $text =~ s~(?<=^\*\*\*\ This\ bug\ has\ been\ marked\ as\ a\ duplicate\ of\ )
                (\d+)
                (?=\ \*\*\*\Z)
index c051a987ff83901b4395152d2c8e18ed05e31009..8457c8df83656798604b1fbd6c0286a61b9abff4 100644 (file)
@@ -400,7 +400,7 @@ sub clean_text {
 
 sub get_text {
     my ($name, $vars) = @_;
-    my $template = Bugzilla->template;
+    my $template = Bugzilla->template_inner;
     $vars ||= {};
     $vars->{'message'} = $name;
     my $message;
index 4ca02b17b71e7c8333ab4e2cc9937be168a14a1b..1824dd7f34e798efa0f7b96cbdf33ed563d5bfb7 100755 (executable)
@@ -1147,8 +1147,8 @@ SWITCH: for ($cgi->param('knob')) {
         ChangeStatus('RESOLVED');
         ChangeResolution('DUPLICATE');
         my $comment = $cgi->param('comment');
-        $comment .= "\n\n*** This bug has been marked " .
-                    "as a duplicate of bug $duplicate ***";
+        $comment .= "\n\n
+                    . get_text('bug_duplicate_of', { dupe_of => $duplicate });
         $cgi->param('comment', $comment);
         last SWITCH;
     };
@@ -2025,11 +2025,10 @@ foreach my $id (@idlist) {
             $dbh->do(q{INSERT INTO cc (who, bug_id) VALUES (?, ?)},
                      undef, $reporter, $duplicate);
         }
-        # Bug 171639 - Duplicate notifications do not need to be private. 
-        AppendComment($duplicate, $whoid,
-                      "*** Bug " . $cgi->param('id') .
-                      " has been marked as a duplicate of this bug. ***",
-                      0, $timestamp);
+        my $dupe_comment = get_text('bug_has_duplicate',
+                                    { dupe => $cgi->param('id') });
+        # Bug 171639 - Duplicate notifications do not need to be private.
+        AppendComment($duplicate, $whoid, $dupe_comment, 0, $timestamp);
 
         $dbh->do(q{INSERT INTO duplicates VALUES (?, ?)}, undef,
                  $duplicate, $cgi->param('id'));
index 21c79b8ac15aeb99f783a16cc20e5200fe80fc30..3d05214dc3804c160e70bb451193a846bda9b8b5 100644 (file)
     Please add your attachment by clicking the "Create a New Attachment" link
     below.
 
+  [% ELSIF message_tag == "bug_duplicate_of" %]
+    *** This [% terms.bug %] has been marked as a duplicate of [% terms.bug %] [%+ dupe_of FILTER html %] ***
+
+  [% ELSIF message_tag == "bug_has_duplicate" %]
+    *** [% terms.Bug %] [%+ dupe FILTER html %] has been marked as a duplicate of this [% terms.bug %]. ***
+
   [% ELSIF message_tag == "buglist_adding_field" %]
     [% title = "Adding field to search page..." %]
     [% link  = "Click here if the page does not redisplay automatically." %]
       The cookie that was remembering your login is now gone.
     [% END %]
 
+  [% ELSIF message_tag == "term" %]
+    [% terms.$term FILTER html %]
+
   [% ELSIF message_tag == "user_match_failed" %]
     You entered a username that did not match any known 
     [% terms.Bugzilla %] users, so we have instead left