{{{"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.
* 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>
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>
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>
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>
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>