Localization issue for links to attachment

UNCONFIRMED
Unassigned

Status

()

Bugzilla
Bugzilla-General
UNCONFIRMED
3 years ago
10 months ago

People

(Reporter: Christophe JAILLET, Unassigned)

Tracking

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:33.0) Gecko/20100101 Firefox/33.0
Build ID: 20141011015303

Steps to reproduce:

Add an attachment to a bug, using a localized version of bugzilla.


Actual results:

The links to the attachment (i.e. attachment 7 [details]) that are replaced in the comment only works in the English version.


Expected results:

It should be possible to localize these links.

Apparently, this is controlled by a regex line 226 in Bugzilla/Template.pm.
The hard-coded "attachment" string should be taken from a template instead. It would ease localization.

This is apparently already done this way for the term 'bug' around line 239.
(Reporter)

Comment 1

3 years ago
In my case, for French language, I modified line 226 in Bugzilla/Template.pm as follow:

    # === Modif CJ ===
    # $text =~ s~\b(attachment\s*\#?\s*(\d+)(?:\s+\[details\])?)
    $text =~  s~\b(Fichier\ joint[^0-9]*(\d+)(?:\s+\[details\])?)
              ~($things[$count++] = get_attachment_link($2, $1, $user)) &&
               ("\x{FDD2}" . ($count-1) . "\x{FDD3}")
              ~egmxi;
    # === fin modif CJ ===
(Reporter)

Comment 2

3 years ago
The same exists for comment around line 243 where "comment" should be turned into "commentaire" in French.
(Reporter)

Comment 3

10 months ago
In version 5.0.3, a solution has been implemented for the "comment" case.


In Bugzilla/Template.pm:

4.4.x:
   my $comment_re = qr/comment\s*\#?\s*(\d+)/i;

as been turned into:
   my $comments_word = template_var('terms')->{comments};
   ...
   my $comments_re = qr/(?:comments|\Q$comments_word\E)$s*\#?$s*
                         [0-9]+(?:$s*,$s*\#?$s*[0-9]+)+/ix;


and a new field has been added to global/variables.none.tmpl, in order to ease localisation:
   "comment" => "commentaire",

This way, we don't need anymore to modify some bugzilla "core" files, but only to customize a "configuration" file.
(Reporter)

Comment 4

10 months ago
Wrong cut'n Paste. 5.0.3 is:

   my $comment_word = template_var('terms')->{comment};
   my $comment_re = qr/(?:\Q$comment_word\E|comment)$s*\#?$s*([0-9]+)/i;
(Reporter)

Updated

10 months ago
Version: 4.4.6 → 5.0.3
You need to log in before you can comment on or make changes to this bug.