summaryrefslogtreecommitdiff
path: root/utils/fetch_languages.py
diff options
context:
space:
mode:
authorIvan Skytte Jørgensen <isj-github@privacore.com>2018-11-29 16:31:05 +0100
committerpofilo <git@pofilo.fr>2018-11-29 16:31:05 +0100
commit0b7f0bde62f19f54105bf34cfca82cccb6e95720 (patch)
tree88b1bef1d91dc76fff4bc0d574f71e0b6cb05e4b /utils/fetch_languages.py
parent3ff67c2e78c237c74c8691b82d28ce01445727c3 (diff)
downloadsearxng-0b7f0bde62f19f54105bf34cfca82cccb6e95720.tar.gz
searxng-0b7f0bde62f19f54105bf34cfca82cccb6e95720.zip
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 engine_languages.py so when updating it is possible to more easily see the differences (search engines do change the order their languages are listed in)
Diffstat (limited to 'utils/fetch_languages.py')
-rw-r--r--utils/fetch_languages.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/fetch_languages.py b/utils/fetch_languages.py
index dd7aa659f..a6af07303 100644
--- a/utils/fetch_languages.py
+++ b/utils/fetch_languages.py
@@ -27,12 +27,14 @@ def fetch_supported_languages():
if hasattr(engines[engine_name], 'fetch_supported_languages'):
try:
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:
print(e)
# write json file
with io.open(engines_languages_file, "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