Opened 10 months ago

Closed 2 months ago

#31937 closed Bug (fixed)

Can't translate strings properly to Hebrew and Arabic

Reported by: אורי Owned by: Claude Paroz
Component: Internationalization Version: dev
Severity: Normal Keywords:
Cc: אורי Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by אורי)

I can't translate strings such as "2 weeks" to Hebrew and Arabic properly. There is a word in Hebrew and a word in Arabic for 2 weeks, but I get an error message "The expression '%d' is not present in the translation" in Transifex and also msgfmt -vc django.po raises exceptions. In some languages, with some plural forms, such as n == 1 or n == 2, we don't need %d to be present in the translation. Also "1 week" can be written in words "one week", also in Hebrew, and I think it's a better translation than "1 week". I also think English can use "one week" instead of "%d week" ("1 week", but in English, there is the issue of capital letters).

Change History (14)

comment:1 Changed 10 months ago by אורי

Cc: אורי added

comment:2 Changed 10 months ago by אורי

Description: modified (diff)

comment:3 Changed 10 months ago by Claude Paroz

Resolution: wontfix
Status: newclosed

This is a "limitation" (or feature, depends on how you look at it) of gettext, that a placeholder must be present on both parts (msgid and msgstr) of a translatable string (with some exceptions, but they don't apply here).

Read also: https://www.gnu.org/software/gettext/manual/gettext.html#Translating-plural-forms-1

I don't see any solution, but if you find one , please reopen with a concrete proposal.

comment:5 in reply to:  3 Changed 5 months ago by אורי

Replying to Claude Paroz:

This is a "limitation" (or feature, depends on how you look at it) of gettext, that a placeholder must be present on both parts (msgid and msgstr) of a translatable string (with some exceptions, but they don't apply here).

Read also: https://www.gnu.org/software/gettext/manual/gettext.html#Translating-plural-forms-1

I don't see any solution, but if you find one , please reopen with a concrete proposal.

Hi Claude,

I submitted a bug report on https://savannah.gnu.org/bugs/?59005 and I received a response. If Django uses the following format:

msgid "%d year"
msgid_plural "%d years"

Then the number %d should be present in every language. However, by using the following format with named paramters:

msgid "%(number)d year"
msgid_plural "%(number)d years"

Then languages such as Hebrew and Arabic are allowed to omit the number %d, which makes more sense since in those languages there is a word for "2 years" (and also 2 weeks, 2 months etc.). So if Django will name the number of years, in this example, then it will be possible to use the correct word in Hebrew and Arabic (using the number "2" in these translations is possible, but it's not the correct translation). Also, when translating "one year", I think also English as well as other languages would prefer to use the word "one" in words, and not in digits (1).

What do you think?

comment:6 Changed 5 months ago by אורי

Resolution: wontfix
Status: closednew

comment:7 Changed 5 months ago by Claude Paroz

Easy pickings: set
Triage Stage: UnreviewedAccepted

Thanks for exploring, I guess we have now a way forward.

comment:8 Changed 5 months ago by Ryan Cheley

Owner: changed from nobody to Ryan Cheley
Status: newassigned

comment:9 Changed 2 months ago by Mariusz Felisiak

Owner: Ryan Cheley deleted
Status: assignednew

comment:10 Changed 2 months ago by אורי

Owner: set to אורי
Status: newassigned

I want to create a draft PR for this ticket. Please see the discussion in the developers mailing list. And I would like to receive feedback from @Claude - what is the right direction for this ticket and how should the PR look like?

comment:12 Changed 2 months ago by Mariusz Felisiak

Has patch: set
Owner: changed from אורי to Claude Paroz
Patch needs improvement: set

comment:13 Changed 2 months ago by Claude Paroz

Patch needs improvement: unset

comment:14 Changed 2 months ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In e4430f22:

Fixed #31937 -- Eased translation of time strings in some languages.

Note: See TracTickets for help on using tickets.
Back to Top