From a5b14815f3f305a5533b583c29d207eba07d0465 Mon Sep 17 00:00:00 2001 From: wailovet Date: Tue, 30 Apr 2024 14:26:48 +0800 Subject: [PATCH] 'update' --- mz_gen_translate.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mz_gen_translate.py b/mz_gen_translate.py index baec806..a1c8984 100644 --- a/mz_gen_translate.py +++ b/mz_gen_translate.py @@ -28,9 +28,15 @@ ZH_Replace_Map = { def gen_translate(NODE_DISPLAY_NAME_MAPPINGS={}, NODE_CLASS_MAPPINGS={}): - translation_dir = os.path.join(COMFY_PATH, "custom_nodes", - "AIGODLIKE-COMFYUI-TRANSLATION", "zh-CN", "Nodes") - + translation_dirs = [ + os.path.join(COMFY_PATH, "custom_nodes", "AIGODLIKE-COMFYUI-TRANSLATION", "zh-CN", "Nodes"), + os.path.join(COMFY_PATH, "custom_nodes", "AIGODLIKE-ComfyUI-Translation", "zh-CN", "Nodes"), + ] + translation_dir = translation_dirs[0] + for dir in translation_dirs: + if os.path.exists(dir): + translation_dir = dir + break translation_config = os.path.join( translation_dir, "ComfyUI_MinusZone.translate.json") if os.path.exists(translation_dir): @@ -88,4 +94,4 @@ def gen_translate(NODE_DISPLAY_NAME_MAPPINGS={}, NODE_CLASS_MAPPINGS={}): f.write(json.dumps(nodes, indent=4, ensure_ascii=False)) else: - print("No translation dir found.") + print("No translation dir found!")