diff options
author | Ivan Skytte Jørgensen <isj-github@privacore.com> | 2018-11-29 16:31:05 +0100 |
---|---|---|
committer | pofilo <git@pofilo.fr> | 2018-11-29 16:31:05 +0100 |
commit | 0b7f0bde62f19f54105bf34cfca82cccb6e95720 (patch) | |
tree | 88b1bef1d91dc76fff4bc0d574f71e0b6cb05e4b /utils/fetch_languages.py | |
parent | 3ff67c2e78c237c74c8691b82d28ce01445727c3 (diff) | |
download | searxng-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.py | 4 |
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 |