diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2022-04-03 14:30:19 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2022-04-05 16:48:25 +0200 |
commit | effcde3d0ea18be713dd9d0a63669a547cb6011a (patch) | |
tree | 60dd9a9330523659175c751db2b06e80a9e58c4d /searxng_extra/update | |
parent | 765504ceca4ce9e69b02b213b2f9a3036915055d (diff) | |
download | searxng-effcde3d0ea18be713dd9d0a63669a547cb6011a.tar.gz searxng-effcde3d0ea18be713dd9d0a63669a547cb6011a.zip |
[fix] add missing territory (country) name
Related-to: https://github.com/searxng/searxng/pull/1029#issuecomment-1086824911
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searxng_extra/update')
-rwxr-xr-x | searxng_extra/update/update_languages.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/searxng_extra/update/update_languages.py b/searxng_extra/update/update_languages.py index 92083f39f..95ee5bd3e 100755 --- a/searxng_extra/update/update_languages.py +++ b/searxng_extra/update/update_languages.py @@ -113,6 +113,16 @@ def get_unicode_flag(lang_code): return c1 + c2 +def get_territory_name(lang_code): + country_name = None + locale = get_locale(lang_code) + try: + country_name = locale.get_territory_name() + except FileNotFoundError as exc: + print("ERROR: %s --> %s" % (locale, exc)) + return country_name + + # Join all language lists. def join_language_lists(engines_languages): language_list = {} @@ -274,7 +284,7 @@ def write_languages_file(languages): item = ( code, languages[code]['name'].split(' (')[0], - languages[code].get('country_name') or '', + get_territory_name(code) or '', languages[code].get('english_name') or '', UnicodeEscape(flag), ) |