From cffdce209786d4ddc0e0e2b9bfd9dcb90aa88614 Mon Sep 17 00:00:00 2001 From: Ftps <63702646+Tps-F@users.noreply.github.com> Date: Mon, 28 Aug 2023 23:58:20 +0900 Subject: [PATCH] fix locale_diff.py --- i18n/locale_diff.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/i18n/locale_diff.py b/i18n/locale_diff.py index 479f22f..2cb2ec5 100644 --- a/i18n/locale_diff.py +++ b/i18n/locale_diff.py @@ -3,10 +3,10 @@ import os from collections import OrderedDict # Define the standard file name -standard_file = "zh_CN.json" +standard_file = "i18n/locale/zh_CN.json" # Find all JSON files in the directory -dir_path = "i18n/locale" +dir_path = "i18n/locale/" languages = [ f for f in os.listdir(dir_path) if f.endswith(".json") and f != standard_file ] @@ -18,7 +18,7 @@ with open(standard_file, "r", encoding="utf-8") as f: # Loop through each language file for lang_file in languages: # Load the language file - with open(lang_file, "r", encoding="utf-8") as f: + with open(dir_path + lang_file, "r", encoding="utf-8") as f: lang_data = json.load(f, object_pairs_hook=OrderedDict) # Find the difference between the language file and the standard file @@ -40,6 +40,6 @@ for lang_file in languages: ) # Save the updated language file - with open(lang_file, "w", encoding="utf-8") as f: + with open(dir_path + lang_file, "w", encoding="utf-8") as f: json.dump(lang_data, f, ensure_ascii=False, indent=4, sort_keys=True) f.write("\n")