From 2e4557f3f3de4d423b4ef1fb0e51a98948a79e31 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 19 Mar 2022 16:45:14 +0100 Subject: [PATCH] [fix] languages: show country name even if there is only one country Signed-off-by: Markus Heiser --- searx/languages.py | 36 ++++++++++++------------ searxng_extra/update/update_languages.py | 2 -- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/searx/languages.py b/searx/languages.py index a1291ba04..2c50a0af0 100644 --- a/searx/languages.py +++ b/searx/languages.py @@ -5,15 +5,15 @@ language_codes = ( ('af-ZA', 'Afrikaans', '', 'Afrikaans', '\U0001f1ff\U0001f1e6'), ('ar-EG', 'العربية', '', 'Arabic', '\U0001f1ea\U0001f1ec'), ('be-BY', 'Беларуская', '', 'Belarusian', '\U0001f1e7\U0001f1fe'), - ('bg-BG', 'Български', '', 'Bulgarian', '\U0001f1e7\U0001f1ec'), + ('bg-BG', 'Български', 'България', 'Bulgarian', '\U0001f1e7\U0001f1ec'), ('ca-ES', 'Català', '', 'Catalan', '\U0001f1ea\U0001f1f8'), - ('cs-CZ', 'Čeština', '', 'Czech', '\U0001f1e8\U0001f1ff'), - ('da-DK', 'Dansk', '', 'Danish', '\U0001f1e9\U0001f1f0'), + ('cs-CZ', 'Čeština', 'Česko', 'Czech', '\U0001f1e8\U0001f1ff'), + ('da-DK', 'Dansk', 'Danmark', 'Danish', '\U0001f1e9\U0001f1f0'), ('de', 'Deutsch', '', 'German', '\U0001f310'), ('de-AT', 'Deutsch', 'Österreich', 'German', '\U0001f1e6\U0001f1f9'), ('de-CH', 'Deutsch', 'Schweiz', 'German', '\U0001f1e8\U0001f1ed'), ('de-DE', 'Deutsch', 'Deutschland', 'German', '\U0001f1e9\U0001f1ea'), - ('el-GR', 'Ελληνικά', '', 'Greek', '\U0001f1ec\U0001f1f7'), + ('el-GR', 'Ελληνικά', 'Ελλάδα', 'Greek', '\U0001f1ec\U0001f1f7'), ('en', 'English', '', 'English', '\U0001f310'), ('en-AU', 'English', 'Australia', 'English', '\U0001f1e6\U0001f1fa'), ('en-CA', 'English', 'Canada', 'English', '\U0001f1e8\U0001f1e6'), @@ -27,9 +27,9 @@ language_codes = ( ('es-CL', 'Español', 'Chile', 'Spanish', '\U0001f1e8\U0001f1f1'), ('es-ES', 'Español', 'España', 'Spanish', '\U0001f1ea\U0001f1f8'), ('es-MX', 'Español', 'México', 'Spanish', '\U0001f1f2\U0001f1fd'), - ('et-EE', 'Eesti', '', 'Estonian', '\U0001f1ea\U0001f1ea'), + ('et-EE', 'Eesti', 'Eesti', 'Estonian', '\U0001f1ea\U0001f1ea'), ('fa-IR', 'فارسی', '', 'Persian', '\U0001f1ee\U0001f1f7'), - ('fi-FI', 'Suomi', '', 'Finnish', '\U0001f1eb\U0001f1ee'), + ('fi-FI', 'Suomi', 'Suomi', 'Finnish', '\U0001f1eb\U0001f1ee'), ('fr', 'Français', '', 'French', '\U0001f310'), ('fr-BE', 'Français', 'Belgique', 'French', '\U0001f1e7\U0001f1ea'), ('fr-CA', 'Français', 'Canada', 'French', '\U0001f1e8\U0001f1e6'), @@ -37,31 +37,31 @@ language_codes = ( ('fr-FR', 'Français', 'France', 'French', '\U0001f1eb\U0001f1f7'), ('he-IL', 'עברית', '', 'Hebrew', '\U0001f1ee\U0001f1f1'), ('hi-IN', 'हिन्दी', '', 'Hindi', '\U0001f1ee\U0001f1f3'), - ('hr-HR', 'Hrvatski', '', 'Croatian', '\U0001f1ed\U0001f1f7'), - ('hu-HU', 'Magyar', '', 'Hungarian', '\U0001f1ed\U0001f1fa'), + ('hr-HR', 'Hrvatski', 'Hrvatska', 'Croatian', '\U0001f1ed\U0001f1f7'), + ('hu-HU', 'Magyar', 'Magyarország', 'Hungarian', '\U0001f1ed\U0001f1fa'), ('id-ID', 'Indonesia', '', 'Indonesian', '\U0001f1ee\U0001f1e9'), ('is-IS', 'Íslenska', '', 'Icelandic', '\U0001f1ee\U0001f1f8'), - ('it-IT', 'Italiano', '', 'Italian', '\U0001f1ee\U0001f1f9'), + ('it-IT', 'Italiano', 'Italia', 'Italian', '\U0001f1ee\U0001f1f9'), ('ja-JP', '日本語', '', 'Japanese', '\U0001f1ef\U0001f1f5'), ('ko-KR', '한국어', '', 'Korean', '\U0001f1f0\U0001f1f7'), - ('lt-LT', 'Lietuvių', '', 'Lithuanian', '\U0001f1f1\U0001f1f9'), - ('lv-LV', 'Latviešu', '', 'Latvian', '\U0001f1f1\U0001f1fb'), + ('lt-LT', 'Lietuvių', 'Lietuva', 'Lithuanian', '\U0001f1f1\U0001f1f9'), + ('lv-LV', 'Latviešu', 'Latvija', 'Latvian', '\U0001f1f1\U0001f1fb'), ('nl', 'Nederlands', '', 'Dutch', '\U0001f310'), ('nl-BE', 'Nederlands', 'België', 'Dutch', '\U0001f1e7\U0001f1ea'), ('nl-NL', 'Nederlands', 'Nederland', 'Dutch', '\U0001f1f3\U0001f1f1'), - ('pl-PL', 'Polski', '', 'Polish', '\U0001f1f5\U0001f1f1'), + ('pl-PL', 'Polski', 'Polska', 'Polish', '\U0001f1f5\U0001f1f1'), ('pt', 'Português', '', 'Portuguese', '\U0001f310'), ('pt-BR', 'Português', 'Brasil', 'Portuguese', '\U0001f1e7\U0001f1f7'), ('pt-PT', 'Português', 'Portugal', 'Portuguese', '\U0001f1f5\U0001f1f9'), - ('ro-RO', 'Română', '', 'Romanian', '\U0001f1f7\U0001f1f4'), - ('ru-RU', 'Русский', '', 'Russian', '\U0001f1f7\U0001f1fa'), - ('sk-SK', 'Slovenčina', '', 'Slovak', '\U0001f1f8\U0001f1f0'), + ('ro-RO', 'Română', 'România', 'Romanian', '\U0001f1f7\U0001f1f4'), + ('ru-RU', 'Русский', 'Россия', 'Russian', '\U0001f1f7\U0001f1fa'), + ('sk-SK', 'Slovenčina', 'Slovensko', 'Slovak', '\U0001f1f8\U0001f1f0'), ('sl-SI', 'Slovenščina', '', 'Slovenian', '\U0001f1f8\U0001f1ee'), ('sr-RS', 'Српски', '', 'Serbian', '\U0001f1f7\U0001f1f8'), - ('sv-SE', 'Svenska', '', 'Swedish', '\U0001f1f8\U0001f1ea'), + ('sv-SE', 'Svenska', 'Sverige', 'Swedish', '\U0001f1f8\U0001f1ea'), ('sw-TZ', 'Kiswahili', '', 'Swahili', '\U0001f1f9\U0001f1ff'), - ('th-TH', 'ไทย', '', 'Thai', '\U0001f1f9\U0001f1ed'), - ('tr-TR', 'Türkçe', '', 'Turkish', '\U0001f1f9\U0001f1f7'), + ('th-TH', 'ไทย', 'ไทย', 'Thai', '\U0001f1f9\U0001f1ed'), + ('tr-TR', 'Türkçe', 'Türkiye', 'Turkish', '\U0001f1f9\U0001f1f7'), ('uk-UA', 'Українська', '', 'Ukrainian', '\U0001f1fa\U0001f1e6'), ('vi-VN', 'Tiếng Việt', '', 'Vietnamese', '\U0001f1fb\U0001f1f3'), ('zh', '中文', '', 'Chinese', '\U0001f310'), diff --git a/searxng_extra/update/update_languages.py b/searxng_extra/update/update_languages.py index 631f197e4..92083f39f 100755 --- a/searxng_extra/update/update_languages.py +++ b/searxng_extra/update/update_languages.py @@ -224,9 +224,7 @@ def filter_language_list(all_languages): if len(filtered_countries) > 1: filtered_countries[lang] = _copy_lang_data(lang, None) elif len(filtered_countries) == 1: - # if there's only one country per language, it's not necessary to show country name lang_country = next(iter(filtered_countries)) - filtered_countries[lang_country]['country_name'] = None # if no country has enough engines try to get most likely country code from babel if not filtered_countries: