mirror of https://github.com/searxng/searxng.git
[fix] don't show flags for languages without region identifier
SearXNG shows two different things: region: "de-CH" is the equivalent of "Schweiz (de)" in DDG. languages: "en" doesn't say anything about the location. It is up the engines to do their best to select English results without a region. Suggested-by: @dalf https://github.com/searxng/searxng/pull/967#issuecomment-1072979693 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
2841abaf55
commit
a25e3767d4
|
@ -2,17 +2,19 @@
|
||||||
# list of language codes
|
# list of language codes
|
||||||
# this file is generated automatically by utils/fetch_languages.py
|
# this file is generated automatically by utils/fetch_languages.py
|
||||||
language_codes = (
|
language_codes = (
|
||||||
|
('af-ZA', 'Afrikaans', '', 'Afrikaans', '\U0001f1ff\U0001f1e6'),
|
||||||
('ar-EG', 'العربية', '', 'Arabic', '\U0001f1ea\U0001f1ec'),
|
('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'),
|
('ca-ES', 'Català', '', 'Catalan', '\U0001f1ea\U0001f1f8'),
|
||||||
('cs-CZ', 'Čeština', '', 'Czech', '\U0001f1e8\U0001f1ff'),
|
('cs-CZ', 'Čeština', '', 'Czech', '\U0001f1e8\U0001f1ff'),
|
||||||
('da-DK', 'Dansk', '', 'Danish', '\U0001f1e9\U0001f1f0'),
|
('da-DK', 'Dansk', '', 'Danish', '\U0001f1e9\U0001f1f0'),
|
||||||
('de', 'Deutsch', '', 'German', '\U0001f1e9\U0001f1ea'),
|
('de', 'Deutsch', '', 'German', '\U0001f310'),
|
||||||
('de-AT', 'Deutsch', 'Österreich', 'German', '\U0001f1e6\U0001f1f9'),
|
('de-AT', 'Deutsch', 'Österreich', 'German', '\U0001f1e6\U0001f1f9'),
|
||||||
('de-CH', 'Deutsch', 'Schweiz', 'German', '\U0001f1e8\U0001f1ed'),
|
('de-CH', 'Deutsch', 'Schweiz', 'German', '\U0001f1e8\U0001f1ed'),
|
||||||
('de-DE', 'Deutsch', 'Deutschland', 'German', '\U0001f1e9\U0001f1ea'),
|
('de-DE', 'Deutsch', 'Deutschland', 'German', '\U0001f1e9\U0001f1ea'),
|
||||||
('el-GR', 'Ελληνικά', '', 'Greek', '\U0001f1ec\U0001f1f7'),
|
('el-GR', 'Ελληνικά', '', 'Greek', '\U0001f1ec\U0001f1f7'),
|
||||||
('en', 'English', '', 'English', '\U0001f1ec\U0001f1e7'),
|
('en', 'English', '', 'English', '\U0001f310'),
|
||||||
('en-AU', 'English', 'Australia', 'English', '\U0001f1e6\U0001f1fa'),
|
('en-AU', 'English', 'Australia', 'English', '\U0001f1e6\U0001f1fa'),
|
||||||
('en-CA', 'English', 'Canada', 'English', '\U0001f1e8\U0001f1e6'),
|
('en-CA', 'English', 'Canada', 'English', '\U0001f1e8\U0001f1e6'),
|
||||||
('en-GB', 'English', 'United Kingdom', 'English', '\U0001f1ec\U0001f1e7'),
|
('en-GB', 'English', 'United Kingdom', 'English', '\U0001f1ec\U0001f1e7'),
|
||||||
|
@ -20,42 +22,49 @@ language_codes = (
|
||||||
('en-MY', 'English', 'Malaysia', 'English', '\U0001f1f2\U0001f1fe'),
|
('en-MY', 'English', 'Malaysia', 'English', '\U0001f1f2\U0001f1fe'),
|
||||||
('en-NZ', 'English', 'New Zealand', 'English', '\U0001f1f3\U0001f1ff'),
|
('en-NZ', 'English', 'New Zealand', 'English', '\U0001f1f3\U0001f1ff'),
|
||||||
('en-US', 'English', 'United States', 'English', '\U0001f1fa\U0001f1f8'),
|
('en-US', 'English', 'United States', 'English', '\U0001f1fa\U0001f1f8'),
|
||||||
('es', 'Español', '', 'Spanish', '\U0001f1ea\U0001f1f8'),
|
('es', 'Español', '', 'Spanish', '\U0001f310'),
|
||||||
('es-AR', 'Español', 'Argentina', 'Spanish', '\U0001f1e6\U0001f1f7'),
|
('es-AR', 'Español', 'Argentina', 'Spanish', '\U0001f1e6\U0001f1f7'),
|
||||||
('es-CL', 'Español', 'Chile', 'Spanish', '\U0001f1e8\U0001f1f1'),
|
('es-CL', 'Español', 'Chile', 'Spanish', '\U0001f1e8\U0001f1f1'),
|
||||||
('es-ES', 'Español', 'España', 'Spanish', '\U0001f1ea\U0001f1f8'),
|
('es-ES', 'Español', 'España', 'Spanish', '\U0001f1ea\U0001f1f8'),
|
||||||
('es-MX', 'Español', 'México', 'Spanish', '\U0001f1f2\U0001f1fd'),
|
('es-MX', 'Español', 'México', 'Spanish', '\U0001f1f2\U0001f1fd'),
|
||||||
('et-EE', 'Eesti', '', 'Estonian', '\U0001f1ea\U0001f1ea'),
|
('et-EE', 'Eesti', '', 'Estonian', '\U0001f1ea\U0001f1ea'),
|
||||||
|
('fa-IR', 'فارسی', '', 'Persian', '\U0001f1ee\U0001f1f7'),
|
||||||
('fi-FI', 'Suomi', '', 'Finnish', '\U0001f1eb\U0001f1ee'),
|
('fi-FI', 'Suomi', '', 'Finnish', '\U0001f1eb\U0001f1ee'),
|
||||||
('fr', 'Français', '', 'French', '\U0001f1eb\U0001f1f7'),
|
('fr', 'Français', '', 'French', '\U0001f310'),
|
||||||
('fr-BE', 'Français', 'Belgique', 'French', '\U0001f1e7\U0001f1ea'),
|
('fr-BE', 'Français', 'Belgique', 'French', '\U0001f1e7\U0001f1ea'),
|
||||||
('fr-CA', 'Français', 'Canada', 'French', '\U0001f1e8\U0001f1e6'),
|
('fr-CA', 'Français', 'Canada', 'French', '\U0001f1e8\U0001f1e6'),
|
||||||
('fr-CH', 'Français', 'Suisse', 'French', '\U0001f1e8\U0001f1ed'),
|
('fr-CH', 'Français', 'Suisse', 'French', '\U0001f1e8\U0001f1ed'),
|
||||||
('fr-FR', 'Français', 'France', 'French', '\U0001f1eb\U0001f1f7'),
|
('fr-FR', 'Français', 'France', 'French', '\U0001f1eb\U0001f1f7'),
|
||||||
('he-IL', 'עברית', '', 'Hebrew', '\U0001f1ee\U0001f1f1'),
|
('he-IL', 'עברית', '', 'Hebrew', '\U0001f1ee\U0001f1f1'),
|
||||||
|
('hi-IN', 'हिन्दी', '', 'Hindi', '\U0001f1ee\U0001f1f3'),
|
||||||
('hr-HR', 'Hrvatski', '', 'Croatian', '\U0001f1ed\U0001f1f7'),
|
('hr-HR', 'Hrvatski', '', 'Croatian', '\U0001f1ed\U0001f1f7'),
|
||||||
('hu-HU', 'Magyar', '', 'Hungarian', '\U0001f1ed\U0001f1fa'),
|
('hu-HU', 'Magyar', '', 'Hungarian', '\U0001f1ed\U0001f1fa'),
|
||||||
|
('id-ID', 'Indonesia', '', 'Indonesian', '\U0001f1ee\U0001f1e9'),
|
||||||
|
('is-IS', 'Íslenska', '', 'Icelandic', '\U0001f1ee\U0001f1f8'),
|
||||||
('it-IT', 'Italiano', '', 'Italian', '\U0001f1ee\U0001f1f9'),
|
('it-IT', 'Italiano', '', 'Italian', '\U0001f1ee\U0001f1f9'),
|
||||||
('ja-JP', '日本語', '', 'Japanese', '\U0001f1ef\U0001f1f5'),
|
('ja-JP', '日本語', '', 'Japanese', '\U0001f1ef\U0001f1f5'),
|
||||||
('ko-KR', '한국어', '', 'Korean', '\U0001f1f0\U0001f1f7'),
|
('ko-KR', '한국어', '', 'Korean', '\U0001f1f0\U0001f1f7'),
|
||||||
('lt-LT', 'Lietuvių', '', 'Lithuanian', '\U0001f1f1\U0001f1f9'),
|
('lt-LT', 'Lietuvių', '', 'Lithuanian', '\U0001f1f1\U0001f1f9'),
|
||||||
('lv-LV', 'Latviešu', '', 'Latvian', '\U0001f1f1\U0001f1fb'),
|
('lv-LV', 'Latviešu', '', 'Latvian', '\U0001f1f1\U0001f1fb'),
|
||||||
('nl', 'Nederlands', '', 'Dutch', '\U0001f1f3\U0001f1f1'),
|
('nl', 'Nederlands', '', 'Dutch', '\U0001f310'),
|
||||||
('nl-BE', 'Nederlands', 'België', 'Dutch', '\U0001f1e7\U0001f1ea'),
|
('nl-BE', 'Nederlands', 'België', 'Dutch', '\U0001f1e7\U0001f1ea'),
|
||||||
('nl-NL', 'Nederlands', 'Nederland', 'Dutch', '\U0001f1f3\U0001f1f1'),
|
('nl-NL', 'Nederlands', 'Nederland', 'Dutch', '\U0001f1f3\U0001f1f1'),
|
||||||
('pl-PL', 'Polski', '', 'Polish', '\U0001f1f5\U0001f1f1'),
|
('pl-PL', 'Polski', '', 'Polish', '\U0001f1f5\U0001f1f1'),
|
||||||
('pt', 'Português', '', 'Portuguese', '\U0001f1f5\U0001f1f9'),
|
('pt', 'Português', '', 'Portuguese', '\U0001f310'),
|
||||||
('pt-BR', 'Português', 'Brasil', 'Portuguese', '\U0001f1e7\U0001f1f7'),
|
('pt-BR', 'Português', 'Brasil', 'Portuguese', '\U0001f1e7\U0001f1f7'),
|
||||||
('pt-PT', 'Português', 'Portugal', 'Portuguese', '\U0001f1f5\U0001f1f9'),
|
('pt-PT', 'Português', 'Portugal', 'Portuguese', '\U0001f1f5\U0001f1f9'),
|
||||||
('ro-RO', 'Română', '', 'Romanian', '\U0001f1f7\U0001f1f4'),
|
('ro-RO', 'Română', '', 'Romanian', '\U0001f1f7\U0001f1f4'),
|
||||||
('ru-RU', 'Русский', '', 'Russian', '\U0001f1f7\U0001f1fa'),
|
('ru-RU', 'Русский', '', 'Russian', '\U0001f1f7\U0001f1fa'),
|
||||||
('sk-SK', 'Slovenčina', '', 'Slovak', '\U0001f1f8\U0001f1f0'),
|
('sk-SK', 'Slovenčina', '', 'Slovak', '\U0001f1f8\U0001f1f0'),
|
||||||
('sl-SI', 'Slovenščina', '', 'Slovenian', '\U0001f1f8\U0001f1ee'),
|
('sl-SI', 'Slovenščina', '', 'Slovenian', '\U0001f1f8\U0001f1ee'),
|
||||||
|
('sr-RS', 'Српски', '', 'Serbian', '\U0001f1f7\U0001f1f8'),
|
||||||
('sv-SE', 'Svenska', '', 'Swedish', '\U0001f1f8\U0001f1ea'),
|
('sv-SE', 'Svenska', '', 'Swedish', '\U0001f1f8\U0001f1ea'),
|
||||||
|
('sw-TZ', 'Kiswahili', '', 'Swahili', '\U0001f1f9\U0001f1ff'),
|
||||||
('th-TH', 'ไทย', '', 'Thai', '\U0001f1f9\U0001f1ed'),
|
('th-TH', 'ไทย', '', 'Thai', '\U0001f1f9\U0001f1ed'),
|
||||||
('tr-TR', 'Türkçe', '', 'Turkish', '\U0001f1f9\U0001f1f7'),
|
('tr-TR', 'Türkçe', '', 'Turkish', '\U0001f1f9\U0001f1f7'),
|
||||||
('uk-UA', 'Українська', '', 'Ukrainian', '\U0001f1fa\U0001f1e6'),
|
('uk-UA', 'Українська', '', 'Ukrainian', '\U0001f1fa\U0001f1e6'),
|
||||||
('zh', '中文', '', 'Chinese', '\U0001f1e8\U0001f1f3'),
|
('vi-VN', 'Tiếng Việt', '', 'Vietnamese', '\U0001f1fb\U0001f1f3'),
|
||||||
|
('zh', '中文', '', 'Chinese', '\U0001f310'),
|
||||||
('zh-CN', '中文', '中国', 'Chinese', '\U0001f1e8\U0001f1f3'),
|
('zh-CN', '中文', '中国', 'Chinese', '\U0001f1e8\U0001f1f3'),
|
||||||
('zh-HK', '中文', '中國香港特別行政區', 'Chinese', '\U0001f1ed\U0001f1f0'),
|
('zh-HK', '中文', '中國香港特別行政區', 'Chinese', '\U0001f1ed\U0001f1f0'),
|
||||||
('zh-TW', '中文', '台灣', 'Chinese', '\U0001f1f9\U0001f1fc'),
|
('zh-TW', '中文', '台灣', 'Chinese', '\U0001f1f9\U0001f1fc'),
|
||||||
|
|
|
@ -68,7 +68,6 @@ lang2emoji = {
|
||||||
'jp': '\U0001F1EF\U0001F1F5', # Japanese
|
'jp': '\U0001F1EF\U0001F1F5', # Japanese
|
||||||
'ua': '\U0001F1FA\U0001F1E6', # Ukrainian
|
'ua': '\U0001F1FA\U0001F1E6', # Ukrainian
|
||||||
'he': '\U0001F1EE\U0001F1F7', # Hebrew
|
'he': '\U0001F1EE\U0001F1F7', # Hebrew
|
||||||
'zh': '\U0001F1E8\U0001F1F3', # China (zh)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,11 +79,7 @@ def get_unicode_flag(lang_code):
|
||||||
return emoji
|
return emoji
|
||||||
|
|
||||||
if len(lang_code) == 2:
|
if len(lang_code) == 2:
|
||||||
l_code = lang_code.lower()
|
return '\U0001F310'
|
||||||
c_code = lang_code.upper()
|
|
||||||
if c_code == 'EN':
|
|
||||||
c_code = 'GB'
|
|
||||||
lang_code = "%s-%s" % (l_code, c_code)
|
|
||||||
|
|
||||||
language = territory = script = variant = ''
|
language = territory = script = variant = ''
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue