mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
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:
1 parent
201b256fe5
commit
7ee4d13dce
2 files changed
+27
-3
No files matched your search
+10
-3
@@ -69,14 +69,21 @@ class LanguageSelectionFormMixin:
|
||||
supported_languages = [
|
||||
(None, _('Use the language preference set in the browser'))
|
||||
]
|
||||
|
||||
def _get_local_name(language_code, language_name):
|
||||
try:
|
||||
return get_language_info(language_code)['name_local']
|
||||
except KeyError:
|
||||
return language_name
|
||||
|
||||
for language_code, language_name in settings.LANGUAGES:
|
||||
locale_code = translation.to_locale(language_code)
|
||||
plinth_dir = os.path.dirname(plinth.__file__)
|
||||
if language_code == 'en' or os.path.exists(
|
||||
os.path.join(plinth_dir, 'locale', locale_code)):
|
||||
supported_languages.append(
|
||||
(language_code,
|
||||
get_language_info(language_code)['name_local']))
|
||||
supported_languages.append((language_code,
|
||||
_get_local_name(
|
||||
language_code, language_name)))
|
||||
|
||||
self.fields['language'].choices = supported_languages
|
||||
|
||||
|
||||
Reference in new issue
Block a user