Locales¶
Initialize LOCALE_NAMES
, RTL_LOCALES
.
- searx.locales.ADDITIONAL_TRANSLATIONS = {'oc': 'Occitan', 'szl': 'Ślōnski (Silesian)'}¶
Additional languages SearXNG has translations for but not supported by python-babel (see
locales_initialize
).
- searx.locales.LOCALE_BEST_MATCH = {'nl-BE': 'nl', 'oc': 'fr-FR', 'szl': 'pl', 'zh-HK': 'zh-Hant-TW'}¶
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 Kong.
- searx.locales.LOCALE_NAMES = {'ar': 'العربية (Arabic)', 'bg': 'Български (Bulgarian)', 'bn': 'বাংলা (Bangla)', 'bo': 'བོད་སྐད་ (Tibetan)', 'ca': 'Català (Catalan)', 'cs': 'Čeština (Czech)', 'cy': 'Cymraeg (Welsh)', 'da': 'Dansk (Danish)', 'de': 'Deutsch (German)', 'el-GR': 'Ελληνικά, Ελλάδα (Greek, Greece)', 'en': 'English', 'eo': 'Esperanto', 'es': 'Español (Spanish)', 'et': 'Eesti (Estonian)', 'eu': 'Euskara (Basque)', 'fa-IR': 'فارسی, ایران (Persian, Iran)', 'fi': 'Suomi (Finnish)', 'fil': 'Filipino', 'fr': 'Français (French)', 'gl': 'Galego (Galician)', 'he': 'עברית (Hebrew)', 'hr': 'Hrvatski (Croatian)', 'hu': 'Magyar (Hungarian)', 'ia': 'Interlingua', 'id': 'Indonesia (Indonesian)', 'it': 'Italiano (Italian)', 'ja': '日本語 (Japanese)', 'ko': '한국어 (Korean)', 'lt': 'Lietuvių (Lithuanian)', 'lv': 'Latviešu (Latvian)', 'nb-NO': 'Norsk bokmål, Norge (Norwegian bokmål, Norway)', 'nl': 'Nederlands (Dutch)', 'nl-BE': 'Nederlands, België (Dutch, Belgium)', 'oc': 'Occitan', 'pl': 'Polski (Polish)', 'pt': 'Português (Portuguese)', 'pt-BR': 'Português, Brasil (Portuguese, Brazil)', 'ro': 'Română (Romanian)', 'ru': 'Русский (Russian)', 'sk': 'Slovenčina (Slovak)', 'sl': 'Slovenščina (Slovenian)', 'sr': 'Српски (Serbian)', 'sv': 'Svenska (Swedish)', 'szl': 'Ślōnski (Silesian)', 'ta': 'தமிழ் (Tamil)', 'te': 'తెలుగు (Telugu)', 'tr': 'Türkçe (Turkish)', 'uk': 'Українська (Ukrainian)', 'vi': 'Tiếng việt (Vietnamese)', 'zh-HK': '中文, 中國香港 (Chinese, Hong Kong SAR China)', 'zh-Hans-CN': '中文, 中国 (Chinese, China)', 'zh-Hant-TW': '中文, 台灣 (Chinese, Taiwan)'}¶
Mapping of locales and their description. Locales e.g. ‘fr’ or ‘pt-BR’ (see
locales_initialize
).
- searx.locales.RTL_LOCALES: Set[str] = {'ar', 'fa-IR', 'he'}¶
List of Right-To-Left locales e.g. ‘he’ or ‘fa-IR’ (see
locales_initialize
).
- searx.locales.get_locale_descr(locale, locale_name)[source]¶
Get locale name e.g. ‘Français - fr’ or ‘Português (Brasil) - pt-BR’
- Parameters:
locale – instance of
Locale
locale_name – name e.g. ‘fr’ or ‘pt_BR’ (delimiter is underscore)
- searx.locales.get_translations()[source]¶
Monkey patch of
flask_babel.get_translations
- searx.locales.locales_initialize(directory=None)[source]¶
Initialize locales environment of the SearXNG session.
monkey patch
flask_babel.get_translations
byget_translations
init global names
LOCALE_NAMES
,RTL_LOCALES