Skip to content

Conversation

@swolfand
Copy link
Collaborator

Summary of changes

This pull request introduces locale awareness to the Clerk API, enabling the system to detect and propagate the user's locale throughout authentication flows. The changes add a new LocaleProvider singleton, expose the current locale as a StateFlow in the main API, and ensure that sign-up requests include the locale information. Additionally, the changes refactor usage of the debugMode flag for consistency and remove unused cleanup logic from ConfigurationManager.

Locale support and propagation:

  • Added a new LocaleProvider singleton (source/api/src/main/kotlin/com/clerk/api/locale/LocaleProvider.kt) to detect, store, and expose the device's locale as a BCP 47 language tag via a StateFlow. Includes initialization, refresh, and cleanup methods.
  • Exposed the current locale as a public StateFlow<String?> property locale in the Clerk object, allowing other components to access and react to locale changes.
  • Initialized LocaleProvider during Clerk configuration setup to ensure locale is available early in the app lifecycle.
  • Updated sign-up creation logic to include the current locale in the parameters sent to the backend, ensuring user-facing flows are locale-aware.

Codebase cleanup and consistency:

  • Refactored usage of the debugMode flag in ConfigurationManager to consistently reference Clerk.debugMode instead of a local variable, improving clarity and maintainability. [1] [2] [3] [4] [5]
  • Removed the unused cleanup() method and related state management from ConfigurationManager to simplify resource handling.

These changes lay the groundwork for robust localization support in Clerk's authentication flows and improve code consistency.

@swolfand swolfand merged commit 8a5d213 into main Oct 15, 2025
5 checks passed
@swolfand swolfand deleted the sam/mobile-276-android-send-user-locale-in-sign-up-request-for-localized branch October 15, 2025 21:19
swolfand added a commit that referenced this pull request Oct 16, 2025
* Create LocaleProvider.kt

* add to ConfigurationManager.kt

* Add to signup.create

* update some kdoc
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