Opened 6 months ago

Closed 6 months ago

#30535 closed Bug (invalid)

Czech plural-forms is incorrect in translations.

Reported by: Jakub Kaláb Owned by: nobody
Component: Internationalization Version: master
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)

Screenshot from 2019-06-01 13-43-58.png (171.2 KB) - added by Jakub Kaláb 6 months ago.
screenshot of bug reproduced in django shell

Download all attachments as: .zip

Change History (3)

Changed 6 months ago by Jakub Kaláb

screenshot of bug reproduced in django shell

comment:1 Changed 6 months ago 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. Without the ability to at least override this, we're stuck with django 2.0 since we can't very well have the english message in our apps.

Last edited 6 months ago by Jakub Kaláb (previous) (diff)

comment:2 Changed 6 months ago by felixxm

Component: contrib.authInternationalization
Resolution: invalid
Status: newclosed
Summary: czech translations for "This password is too short. It must contain at least %(min_length)d character." broken in django >= 2.1.0Czech plural-forms is incorrect in translations.
Version: 2.1master

Thanks for the report, however, translations are handled at Transifex and not in this tracker.

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