Opened 15 years ago
Closed 15 years ago
#8588 closed defect (fixed)
L10n in progress_bar
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.12 |
Component: | i18n | Version: | none |
Severity: | normal | Keywords: | progress_bar |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The progress_bar
macro can't be localized. So I have "Closed Tickets:" in Roadmap regardless of the selected language.
Let's look at macros.html:236:
…${interval.title.capitalize()} ${stats.unit}s:
…
Here the ${interval.title}
contains "closed" or "active".
I suggest add _()
: _(${interval.title.capitalize()
)
And we should repeat this change on the next line (237).
It works well!
But… It is not very good for any language. Look at this: "Closed tickets" and "Closed ticket". E.g., in Russian it will be "Zakrytye zadachi" and "Zakrytaya zadacha". So we can't use the common "Closed" here. We need translate the whole sentence!
I change the code to:
${_(interval.title.capitalize() + ' ' + stats.unit + 's:')}
so I translate the whole "Closed tickets:"
Also we should change the line 245 to translate "Total tickets:". We can see there
Total ${stats.unit}s
.
It's unlocalizable! As I need translate the whole phrase, I fix the line so:
${_('Total ' + stats.unit + 's:')}
Attachments (0)
Change History (8)
comment:1 by , 15 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:2 by , 15 years ago
Milestone: | → 0.12 |
---|---|
Owner: | changed from | to
Status: | assigned → new |
comment:3 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This got fixed in r8904.
Sorry Kirikaza, but most of the advices given in the #comment:description were not usable, as the translation mechanism simply doesn't work like this: what's given in _(…) must be a format string, not an expression.
Your point about "ticket closed" vs. "tickets closed" was correct, but specifying all the forms for ticket statuses and guessing the grammar would be just as error prone as adding an "s" for the plural…
Look at the french translation to see how workarounds can be found: source:trunk/trac/locale/fr_FR/LC_MESSAGES/messages.po@8904:2077-2096#L2067 (unit is 'ticket', units is 'tickets' and title is 'closed')
comment:4 by , 15 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Need to have a second look into this, apparently having different parameters in singular/plural forms is not OK, at least not for msgfmt.
follow-up: 6 comment:5 by , 15 years ago
The Swedish language also becomes problematic regarding this topic (I guess this is problematic for most, if not all, languages).
What about the following informal layout of the progress bar, which is to not add the word "Ticket" after the ticket state name:
Tickets: Closed: 2 Assigned: 12 / Total: 14
The only word needing translation is then the leading "Tickets", plural if Total>1, singular otherwise, and the problem of combining that word with ticket state names has vanished.
comment:6 by , 15 years ago
Replying to mrelbe:
The only word needing translation is then…
Wrong: the word "Total" still needs to be translated, of course.
comment:7 by , 15 years ago
And there's the typographical part, "<status>:" translates to "<status> :" in French…
comment:8 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Thanks to Mikael's suggestion, I approached the problem differently. This time, the translations are quite fine IMO, and simpler even.
Issue should be fixed by r9498. Please try it out.
Some good points, I'll make sure to push through some of these changes tonight. The English part of just tacking on an s is a bit dirty as well.