Merge pull request #672 from searxng/update_data_update_languages.py

Update searx.data - update_languages.py
This commit is contained in:
Markus Heiser 2022-01-01 18:44:53 +01:00 committed by GitHub
commit c2e4b95e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 331 additions and 867 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,21 +19,14 @@ language_codes = (
('en-CA', 'English', 'Canada', 'English'), ('en-CA', 'English', 'Canada', 'English'),
('en-GB', 'English', 'United Kingdom', 'English'), ('en-GB', 'English', 'United Kingdom', 'English'),
('en-IE', 'English', 'Ireland', 'English'), ('en-IE', 'English', 'Ireland', 'English'),
('en-IN', 'English', 'India', 'English'),
('en-MY', 'English', 'Malaysia', 'English'), ('en-MY', 'English', 'Malaysia', 'English'),
('en-NZ', 'English', 'New Zealand', 'English'), ('en-NZ', 'English', 'New Zealand', 'English'),
('en-PH', 'English', 'Philippines', 'English'),
('en-SG', 'English', 'Singapore', 'English'),
('en-US', 'English', 'United States', 'English'), ('en-US', 'English', 'United States', 'English'),
('en-ZA', 'English', 'South Africa', 'English'),
('es', 'Español', '', 'Spanish'), ('es', 'Español', '', 'Spanish'),
('es-AR', 'Español', 'Argentina', 'Spanish'), ('es-AR', 'Español', 'Argentina', 'Spanish'),
('es-CL', 'Español', 'Chile', 'Spanish'), ('es-CL', 'Español', 'Chile', 'Spanish'),
('es-CO', 'Español', 'Colombia', 'Spanish'),
('es-ES', 'Español', 'España', 'Spanish'), ('es-ES', 'Español', 'España', 'Spanish'),
('es-MX', 'Español', 'México', 'Spanish'), ('es-MX', 'Español', 'México', 'Spanish'),
('es-PE', 'Español', 'Perú', 'Spanish'),
('es-US', 'Español', 'Estados Unidos', 'Spanish'),
('et-EE', 'Eesti', '', 'Estonian'), ('et-EE', 'Eesti', '', 'Estonian'),
('fa-IR', 'فارسی', '', 'Persian'), ('fa-IR', 'فارسی', '', 'Persian'),
('fi-FI', 'Suomi', '', 'Finnish'), ('fi-FI', 'Suomi', '', 'Finnish'),
@ -43,6 +36,7 @@ language_codes = (
('fr-CH', 'Français', 'Suisse', 'French'), ('fr-CH', 'Français', 'Suisse', 'French'),
('fr-FR', 'Français', 'France', 'French'), ('fr-FR', 'Français', 'France', 'French'),
('he-IL', 'עברית', '', 'Hebrew'), ('he-IL', 'עברית', '', 'Hebrew'),
('hi-IN', 'हिन्दी', '', 'Hindi'),
('hr-HR', 'Hrvatski', '', 'Croatian'), ('hr-HR', 'Hrvatski', '', 'Croatian'),
('hu-HU', 'Magyar', '', 'Hungarian'), ('hu-HU', 'Magyar', '', 'Hungarian'),
('id-ID', 'Indonesia', '', 'Indonesian'), ('id-ID', 'Indonesia', '', 'Indonesian'),
@ -52,7 +46,6 @@ language_codes = (
('ko-KR', '한국어', '', 'Korean'), ('ko-KR', '한국어', '', 'Korean'),
('lt-LT', 'Lietuvių', '', 'Lithuanian'), ('lt-LT', 'Lietuvių', '', 'Lithuanian'),
('lv-LV', 'Latviešu', '', 'Latvian'), ('lv-LV', 'Latviešu', '', 'Latvian'),
('nb-NO', 'Norsk Bokmål', '', 'Norwegian Bokmål'),
('nl', 'Nederlands', '', 'Dutch'), ('nl', 'Nederlands', '', 'Dutch'),
('nl-BE', 'Nederlands', 'België', 'Dutch'), ('nl-BE', 'Nederlands', 'België', 'Dutch'),
('nl-NL', 'Nederlands', 'Nederland', 'Dutch'), ('nl-NL', 'Nederlands', 'Nederland', 'Dutch'),

View File

@ -189,7 +189,7 @@ def write_languages_file(languages):
"# -*- coding: utf-8 -*-", "# -*- coding: utf-8 -*-",
"# 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 = (\n",
) )
language_codes = [] language_codes = []
@ -212,8 +212,11 @@ def write_languages_file(languages):
language_codes = tuple(language_codes) language_codes = tuple(language_codes)
with open(languages_file, 'w') as new_file: with open(languages_file, 'w') as new_file:
file_content = "{file_headers} \\\n{language_codes}".format( file_content = "{file_headers} {language_codes},\n)\n".format(
file_headers='\n'.join(file_headers), language_codes=pformat(language_codes, indent=4) # fmt: off
file_headers = '\n'.join(file_headers),
language_codes = pformat(language_codes, indent=4)[1:-1]
# fmt: on
) )
new_file.write(file_content) new_file.write(file_content)
new_file.close() new_file.close()