#35760: Cannot translate word `None` using `gettext_lazy`
-------------------------------------+-------------------------------------
Reporter: FrostKiwi | Type: Bug
Status: new | Component:
| Internationalization
Version: 5.1 | Severity: Normal
Keywords: translation | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
We have setup translation following
https://docs.djangoproject.com/en/5.1/topics/i18n/translation/#lazy-
translation .
Works great.
We have found a case, where translation is simply refused though and the
initial string is returned, even though complete translation is provided
with the `django-admin makemessages` --> Weblate --> `django-admin
compilemessages` workflow. The word `None`.
{{{
from django.utils.translation import gettext_lazy as _
damage = {
PRESENT: {
"verbose_name": _("Present"),
},
NONE: {
"verbose_name": _("None"),
},
NO_INFORMATION: {
"verbose_name": _("No information"),
},
}
}}}
`backend\RestAPI\locale\ja\LC_MESSAGES\django.po`
{{{
...
#: .\RestAPI\algorithms\AD00002\cl20231101_2.py:25
#: .\RestAPI\model_constants.py:89 .\RestAPI\model_constants.py:98
msgid "None"
msgstr "なし"
...
}}}
this code results in translations for all words, except `None`, which
keeps returning `None` untranslated. Didn't debug deep enough to
understand whether this is an issue with Django, specifically
`gettext_lazy` or the underlying `gettext` suite of tools.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35760>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.