From 602bc1caccf99f075a4072e98560599da4ca96ad Mon Sep 17 00:00:00 2001 From: Y_RyuZU Date: Mon, 30 Oct 2023 01:20:32 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20tmp=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=8C2=E4=BB=A5=E4=B8=8A=E3=81=AE=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E3=81=AB=E7=BF=BB=E8=A8=B3=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=81=AA=E3=81=84=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.py b/src/main.py index cecd69c..47391cf 100644 --- a/src/main.py +++ b/src/main.py @@ -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):