Opened 4 years ago

Closed 3 years ago

Last modified 2 years 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 (16)

comment:1 by אורי, 4 years ago

Cc: אורי added

comment:2 by אורי, 4 years ago

Description: modified (diff)

comment:3 by Claude Paroz, 4 years ago

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.

in reply to:  3 comment:5 by אורי, 3 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 אורי, 3 years ago

Resolution: wontfix
Status: closednew

comment:7 by Claude Paroz, 3 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted

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

comment:8 by Ryan Cheley, 3 years ago

Owner: changed from nobody to Ryan Cheley
Status: newassigned

comment:9 by Mariusz Felisiak, 3 years ago

Owner: Ryan Cheley removed
Status: assignednew

comment:10 by אורי, 3 years ago

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 by Mariusz Felisiak, 3 years ago

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

comment:13 by Claude Paroz, 3 years ago

Patch needs improvement: unset

comment:14 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In e4430f22:

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

comment:15 by אורי, 2 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 Claude Paroz, 2 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.

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