[Django] #29587: Problem with "Plural-forms" generated in PO file for Haitian Language

43 views
Skip to first unread message

Django

unread,
Jul 23, 2018, 3:34:37 PM7/23/18
to django-...@googlegroups.com
#29587: Problem with "Plural-forms" generated in PO file for Haitian Language
-----------------------------------------+-------------------------------
Reporter: Ed Menendez | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Keywords: i18n, haitian
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+-------------------------------
When you makemessages for locale=ht (Haitian language), it generates a
plural-form like this:

{{{"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"}}}

It should instead look like this:

{{{"Plural-Forms: nplurals=2; plural=(n != 1);\n"}}}

The workaround is to manually edit the PO file after generation. If you
try to use the incorrect PO file it will generate this error:

{{{ValueError: "invalid token in plural form": EXPRESSION}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29587>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 23, 2018, 4:29:54 PM7/23/18
to django-...@googlegroups.com
#29587: Problem with "Plural-forms" generated in PO file for Haitian Language
-------------------------------+--------------------------------------

Reporter: Ed Menendez | Owner: nobody
Type: Bug | Status: closed
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: i18n, haitian | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Ramiro Morales):

* status: new => closed
* resolution: => invalid


Comment:

Hi Ed,

When you run makemessages for the first time (i.e. a `django.po` file is
going to be created for you), these plural form PO files header fields are
copied by Django from its own .po files (found in
`django/conf/locale/<LOCALE NAME>/LC_MESSAGES/*.po`)

There is no locally available database of plural forms formulas, nor a
fancy scheme to e.g. get it from a repository.

This means Django unfortunately has no way to insert the right header
there because there is no `ht` translation for Django itself so there is
no `django/conf/locale/ht/LC_MESSAGES/*.po` and so the generic `"Plural-
Forms: nplurals=INTEGER; plural=EXPRESSION;\n"` value as written by the
GNU gettext CLI tools is left intact.

One workaround could be to use another locale with the same plural forms
formula, like `es`, but then you'll have to edit the `Language*` fields
:-(

--
Ticket URL: <https://code.djangoproject.com/ticket/29587#comment:1>

Django

unread,
Jul 23, 2018, 4:39:52 PM7/23/18
to django-...@googlegroups.com
#29587: Problem with "Plural-forms" generated in PO file for Haitian Language
-------------------------------+--------------------------------------

Reporter: Ed Menendez | Owner: nobody
Type: Bug | Status: closed
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: i18n, haitian | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Ramiro Morales):

Replying to [comment:1 Ramiro Morales]:


> One workaround could be to use another locale with the same plural forms
formula, like `es`, but then you'll have to edit the `Language*` fields
:-(

...and rename the newly created `es` directory to `ht`.

--
Ticket URL: <https://code.djangoproject.com/ticket/29587#comment:2>

Django

unread,
Jul 23, 2018, 5:38:23 PM7/23/18
to django-...@googlegroups.com
#29587: Problem with "Plural-forms" generated in PO file for Haitian Language
-------------------------------+--------------------------------------

Reporter: Ed Menendez | Owner: nobody
Type: Bug | Status: closed
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: i18n, haitian | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Ed Menendez):

The workaround causes a few undesired side effects. Assuming I'm not using
"es" and I make "ht" use the "es" language code.. then the page will read
{{{<html lang="es">}}} for Haitian which will cause other problems.

Manually editing the PO file seems like a better workaround.

For the future though, should there be a way to provide the default header
to Django for languages that aren't officially Django supported? Maybe
include a /templates/locale/defaults/ht/ or something like that. Or
possibly provide the needed values in a dictionary in settings.py?

--
Ticket URL: <https://code.djangoproject.com/ticket/29587#comment:3>

Django

unread,
Jul 23, 2018, 5:46:57 PM7/23/18
to django-...@googlegroups.com
#29587: Problem with "Plural-forms" generated in PO file for Haitian Language
-------------------------------+--------------------------------------

Reporter: Ed Menendez | Owner: nobody
Type: Bug | Status: closed
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: i18n, haitian | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Ed Menendez):

Another solution would be for Django provide instructions when you run
"makemessages" so that it warns about the situation and what the
workarounds are.

--
Ticket URL: <https://code.djangoproject.com/ticket/29587#comment:4>

Django

unread,
Jul 24, 2018, 3:40:42 AM7/24/18
to django-...@googlegroups.com
#29587: Problem with "Plural-forms" generated in PO file for Haitian Language
-------------------------------+--------------------------------------

Reporter: Ed Menendez | Owner: nobody
Type: Bug | Status: closed
Component: Uncategorized | Version: 1.11
Severity: Normal | Resolution: invalid

Keywords: i18n, haitian | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by Claude Paroz):

And what about providing a Haitian translation for Django itself?
https://docs.djangoproject.com/en/2.0/internals/contributing/localizing/

--
Ticket URL: <https://code.djangoproject.com/ticket/29587#comment:5>

Reply all
Reply to author
Forward
0 new messages