#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 (16)
comment:1 by , 4 years ago
Cc: | added |
---|
comment:2 by , 4 years ago
Description: | modified (diff) |
---|
follow-up: 5 comment:3 by , 4 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:5 by , 4 years ago
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 by , 4 years ago
Resolution: | wontfix |
---|---|
Status: | closed → new |
comment:7 by , 4 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Thanks for exploring, I guess we have now a way forward.
comment:8 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:9 by , 4 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:10 by , 4 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
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:13 by , 4 years ago
Patch needs improvement: | unset |
---|
comment:15 by , 3 years ago
@Claude Paroz I tried to translate the strings to Hebrew in Transifex but I still can't see the proper strings in Hebrew in main branch:
https://github.com/django/django/blob/main/django/conf/locale/he/LC_MESSAGES/django.po#L1111-L1157
(The strings for one and two years/weeks etc. should not contain digits)
What is the problem?
comment:16 by , 3 years ago
Most probably because translations from Transifex will be push to stable and main branches just before the release, so in the days to come.
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.