Skip to content

feat(lint): flag localized strings that still hold the base English text - #2520

Open
demolaf wants to merge 3 commits into
pre-GAfrom
feat/untranslated-resource-lint
Open

demolaf wants to merge 3 commits into
pre-GAfrom
feat/untranslated-resource-lint

Conversation

@demolaf

@demolaf demolaf commented Sep 21, 2026

Copy link
Copy Markdown
Member

Adds an UntranslatedResource lint check, so a string that is present in a locale but still holds the base English text now fails the build. MissingTranslation only fires on absent strings, so this defect class was never reportable.

Changes

  • UntranslatedResourceDetector compares each locale string to its base value, skipping English regional folders, translatable="false" and values with no translatable words.
  • Four brand names are exempted in the detector and the 11 genuine cognates carry tools:ignore. Against pre-GA before fix(auth): localize user-facing auth errors by Firebase error code #2509 the check found 258 strings; it finds none now.
  • Wires lintChecks into :auth, which does not propagate over debugImplementation, so no custom check had ever run there, NonGlobalIdInLayout included.
  • Fixes :internal:lint's own suite, which never compiled: JUnit was missing and the SDK lookup only resolved on Windows. Adds UntranslatedResourceDetectorTest.
  • Corrects fui_idp_name_facebook, which has read Fecebook in values-fil and values-tl since the original translation import (Translations for auth #771), while the same files spell it correctly two lines below.

Why fui_mfa_method_sms is exempted too

It is genuinely translated in some locales, so the exemption silences about 70 real hits. It is unreferenced dead copy, and the entry is marked to be dropped rather than kept when that string goes.


Maintainer note: Fixes internal CPRN-444

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a custom Android Lint detector, UntranslatedResourceDetector, designed to flag localized strings that are identical to their base English counterparts. It integrates this detector into the auth module, updates several locale files with tools:ignore attributes for valid identical terms, and adds a helper to locate the Android SDK during tests. Feedback on the tests suggests escaping the backslash in \u00A0 within Kotlin triple-quoted strings to ensure the UNICODE_ESCAPE regex is tested against a literal string rather than a compiler-evaluated Unicode character.

@demolaf
demolaf force-pushed the feat/untranslated-resource-lint branch from f63cda2 to d5a3f11 Compare September 21, 2026 11:33
@demolaf
demolaf force-pushed the auth/localize-error-codes branch from b8b5531 to eca7cb4 Compare September 21, 2026 12:04
@demolaf
demolaf force-pushed the feat/untranslated-resource-lint branch from d5a3f11 to b2519bf Compare September 21, 2026 12:20
@demolaf
demolaf changed the base branch from auth/localize-error-codes to pre-GA September 21, 2026 12:31
@demolaf
demolaf force-pushed the feat/untranslated-resource-lint branch from b2519bf to 2447342 Compare September 21, 2026 12:52
@demolaf
demolaf marked this pull request as ready for review September 21, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant