#36579: yesno filter broken for some languages
-------------------------------------+-------------------------------------
     Reporter:  Klaas van Schelven   |                     Type:
                                     |  Uncategorized
       Status:  new                  |                Component:
                                     |  Uncategorized
      Version:  dev                  |                 Severity:  Normal
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 2 related problems:

 1: Some languages do not translate the "yes,no,maybe" string including
 comma's

 {{{
 $ find -name "*.po" | x grep yes,no,maybe -A1 | grep msgstr | grep -v , |
 grep -v '""'
 ./django/conf/locale/km/LC_MESSAGES/django.po-msgstr "យល់ព្រម មិនយល់ព្រម​
 ប្រហែល"
 ./django/conf/locale/zh_Hant/LC_MESSAGES/django.po-msgstr "是、否、也許"
 ./django/conf/locale/fa/LC_MESSAGES/django.po-msgstr "بله،خیر،شاید"
 ./django/conf/locale/ur/LC_MESSAGES/django.po-msgstr "ھاں،نہیں،ھوسکتاہے"
 ./django/conf/locale/ug/LC_MESSAGES/django.po-msgstr "ھەئە، ياق، بەلكىىم"
 ./django/conf/locale/ckb/LC_MESSAGES/django.po-msgstr
 "بەڵێ،نەخێر،لەوانەیە"
 ./django/conf/locale/zh_Hans/LC_MESSAGES/django.po-msgstr "是、否、也许"
 }}}


 2. the filter returns the value when the arg is incorrect:
 
https://github.com/django/django/blob/main/django/template/defaultfilters.py#L881

 IMHO this is wrong, because it breaks the Maybe(bool) => str type of the
 function. For the broken arg, it should either:
 [a] override the arg to the default "yes,no,maybe"
 [b] raise an exception

 these 2 things combined make it so that when any of the broken languages
 is activated, the filter is broken. Consider e.g. yesno(True).capitalize()
 which will now raise an exception in Chinese.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36579>
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070198f07aa43d-834b21f3-6751-47cc-abcb-57740c33a113-000000%40eu-central-1.amazonses.com.

Reply via email to