Browse Source

locales.py: add support for Papiamento

Alexandre Flament 2 years ago
parent
commit
f90aed7ef9
1 changed files with 5 additions and 0 deletions
  1. 5 0
      searx/locales.py

+ 5 - 0
searx/locales.py

@@ -32,6 +32,7 @@ RTL_LOCALES: Set[str] = set()
 ADDITIONAL_TRANSLATIONS = {
 ADDITIONAL_TRANSLATIONS = {
     "oc": "Occitan",
     "oc": "Occitan",
     "szl": "Ślōnski (Silesian)",
     "szl": "Ślōnski (Silesian)",
+    "pap": "Papiamento",
 }
 }
 """Additional languages SearXNG has translations for but not supported by
 """Additional languages SearXNG has translations for but not supported by
 python-babel (see :py:obj:`locales_initialize`)."""
 python-babel (see :py:obj:`locales_initialize`)."""
@@ -41,6 +42,7 @@ LOCALE_BEST_MATCH = {
     "szl": "pl",
     "szl": "pl",
     "nl-BE": "nl",
     "nl-BE": "nl",
     "zh-HK": "zh-Hant-TW",
     "zh-HK": "zh-Hant-TW",
+    "pap": "pt-BR",
 }
 }
 """Map a locale we do not have a translations for to a locale we have a
 """Map a locale we do not have a translations for to a locale we have a
 translation for. By example: use Taiwan version of the translation for Hong
 translation for. By example: use Taiwan version of the translation for Hong
@@ -79,6 +81,9 @@ def get_translations():
     if has_request_context() and flask.request.form.get('use-translation') == 'szl':
     if has_request_context() and flask.request.form.get('use-translation') == 'szl':
         babel_ext = flask_babel.current_app.extensions['babel']
         babel_ext = flask_babel.current_app.extensions['babel']
         return Translations.load(next(babel_ext.translation_directories), 'szl')
         return Translations.load(next(babel_ext.translation_directories), 'szl')
+    if has_request_context() and flask.request.form.get('use-translation') == 'pap':
+        babel_ext = flask_babel.current_app.extensions['babel']
+        return Translations.load(next(babel_ext.translation_directories), 'pap')
     return _flask_babel_get_translations()
     return _flask_babel_get_translations()