From 89cb4bbb8cbcf1e6df5f705da892b84836d956ef Mon Sep 17 00:00:00 2001 From: zenobit Date: Wed, 1 Apr 2026 00:28:18 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- package.json | 1 + scripts/i18n/generate-qa-checklist.mjs | 6 +++--- scripts/validate_translation.py | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3a2bf902ea..1c3524a9ac 100644 --- a/package.json +++ b/package.json @@ -115,6 +115,7 @@ "uuid": "^13.0.0", "wreq-js": "^2.0.1", "yazl": "^3.3.1", + "js-yaml": "^4.1.0", "zod": "^4.3.6", "zustand": "^5.0.10" }, diff --git a/scripts/i18n/generate-qa-checklist.mjs b/scripts/i18n/generate-qa-checklist.mjs index 1d6cdaef25..749e1b2f76 100644 --- a/scripts/i18n/generate-qa-checklist.mjs +++ b/scripts/i18n/generate-qa-checklist.mjs @@ -209,9 +209,9 @@ async function runAutomatedChecks() { let anchorLineRemoved = true; let brAppendixRemoved = true; - // Check RTL languages (ar, ja) for legacy content - const rtlLanguages = ["ar", "ja"]; - for (const code of rtlLanguages) { + // Check specific languages (ar, ja) for legacy content + const legacyCheckLocales = ["ar", "ja"]; + for (const code of legacyCheckLocales) { const readmePath = path.join(I18N_README_DIR, code, "README.md"); try { const content = await fs.readFile(readmePath, "utf8"); diff --git a/scripts/validate_translation.py b/scripts/validate_translation.py index 985127a78d..a5920eeb0c 100755 --- a/scripts/validate_translation.py +++ b/scripts/validate_translation.py @@ -263,9 +263,11 @@ def find_placeholder_issues(source: Dict, trans: Dict) -> List[Tuple[str, str, s # Only extract top-level placeholders: {name}, {count}, {day}, NOT {# X} inside ICU import re - # Match {name} but NOT {# inside ICU plural - source_placeholders = set(re.findall(r'\{[a-zA-Z][^}]*\}', source_val)) - trans_placeholders = set(re.findall(r'\{[a-zA-Z][^}]*\}', trans_val)) + # Extract variable names from placeholders (e.g., 'name' from '{name}' or 'count' from '{count, plural, ...}') + # This avoids false positives on ICU strings where the internal text is translated. + placeholder_regex = r'\{\s*([a-zA-Z][a-zA-Z0-9_]*)' + source_placeholders = set(re.findall(placeholder_regex, source_val)) + trans_placeholders = set(re.findall(placeholder_regex, trans_val)) # Check for missing placeholders missing = source_placeholders - trans_placeholders