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 c35c69c commit 602bc1c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,11 @@ def translate_batch_deepl(file_path, translated_map=None):

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

if len(result_keys) == len(result_values):
for before, after in zip(result_keys, result_values):
for key, value in translated_map.items():
result_map[key] = after
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):
Expand Down

0 comments on commit 602bc1c

Please sign in to comment.