#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191e93501f9-e8b0bd07-211b-4521-b0d0-5108bf39e915-000000%40eu-central-1.amazonses.com.

Reply via email to