Add support for the Silesian language

This commit is contained in:
Alexandre FLAMENT 2022-05-06 09:40:45 +00:00
parent 12a584c5dd
commit 550f70b1aa
2 changed files with 7 additions and 0 deletions

View File

@ -13,6 +13,7 @@ from babel import Locale
LOCALE_NAMES = { LOCALE_NAMES = {
"oc": "Occitan", "oc": "Occitan",
"nl-BE": "Vlaams (Dutch, Belgium)", "nl-BE": "Vlaams (Dutch, Belgium)",
"szl": "Ślōnski (Silesian)",
} }
"""Mapping of locales and their description. Locales e.g. 'fr' or 'pt-BR' """Mapping of locales and their description. Locales e.g. 'fr' or 'pt-BR'
(delimiter is *underline* '-')""" (delimiter is *underline* '-')"""

View File

@ -220,6 +220,9 @@ def _get_translations():
if has_request_context() and request.form.get('use-translation') == 'oc': if has_request_context() and request.form.get('use-translation') == 'oc':
babel_ext = flask_babel.current_app.extensions['babel'] babel_ext = flask_babel.current_app.extensions['babel']
return Translations.load(next(babel_ext.translation_directories), 'oc') return Translations.load(next(babel_ext.translation_directories), 'oc')
if has_request_context() and request.form.get('use-translation') == 'szl':
babel_ext = flask_babel.current_app.extensions['babel']
return Translations.load(next(babel_ext.translation_directories), 'szl')
return _flask_babel_get_translations() return _flask_babel_get_translations()
@ -238,6 +241,9 @@ def get_locale():
if locale == 'oc': if locale == 'oc':
request.form['use-translation'] = 'oc' request.form['use-translation'] = 'oc'
locale = 'fr_FR' locale = 'fr_FR'
if locale == 'szl':
request.form['use-translation'] = 'szl'
locale = 'pl'
if locale == '': if locale == '':
# if there is an error loading the preferences # if there is an error loading the preferences
# the locale is going to be '' # the locale is going to be ''