diff --git a/scripts/gp/bake_note_keys.py b/scripts/gp/bake_note_keys.py index 2b99b67de3..d9b6cad259 100644 --- a/scripts/gp/bake_note_keys.py +++ b/scripts/gp/bake_note_keys.py @@ -44,7 +44,7 @@ def _note_hash(description: str) -> str: return hashlib.sha256(description.encode()).hexdigest()[:8] -def _bake_file(path: Path, dry_run: bool) -> int: +def _bake_file(path: Path, *, dry_run: bool) -> int: """Bake i18n_keys into a single template JSON file. Returns number of keys added/updated.""" with path.open(encoding="utf-8") as f: data = json.load(f) diff --git a/scripts/gp/extract_backend_strings.py b/scripts/gp/extract_backend_strings.py index 0db4e866bc..67a32e145d 100644 --- a/scripts/gp/extract_backend_strings.py +++ b/scripts/gp/extract_backend_strings.py @@ -135,7 +135,7 @@ def collect_strings() -> dict[str, str]: try: with project_file.open(encoding="utf-8") as f: project = json.load(f) - except Exception: # noqa: BLE001 + except Exception: # noqa: BLE001, S112 continue name = project.get("name") description = project.get("description", "") @@ -155,7 +155,7 @@ def collect_strings() -> dict[str, str]: try: with project_file.open(encoding="utf-8") as f: project = json.load(f) - except Exception: # noqa: BLE001 + except Exception: # noqa: BLE001, S112 continue nodes = project.get("data", {}).get("nodes", []) for node in nodes: diff --git a/src/backend/base/langflow/utils/i18n.py b/src/backend/base/langflow/utils/i18n.py index 0b1133f967..09c2c0889a 100644 --- a/src/backend/base/langflow/utils/i18n.py +++ b/src/backend/base/langflow/utils/i18n.py @@ -131,9 +131,11 @@ def translate_flow_notes(nodes: list[dict], locale: str) -> list[dict]: if node.get("type") == "noteNode": i18n_key = node.get("data", {}).get("node", {}).get("i18n_key") if i18n_key: - node = copy.deepcopy(node) - description = node["data"]["node"].get("description", "") - node["data"]["node"]["description"] = translate(i18n_key, locale, description) + translated_node = copy.deepcopy(node) + description = translated_node["data"]["node"].get("description", "") + translated_node["data"]["node"]["description"] = translate(i18n_key, locale, description) + result.append(translated_node) + continue result.append(node) return result