Skip to content

Commit

Permalink
fix: tmpファイルが2以上の場合正常に翻訳できない問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-RyuZU committed Oct 29, 2023
1 parent 602bc1c commit 084dfc3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,16 @@ def translate_batch_deepl(file_path, translated_map=None):

logging.info(f"key: {len(part_keys)}, value: {len(part_values)}")

logging.info(f"result_keys: {len(result_keys)}, result_values: {len(result_values)}")
if len(result_keys) == len(result_values) and len(result_keys) == len(translated_map):
keys_list = list(translated_map.keys())
for idx, (before, after) in enumerate(zip(result_keys, result_values)):
key = keys_list[idx]
result_map[key] = after
else:
logging.info("the number of keys and values does not match.")
for before, after in zip(result_keys, result_values):
for key, value in translated_map.items():
for key, value in translated_map.items():
for before, after in zip(result_keys, result_values):
if value == before:
result_map[key] = after

Expand Down

0 comments on commit 084dfc3

Please sign in to comment.