Closed Bug 290972 Opened 20 years ago Closed 20 years ago

In the "Find a Specific Bug" page, the status of the bug being searched cannot be translated

Categories

(Bugzilla :: User Interface, defect)

2.19.2
defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: emmanuel, Assigned: emmanuel)

Details

(Whiteboard: [wanted for 2.20])

Attachments

(1 file, 4 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1

The "Find a Specific Bug" page allows the users to search for a bug with a
specific status. Due to the fact that the status shown to the user is the same
one being used in the request, this forces the english terms to be used, even if
the user is using another language (e.g. french).

The term used by the CGI scripts should be in English but the user should be
able to view the choices in whatever language he is using.

Reproducible: Always

Steps to Reproduce:
1. Use Bugzilla in any language other than English 
2. Click on 'Search' in the footber
3. Click on "Find a Specific Bug"
4. Look at the list of statuses in the 'Status' box

Actual Results:  
Choices are 'open', 'closed' and 'all'

Expected Results:  
Choices should be in the same language as the rest of the templates
Note to self: run runtests.pl BEFORE submitting the patch.
This replaces the s variable in filterexceptions.pl with the key variable.
Attachment #181145 - Attachment is obsolete: true
Attachment #181150 - Flags: review?(myk)
Comment on attachment 181150 [details] [diff] [review]
Converts array s into a hash with statuses and localized equivalents

Good idea, but the hash won't preserve the order of the items, which we want to
do.
Attachment #181150 - Flags: review?(myk) → review-
You could have an array of keys along with the key->localized value mapping, but
perhaps there's a better way. cc:ing Gerv, who knows more about Bugzilla l10n,
for his opinion.
The issue with:
s = ['open', 'Open', 'closed', 'Closed', 'all', 'All'];
is that it's not immediately clear which values to localise.

Probably the best approach is the one I used in email.html.tmpl:
http://lxr.mozilla.org/mozilla/source/webtools/bugzilla/template/en/default/account/prefs/email.html.tmpl

Here, that would be:

[% events = [
     { id = 1,
       name = 'open',
       description = "Open" },
     { id = 2,
       name = 'closed',
       description = "Closed" },
     ... 
   ]
%]

I *believe* TT has built-in methods for sorting a hash based on the value of a
given key, which would do the trick nicely.

Gerv
If this doesn't pass review, I'll try Gerv's way.
Attachment #181150 - Attachment is obsolete: true
Attachment #181220 - Flags: review?(myk)
Comment on attachment 181220 [details] [diff] [review]
Keep the array and use the has only for i18n purposes

This works, but Gerv's approach (minus the id key, which doesn't apply here) is
the better one and more consistent with how this is done elsewhere in the
codebase.  Please submit a patch that takes the approach Gerv has taken, and
I'll review it promptly.
Attachment #181220 - Flags: review?(myk)
> Gerv's approach (minus the id key, which doesn't apply here) is the better one

Just to make sure I understand things correctly, the id key must be in this
structure because its value determines the order in which the statuses are
displayed. Correct?
Exactly - although you should probably call it "sortkey" rather than ID, as
that's the terminology we use elsewhere.

See if you can find that TT method (although I might have been imagining it) for
returning a hash sorted in the order of one of its keys. That'll fix you up.

Of course if there isn't one, we could always write one and add it to the stash :-)

Gerv
> Exactly - although you should probably call it "sortkey" rather than ID, as
> that's the terminology we use elsewhere.

After my morning coffee, I realized Myk's right.
We're talking about an array of hashes and the order in which the hashes are
returned is always the same.

Fixing, attaching and asking for review

> See if you can find that TT method (although I might have been imagining it)

I've looked in the TT docs and the O'Reilly book. It doesn't seem to exist.
Attached patch array of hashes, bugzilla-style (obsolete) — Splinter Review
Attachment #181368 - Flags: review?(myk)
Attachment #181220 - Attachment is obsolete: true
Comment on attachment 181368 [details] [diff] [review]
array of hashes, bugzilla-style

>+        [% statuses = [
>+          { status = 'open',
>+            description = "Open" },
>+          { status = 'closed',
>+            description = "Closed" },
>+          { status = 'all',
>+            description = "All" } ]
>+        %]

Nit: this would be more compact and easier to read as:

	[% statuses = [ { status = 'open',   description = "Open" },
			{ status = 'closed', description = "Closed" },
			{ status = 'all',    description = "All" } ] %]

Nit: "status" might be better labeled "name", since each hash as a whole
represents a "status", not just the unique string we use in form field names,
and calling this attribute "status" conflates these values with the hash as a
whole.	Also, while "description" might be better as "label", the industry
standard term for such values.


>+        [% FOREACH s = [ 0 .. statuses.max ] %]
>+            <option value="__[% statuses.${s}.status FILTER html %]__" 
>                   [% " selected" IF default.bug_status.0 == "__${s}__" %]>
>-            [% s %]
>+            [% statuses.${s}.description FILTER html %]

${s} is a number, while default.bug_status.0 is a string like "__open__" or
"__closed__", so those values will never match, and " selected" will never get
generated.

Nit: this would be simpler as:

[% FOREACH s = statuses %]
  <option value="__[% s.status FILTER html %]__" 
    [% " selected" IF default.bug_status.0 == "__${s.status}__" %]>
  [% s.description FILTER html %]
[% END %]

For added readability over the current code, you might switch to "status"
rather than "s".  Also, you don't need to filter these values, since they don't
contain special characters requiring such filtration.  If you're filtering
because otherwise the tests complain, add the applicable variable names to
filterexceptions.pl instead.
Attachment #181368 - Flags: review?(myk) → review-
Whiteboard: [wanted for 2.20]
> ${s} is a number, while default.bug_status.0 is a string like "__open__" or
> "__closed__", so those values will never match, and " selected" will never get
> generated.

You're right. My apologies, this is a stupid mistake on my part.

> Also, you don't need to filter these values, since they don't
> contain special characters requiring such filtration.

The new patch doesn't filter label ("status" in the previous patch) but I'm
unsure as to whether I should filter label ("description" in the previous patch)
since we have no idea what these will be translated to in the different
templates. Is this the correct thing to do?
Attachment #181368 - Attachment is obsolete: true
Attachment #181518 - Flags: review?(myk)
Comment on attachment 181518 [details] [diff] [review]
taking into account Myk's comments

You probably don't need to filter label, but it doesn't harm much to do so, and
it's arguably safer.  Great fix!  r=myk
Attachment #181518 - Flags: review?(myk) → review+
Approved for checkin during 2.20 freeze.
Flags: approval+
Assignee: myk → eseyman
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → Bugzilla 2.20
Version: unspecified → 2.19.2
Checking in template/en/default/filterexceptions.pl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/filterexceptions.pl,v 
<--  filterexceptions.pl
new revision: 1.42; previous revision: 1.41
done
Checking in template/en/default/search/search-specific.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/search/search-specific.html.tmpl,v
 <--  search-specific.html.tmpl
new revision: 1.12; previous revision: 1.11
done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: