From 1908ea1df498592f5de57420e27308979e6e536e Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Tue, 21 Jul 2026 12:27:18 +0200 Subject: [PATCH] fix(i18n): suppress lint on generated Wear translations --- scripts/android-app-i18n.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/android-app-i18n.ts b/scripts/android-app-i18n.ts index 236f6dfd70c1..4f24a7b720ce 100644 --- a/scripts/android-app-i18n.ts +++ b/scripts/android-app-i18n.ts @@ -79,6 +79,9 @@ type ResourceString = { value: string; }; +const GENERATED_TRANSLATION_LINT_IGNORE = + 'tools:ignore="Typos,TypographyDashes,TypographyEllipsis"'; + type TranslationContradiction = { locale: string; selected: string; @@ -1114,7 +1117,7 @@ function localizeManualStrings( ? selectExactArtifactTranslation(source, inventoryEntry.id, artifactEntries) : source; return { - attrs: entry.attrs, + attrs: translatable ? `${entry.attrs} ${GENERATED_TRANSLATION_LINT_IGNORE}` : entry.attrs, key: entry.key, rawValue: `"${escapeAndroidResourceValue(value)}"`, value, @@ -1126,8 +1129,10 @@ function renderStringsXml( manual: readonly ResourceString[], generated: ReadonlyMap, ): string { + const usesToolsNamespace = + generated.size > 0 || manual.some((entry) => entry.attrs.includes("tools:")); const lines = [ - generated.size > 0 + usesToolsNamespace ? '' : "", ]; @@ -1144,7 +1149,7 @@ function renderStringsXml( // Translation-memory text intentionally preserves technical tokens and source punctuation, // so Android's English dictionary and typography suggestions do not apply to managed keys. lines.push( - ` "${renderAndroidResourceValue(entry.source, entry.value)}"`, + ` "${renderAndroidResourceValue(entry.source, entry.value)}"`, ); } }