From ced64a9634946c5f116c14ec9bb75b94a439b746 Mon Sep 17 00:00:00 2001 From: Zebsi235 Date: Sun, 30 Aug 2026 13:56:39 +0200 Subject: [PATCH] tooling: i18n_audit keys its baselines on OS-native paths, so it fails on a clean tree on Windows Same disease doc_comment_lint had (#1691), six sites: four str(path.relative_to(ROOT)) and two f-strings interpolating the bare path. The baselines store forward slashes, so on Windows every lookup missed - all 236 tracked Android literals and all 63 iOS ones reported as NEW, and every ratcheting locale allowance read as 0 with its baseline entries flagged STALE. as_posix() at each site; a no-op on POSIX where relative_to already yields forward slashes. --- Tools/i18n_audit.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tools/i18n_audit.py b/Tools/i18n_audit.py index 85a2fe94e9..1efce7e058 100644 --- a/Tools/i18n_audit.py +++ b/Tools/i18n_audit.py @@ -435,7 +435,7 @@ def record(span_start: int, span_end: int) -> None: continue seen.add(offset) line_no = text.count("\n", 0, offset) + 1 - findings.append((str(path.relative_to(ROOT)), line_no, literal)) + findings.append((path.relative_to(ROOT).as_posix(), line_no, literal)) # The call's own first (content) argument only — catches # `Text(if (x) "a" else "b")` — never the whole call span, which @@ -856,7 +856,7 @@ def scan_ios() -> tuple[list[tuple[str, int, str]], dict[str, list[str]]]: continue entry = swift_catalog_lookup(cat, literal) line_no = text.count("\n", 0, offset) + 1 - rel = str(path.relative_to(ROOT)) + rel = path.relative_to(ROOT).as_posix() if entry is None: hardcoded.append((rel, line_no, literal)) continue @@ -864,7 +864,7 @@ def scan_ios() -> tuple[list[tuple[str, int, str]], dict[str, list[str]]]: continue for lang in LANGS: if not _is_translated(entry, lang): - lang_gaps[lang].append(f"{catalog_path.relative_to(ROOT)} :: {literal!r}") + lang_gaps[lang].append(f"{catalog_path.relative_to(ROOT).as_posix()} :: {literal!r}") for lang in lang_gaps: lang_gaps[lang] = sorted(set(lang_gaps[lang])) return hardcoded, lang_gaps @@ -948,7 +948,7 @@ def _ios_echoed_counts() -> dict[str, int]: cat = json.loads(catalog_path.read_text(encoding="utf-8")) except (OSError, json.JSONDecodeError): continue - rel = str(catalog_path.relative_to(ROOT)) + rel = catalog_path.relative_to(ROOT).as_posix() for key, entry in (cat.get("strings") or {}).items(): if not _has_translatable_words(key): continue @@ -984,7 +984,7 @@ def _android_echoed_counts() -> dict[str, int]: loc = {n.attrib["name"]: (n.text or "") for n in ET.parse(path).getroot().findall("string")} except ET.ParseError: continue - rel = str(path.relative_to(ROOT)) + rel = path.relative_to(ROOT).as_posix() n = sum(1 for k, base_val in translatable.items() if loc.get(k) == base_val) if n: counts[f"{rel} {lang}"] = n @@ -1126,7 +1126,7 @@ def ci_check(base_ref: str) -> int: # and gate them below. Reloading each catalog for a second pass wasted a full re-parse of a # 3255-string file. for extra in sorted(shipped_apple_langs(cat) - set(LANGS)): - extra_apple_gaps[f"{catalog_path.relative_to(ROOT)}:{extra}"] = sum( + extra_apple_gaps[f"{catalog_path.relative_to(ROOT).as_posix()}:{extra}"] = sum( 1 for v in cat.get("strings", {}).values() if v.get("shouldTranslate") is not False and not _is_translated(v, extra) )