Opened 4 years ago
Last modified 4 years ago
#32373 closed Bug
Broken translations since the introduction of TranslationCatalog — at Initial Version
Reported by: | Hristo Gatsinski | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | Normal | Keywords: | translations |
Cc: | Claude Paroz, Carlton Gibson | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I recently updated one of my projects from the latest patch version of 2.2 to 3.1 and noticed that one of the translations is broken. When I translate "All" to Bulgarian it should output "Всичко" but instead, I get "Все" which I believe is in Russian. The PO files in Django are correct, and I have the same string translated in my project too. Both with the correct msgstr.
I managed to track the issue to the introduction of TranslationCatalog in 3.0.5 in this commit:
https://github.com/django/django/commit/d9f1792c7649e9f946f4a3a35a76bddf5a412b8b
Replacing _catalog from TranslationCatalog() to normal Python dict (as it used to be in 3.0.4 and prior) resolves the issue.
The issue continues to exist in the latest 3.1 and the pre-release 3.2a1.
I use Linux Mint 20.1 based on Ubuntu 20.04. For a while I suspected gettext. The last version available via apt is 0.19.8.1 but I also installed the latest from source (0.21). The issue still exists.
The bug is easy to reproduce.
Enter the shell of any project with Django 3.0.4 and older and execute the following:
from django.utils import translation
translation.activate('bg')
translation.gettext('All')
You will see "Всичко".
Do the same with Django 3.0.5 and above and you will get "Все" which is an incorrect translation.
I failed to find an existing ticket describing this problem. Forgive me if there is one already.