Skip to content

fix(auth): replace hardcoded loading state strings with translatable string resources#2339

Merged
demolaf merged 5 commits into
version-10.0.0-beta03from
feat/add-localized-strings-states
Jun 26, 2026
Merged

fix(auth): replace hardcoded loading state strings with translatable string resources#2339
demolaf merged 5 commits into
version-10.0.0-beta03from
feat/add-localized-strings-states

Conversation

@demolaf

@demolaf demolaf commented Jun 24, 2026

Copy link
Copy Markdown
Member

Closes #2338 .

All AuthState.Loading messages emitted during auth operations (sign-in, sign-out, delete, phone, email, etc.) were hardcoded English strings. This replaces every instance with a string resource lookup via Context.getString(R.string.fui_loading_*), making them overridable and translatable.

Usage

You can either override using strings.xml or through a custom AuthUIStringProvider, see below examples:

Using strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="fui_loading_signing_in_anonymously" translatable="false">some random string here</string>
    <string name="fui_loading_deleting_account" translatable="false">some random string here</string>
</resources>

Using AuthUIStringProvider:

class CustomAuthUIStringProvider(
    private val defaultProvider: AuthUIStringProvider
) : AuthUIStringProvider by defaultProvider {
    override val loadingSigningInAnonymously: String
        get() = "Overriding signing in anonymously loading message..."
}

val customStringProvider = CustomAuthUIStringProvider(DefaultAuthUIStringProvider(applicationContext))

val configuration = authUIConfiguration {
    // ... (existing params)
    stringProvider = customStringProvider
}

Preview

override-loading-state-preview.webm

@demolaf demolaf force-pushed the feat/add-localized-strings-states branch from f517f53 to b6694cb Compare June 24, 2026 15:27
@firebase firebase deleted a comment from gemini-code-assist Bot Jun 24, 2026
@demolaf

demolaf commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@demolaf demolaf changed the title Feat/add localized strings for states fix(auth): replace hardcoded loading state strings with translatable string resources Jun 24, 2026

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

Copy link
Copy Markdown

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 replaces hardcoded English loading messages with localized string resources across various authentication providers and operations (such as signing in, signing out, and deleting accounts). It also introduces new loading state properties to AuthUIStringProvider and its default implementation, along with corresponding unit tests. The review feedback suggests utilizing the custom stringProvider from the available config object instead of directly calling context.getString(...) or app.applicationContext.getString(...) in several provider helper files, ensuring that any user-supplied custom string provider is properly respected.

@mikehardy mikehardy 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.

implementation looks really sound
my comments are informational as I don't know how strongly google style guide applies here and how deep the testing contract is - certainly the tests prove the general paths as is

Comment thread auth/src/main/res/values/strings.xml Outdated
<string name="fui_mfa_label_totp_authentication" translation_description="Label for the authenticator app MFA factor.">Authenticator app</string>
<string name="fui_mfa_label_unknown_method" translation_description="Label for an unknown MFA factor.">Unknown method</string>
<string name="fui_mfa_enrolled_on" translation_description="Label indicating the enrollment date of an MFA factor.">Enrolled on %1$s</string>
<string name="fui_enter_totp_code" translation_description="Prompt asking the user to enter a TOTP verification code">Enter TOTP code</string>

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.

similarly, the style guide has opinions on abbreviations. This one is likely a grey area. Is TOTP familiar to the audience? To us yes, but to mass consumers...possibly not? This abbreviation my be better as something like "Enter one time code" or something?

https://developers.google.com/style/abbreviations#spelling-out

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

hmmm that's a valid point

Comment thread auth/src/test/java/com/firebase/ui/auth/FirebaseAuthUITest.kt
@demolaf demolaf merged commit 7b2e5bd into version-10.0.0-beta03 Jun 26, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in studio-2394994192-60a69 Jun 26, 2026
demolaf added a commit that referenced this pull request Jun 29, 2026
…string resources (#2339)

* feat(auth): add localized loading messages for various sign-in states

* updates

* feat(auth): update sign-in methods to use AuthUIConfiguration for localized messages

* refactor: use periods to represent ellipsis not the unicode character

* refactor: use qualifiers, not base values in tests
demolaf added a commit that referenced this pull request Jul 1, 2026
…string resources (#2339)

* feat(auth): add localized loading messages for various sign-in states

* updates

* feat(auth): update sign-in methods to use AuthUIConfiguration for localized messages

* refactor: use periods to represent ellipsis not the unicode character

* refactor: use qualifiers, not base values in tests
demolaf added a commit that referenced this pull request Jul 1, 2026
…string resources (#2339)

* feat(auth): add localized loading messages for various sign-in states

* updates

* feat(auth): update sign-in methods to use AuthUIConfiguration for localized messages

* refactor: use periods to represent ellipsis not the unicode character

* refactor: use qualifiers, not base values in tests
demolaf added a commit that referenced this pull request Jul 2, 2026
…string resources (#2339)

* feat(auth): add localized loading messages for various sign-in states

* updates

* feat(auth): update sign-in methods to use AuthUIConfiguration for localized messages

* refactor: use periods to represent ellipsis not the unicode character

* refactor: use qualifiers, not base values in tests
demolaf added a commit to demolaf/FirebaseUI-Android that referenced this pull request Jul 2, 2026
…string resources (firebase#2339)

* feat(auth): add localized loading messages for various sign-in states

* updates

* feat(auth): update sign-in methods to use AuthUIConfiguration for localized messages

* refactor: use periods to represent ellipsis not the unicode character

* refactor: use qualifiers, not base values in tests
demolaf added a commit that referenced this pull request Jul 2, 2026
…ng (#2354)

* fix(auth): improve user identifier retrieval (#2314)

* fix(auth): improve user identifier retrieval

* updates

* fix: ensure that when selecting phone or email, it routes straight to that screen (#2311)

* fix: use secondary app if it is passed into FirebaseAuthUI (#2313)

* fix(auth): make AuthException messages customisable via AuthUIStringProvider (#2320)

* fix(auth): preserve linkDomain in email link ActionCodeSettings (#2321)

* fix(auth): log out before Facebook sign-in to clear stale cached token (#2322)

Co-authored-by: russellwheatley <russellwheatley85@gmail.com>

* Fix typo in README (#2325)

* fix(auth): emit AuthResult on sign-in success and fix MFA tooltip auto-open (#2326)

* fix(auth): update AuthState to reflect success or idle based on user result

* updates

* updates

* refactor: rename auth user state handler

* fix(auth): expose slot parameters through FirebaseAuthScreen (#2328)

* fix(auth): add configurable params for custom UI

- AuthMethodPicker
- EmailAuth
- PhoneAuth
- MFA Enrollment & Challenge

* fix(auth): add demo activities for email and phone authentication with customizable UI

* updates

* updates

* feat(auth): add customMethodPickerTermsContent slot to FirebaseAuthScreen (#2330)

* feat(auth): add termsContent slot to AuthMethodPicker for custom ToS UI

* feat(auth): add termsAccepted parameter to AuthMethodPicker for consent handling

* update example

* updates

* updates

* updates

* feat(auth): add isCredentialLinkingEnabled for authenticated users (#2319)

* feat(auth): add isCredentialLinkingEnabled for authenticated non-anonymous users

* t feat(app): add CredentialLinkingDemoActivity to sample app

# Conflicts:
#	app/src/main/AndroidManifest.xml

* updates

* feat(auth): surface GIdP password policy violations with actionable error messages (#2333)

* feat(auth): handle GIdP password policy violations with specific error messages

* updates

* updates

* cleanup

* fix(auth): allow SAML providers in AuthUIConfiguration (#2331)

* fix(auth): allow saml. prefixed provider IDs in AuthUIConfiguration validation

* updates

* feat(auth): add reauthentication flow with automatic operation retry (#2332)

* wip

# Conflicts:
#	auth/src/main/java/com/firebase/ui/auth/configuration/auth_provider/EmailAuthProvider+FirebaseAuthUI.kt
#	auth/src/main/java/com/firebase/ui/auth/ui/screens/FirebaseAuthScreen.kt

* feat(auth): add reauthentication flow with automatic operation retry

Adds AuthState.ReauthenticationRequired, withReauth(), and createReauthFlow()
to support sensitive operations that require recent sign-in. FirebaseAuthUI.delete()
and withReauth() automatically catch FirebaseAuthRecentLoginRequiredException,
emit the new state carrying the original operation as retryOperation, and
FirebaseAuthScreen presents a ModalBottomSheet overlay scoped to the user's
linked providers — no navigation away from the authenticated screen. On successful
reauthentication the original operation is retried automatically.

* test(auth): add e2e tests for reauthentication flow UI

* updates

* fix reviews

* update README

* feat(auth): implement `legacyFetchSignInWithEmail` configuration option (#2316)

* feat(auth): implement legacyFetchSignInWithEmail configuration option

* test: write tests for legacyFetchSignInWithEmail

* fix(pr): address reviewer feedback on email recovery routing

* refactor(pr): address reviewer feedback on legacy email recovery

* fix: cancellation callback + test

* chore: ignore kotlin cache

* chore: run demo app script from command line

---------

Co-authored-by: demolaf <demolafadumo@gmail.com>

* fix(auth): replace hardcoded loading state strings with translatable string resources (#2339)

* feat(auth): add localized loading messages for various sign-in states

* updates

* feat(auth): update sign-in methods to use AuthUIConfiguration for localized messages

* refactor: use periods to represent ellipsis not the unicode character

* refactor: use qualifiers, not base values in tests

* fix(auth): remember authStateFlow() to avoid resubscribing on every recomposition

* fix(auth): remember authStateFlow() in EmailAuthScreen to avoid resubscribing

* docs(auth): note FirebaseAuthUI.create() instability inside composables

---------

Co-authored-by: Russell Wheatley <russellwheatley85@gmail.com>
Co-authored-by: Nillan Sivarasa <nillan.sivarasa@gmail.com>
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.

2 participants