how to add new languages into Django? My language "Uyghur" or "Uighur" is not supported in Django.
Can I add new language locale file in my project and use it? for example: zh_UG
this language is not supported in Django.
Add a non available language to your Django app
ISO language code of Uighur ئۇيغۇر تىلى is 'ug'.
In your settings.py:
from django.conf import global_settings
gettext_noop = lambda s: s
LANGUAGES = (
('ug', gettext_noop('Uighur')),
)
EXTRA_LANG_INFO = {
'ug': {
'bidi': True, # right-to-left
'code': 'ug',
'name': 'Uighur',
'name_local': u'\u0626\u06C7\u064A\u063A\u06C7\u0631 \u062A\u0649\u0644\u0649', #unicode codepoints here
},
}
# Add custom languages not provided by Django
import django.conf.locale
LANG_INFO = dict(django.conf.locale.LANG_INFO, **EXTRA_LANG_INFO)
django.conf.locale.LANG_INFO = LANG_INFO
# Languages using BiDi (right-to-left) layout
LANGUAGES_BIDI = global_settings.LANGUAGES_BIDI + ["ug"]
And:
manage.py makemessages -l ug
manage.py compilemessages