Ticket #8588 (closed defect: fixed)
Opened 3 years ago
Last modified 2 years ago
L10n in progress_bar
| Reported by: | Kirikaza <kirikaza@…> | Owned by: | cboos |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.12 |
| Component: | i18n | Version: | none |
| Severity: | normal | Keywords: | progress_bar |
| Cc: | |||
| Release Notes: | |||
| API 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
Change History
comment:1 Changed 3 years ago by jruigrok
- Owner set to jruigrok
- Status changed from new to assigned
comment:2 Changed 3 years ago by cboos
- Milestone set to 0.12
- Owner changed from jruigrok to cboos
- Status changed from assigned to new
comment:3 Changed 2 years ago by cboos
- Resolution set to fixed
- Status changed from new to 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 Changed 2 years ago by cboos
- Resolution fixed deleted
- Status changed from closed to 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.
comment:5 follow-up: ↓ 6 Changed 2 years ago by mrelbe <mikael@…>
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 in reply to: ↑ 5 Changed 2 years ago by mrelbe <mikael@…>
Replying to mrelbe:
The only word needing translation is then…
Wrong: the word "Total" still needs to be translated, of course.
comment:7 Changed 2 years ago by cboos
And there's the typographical part, "<status>:" translates to "<status> :" in French…
comment:8 Changed 2 years ago by cboos
- Resolution set to fixed
- Status changed from reopened to 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.