Opened 6 years ago
Closed 6 years ago
#30535 closed Bug (invalid)
Czech plural-forms is incorrect in translations.
Reported by: | Jakub Kaláb | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The plural czech translations for "This password is too short. It must contain at least %(min_length)d character." are broken in django versions 2.1.0 and higher for n >= 5. Can be easily reproduced:
- 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.
Attachments (1)
Change History (3)
by , 6 years ago
Attachment: | Screenshot from 2019-06-01 13-43-58.png added |
---|
comment:1 by , 6 years ago
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.
comment:2 by , 6 years ago
Component: | contrib.auth → Internationalization |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Summary: | czech translations for "This password is too short. It must contain at least %(min_length)d character." broken in django >= 2.1.0 → Czech plural-forms is incorrect in translations. |
Version: | 2.1 → master |
Thanks for the report, however, translations are handled at Transifex and not in this tracker.
screenshot of bug reproduced in django shell