Commit 0b7f0bde authored by Ivan Skytte Jørgensen's avatar Ivan Skytte Jørgensen Committed by pofilo
Browse files

Use a more human-friendly format in searx/data/engines_languages.json (#1399)

Instead of a single line with 500000 characters use nicely formatted JSON.
Sort the lists in so when updating it is possible to
more easily see the differences (search engines do change the order their
languages are listed in)
parent 3ff67c2e
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -27,12 +27,14 @@ def fetch_supported_languages(): ...@@ -27,12 +27,14 @@ def fetch_supported_languages():
if hasattr(engines[engine_name], 'fetch_supported_languages'): if hasattr(engines[engine_name], 'fetch_supported_languages'):
try: try:
engines_languages[engine_name] = engines[engine_name].fetch_supported_languages() engines_languages[engine_name] = engines[engine_name].fetch_supported_languages()
if type(engines_languages[engine_name]) == list:
engines_languages[engine_name] = sorted(engines_languages[engine_name])
except Exception as e: except Exception as e:
print(e) print(e)
# write json file # write json file
with, "w", encoding="utf-8") as f: with, "w", encoding="utf-8") as f:
dump(engines_languages, f, ensure_ascii=False) dump(engines_languages, f, ensure_ascii=False, indent=4, separators=(',', ': '))
return engines_languages return engines_languages
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment