#20070: LOCALE_PATHS doesn't support "external" translations
-------------------------------------+-------------------------------------
Reporter: nahuel | Owner: nobody
Type: New feature | Status: new
Component: | Version: 1.5
Internationalization | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by aaugustin):
The feature requested here is a convenient way to load in Django's i18n
implementation .mo files from other software and not called django.mo.
Here's the workaround found by the OP:
{{{
import pycountry, gettext
from django.utils.translation import get_language, to_locale, trans_real
language = get_language()
locale = to_locale(get_language())
res = trans_real._translations.get(language, None)
t = gettext.translation("iso639", pycountry.LOCALES_DIR, [locale],
class_=trans_real.DjangoTranslation)
t.set_language(language)
res.merge(t)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/20070#comment:3>
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 post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.