Show Gujarati in the list of UI languages

- Explicitly setup the list of Django languages. Keep them sorted by language
  code.

- Fallback to language name when Django can't provide locale language name.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa authored and Joseph Nuthalapati committed 2019-01-09 14:52:02 +05:30
1 parent 201b256fe5
commit 7ee4d13dce
2 files changed
+27 -3

No files matched your search

+17
View File
@@ -25,6 +25,7 @@ import stat
import django.conf
import django.core.management
import django.core.wsgi
from django.conf import global_settings
from django.contrib.messages import constants as message_constants
from . import cfg, log, module_loader
@@ -114,6 +115,7 @@ def init():
FORCE_SCRIPT_NAME=cfg.server_dir,
INSTALLED_APPS=applications,
IPWARE_META_PRECEDENCE_ORDER=('HTTP_X_FORWARDED_FOR', ),
LANGUAGES=get_languages(),
LOGGING=log.get_configuration(),
LOGIN_URL='users:login',
LOGIN_REDIRECT_URL='index',
@@ -161,6 +163,21 @@ def init():
os.chmod(cfg.store_file, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
def get_languages():
"""Return list of languages to show in the interface.
Add additional languages that FreedomBox support but Django doesn't.
"""
def gettext_noop(string):
"""Django's actual translation methods need Django to be setup."""
return string
return sorted(list(global_settings.LANGUAGES) + [
('gu', gettext_noop('Gujarati')),
])
def get_wsgi_application():
"""Return Django wsgi application."""
return django.core.wsgi.get_wsgi_application()