I have a form where most elements are translating as I would expect but a the language dropdown isn't.
I have a file, languages.py
of the following format:
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
LANGUAGE_OPTIONS = (
("Abkhaz", "аҧсуа (%s)" % _("Abkhaz")),
("Afar", "Afaraf (%s)" % _("Afar")),
("Afrikaans", "Afrikaans (%s)" % _("Afrikaans")),
("Akan", "Akan (%s)" % _("Akan")),
("Albanian", "Shqip (%s)" % _("Albanian")),
....
("Zhuang, Chuang", "Saɯ cueŋƅ, Saw cuengh (%s)" % _("Zhuang, Chuang")),
)
The idea being the English version of the code is saved to the database but the user can see the language in it's original and their language.
I import this into forms.py
using from .languages import LANGUAGE_OPTIONS as language_choices
I then have the following field within the form
other_languages = forms.MultipleChoiceField(
choices=language_choices,
label = _("Which language(s)"), required = False
)
"Which language(s)" is translated correctly, but the languages within the choices are not.
What have I got wrong?
EDIT I think I might know the answer but if anyone can confirm I would appreciate it.
I think LANGUAGE_OPTIONS
should be setup as
LANGUAGE_OPTIONS = (
("Abkhaz", _("аҧсуа (Abkhaz)"),
...
)
And then in django.po my translation would look like
msgid "аҧсуа (Abkhaz)"
msgstr "аҧсуа (abkhaz)"
Is that right?
LANGUAGE_OPTIONS should be setup as
LANGUAGE_OPTIONS = (
("Abkhaz", _("аҧсуа (Abkhaz)"),
...
)
And then in django.po my translation would look like
msgid "аҧсуа (Abkhaz)"
msgstr "аҧсуа (abkhaz)"