From 6ffc18791a2a02b4d5829ac4061785b8b8118f8a Mon Sep 17 00:00:00 2001 From: Andrew Fenton Date: Fri, 15 Nov 2024 18:53:33 -0500 Subject: [PATCH] dump all newly computed hashes instead of only pushing updates to metadata --- .../src/internationalize/diffing_processor.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/i18nilize/src/internationalize/diffing_processor.py b/i18nilize/src/internationalize/diffing_processor.py index 5ac8785..09f3697 100644 --- a/i18nilize/src/internationalize/diffing_processor.py +++ b/i18nilize/src/internationalize/diffing_processor.py @@ -52,14 +52,6 @@ def update_to_current_state(self, changed_files_list, hash_dict): self.sync_translations() def update_metadata(self, changed_files_list, hash_dict): - metadata = {} - with open(self.metadata_file_dir) as file: - metadata = json.load(file) - - for file_name in changed_files_list: - file_name_no_ext = file_name.split(".")[0] - metadata[file_name_no_ext] = hash_dict[file_name_no_ext] - with open(self.metadata_file_dir, "w") as outfile: json.dump(hash_dict, outfile) @@ -129,8 +121,8 @@ def get_changed_translations(self): Gets differences between old and new translations for one language """ def compare_language(self, file_name, changed_translations): - original_language_location = self.diff_state_files_dir + "\\" + file_name - current_language_location = self.curr_translation_files_dir + "\\" + file_name + original_language_location = os.path.join(self.diff_state_files_dir, file_name) + current_language_location = os.path.join(self.curr_translation_files_dir, file_name) original_language = read_json_file(original_language_location) current_language = read_json_file(current_language_location) @@ -150,7 +142,7 @@ def compare_language(self, file_name, changed_translations): return changed_translations def add_language(self, file_name, changed_translations): - current_language_location = self.curr_translation_files_dir + "\\" + file_name + current_language_location = os.path.join(self.curr_translation_files_dir, file_name) current_language = read_json_file(current_language_location) for word, translation in current_language.items():