- create django project
- set LANGUAGE_CODE = 'cs-CZ' and USE_I18N = True
- open shell
- import django.utils.translation.ngettext
- run ngettext("This password is too short. It must contain at least
%(min_length)d character.", "This password is too short. It must contain
at least %(min_length)d characters.", 5) - returns original english
message instead of the localized one
Translations for n <= 4 work correctly.
I thing this bug was introduced in
https://github.com/django/django/commit/3e01aab5335394201701710d7fcd67f523878c5b
#diff-59a8943fbf4bd5fd330ef8d22e40bd3f , but am not completely sure, since
the commit was created after the 2.1.0 release. Could this be backported?
Frankly, I'm not even sure why this change was necessary - in czech there
are only 3 forms of the message needed - they differ in the last word
'znak' (which means character) thusly:
- 1 znak
- 2, 3, 4 znaky
- 5 and more znaků and also 0 znaků
I tested this behavior on python 3.6.8 and 3.7.3 and django 2.1.0 and
2.1.8.
--
Ticket URL: <https://code.djangoproject.com/ticket/30535>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "Screenshot from 2019-06-01 13-43-58.png" added.
screenshot of bug reproduced in django shell
Comment (by Jakub Kaláb):
Also, before this is resolved, can anyone please tell me how to override
this? I tried to add the original translations (before linked commit) to
my app, while also adding the much simpler Plural-Forms setting:
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
The app is higher then django.contrib.auth in INSTALLED_APPS, but my
override seems to be completely ignored.
--
Ticket URL: <https://code.djangoproject.com/ticket/30535#comment:1>
* status: new => closed
* component: contrib.auth => Internationalization
* version: 2.1 => master
* resolution: => invalid
Comment:
Thanks for the report, however, translations are handled at
[https://docs.djangoproject.com/en/dev/internals/contributing/localizing/#translations.
Transifex] and not in this tracker.
--
Ticket URL: <https://code.djangoproject.com/ticket/30535#comment:2>