Disable code for updating index.html

This commit is contained in:
Isaiah Odhner 2023-04-18 02:23:03 -04:00
parent 2e4d6e9c16
commit 160beeb6ce

View File

@ -92,11 +92,11 @@ loaded_localizations("{target_lang}", {localizations_json});
with open(f"{os.path.dirname(__file__)}/{target_lang}/localizations.js", "w", encoding="utf8") as f: with open(f"{os.path.dirname(__file__)}/{target_lang}/localizations.js", "w", encoding="utf8") as f:
f.write(js) f.write(js)
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "index.html")) # file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "index.html"))
with open(file_path, "r") as f: # with open(file_path, "r") as f:
code = f.read() # code = f.read()
available_langs_json = json.dumps(available_langs).replace('","', '", "') # available_langs_json = json.dumps(available_langs).replace('","', '", "')
code = re.sub(r"(available_languages\s*=\s*)\[[^\]]*\]", f"$1{available_langs_json}]", code) # code = re.sub(r"(available_languages\s*=\s*)\[[^\]]*\]", f"$1{available_langs_json}]", code)
with open(file_path, "w") as f: # with open(file_path, "w") as f:
f.write(code) # f.write(code)
print(f'Updated available_languages list in "{file_path}"') # print(f'Updated available_languages list in "{file_path}"')