--
Ticket URL: <https://code.djangoproject.com/ticket/31937>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: אורי (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:1>
Old description:
> 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 "1 week" (but in English, there is the issue of
> capital letters).
New description:
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).
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:2>
* status: new => closed
* resolution: => wontfix
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:3>
Comment (by אורי):
[https://savannah.gnu.org/bugs/index.php?59005 bug #59005: Can't translate
strings properly to Hebrew and Arabic]
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:4>
Comment (by אורי):
Replying to [comment:3 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?
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:5>
* status: closed => new
* resolution: wontfix =>
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:6>
* easy: 0 => 1
* stage: Unreviewed => Accepted
Comment:
Thanks for exploring, I guess we have now a way forward.
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:7>
* owner: nobody => Ryan Cheley
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:8>
* owner: Ryan Cheley => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:9>
* owner: (none) => אורי
* status: new => assigned
Comment:
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?
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:10>
Comment (by אורי):
PR: https://github.com/django/django/pull/14226
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:11>
* owner: אורי => Claude Paroz
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/14233 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:12>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:13>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"e4430f22c8e3d29ce5d9d0263fba57121938d06d" e4430f22]:
{{{
#!CommitTicketReference repository=""
revision="e4430f22c8e3d29ce5d9d0263fba57121938d06d"
Fixed #31937 -- Eased translation of time strings in some languages.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:14>
Comment (by אורי):
@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?
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:15>
Comment (by Claude Paroz):
Most probably because translations from Transifex will be push to stable
and main branches just before the release, so in the days to come.
--
Ticket URL: <https://code.djangoproject.com/ticket/31937#comment:16>