Add locale to sign up #293
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
LocaleProvidersingleton, expose the current locale as aStateFlowin the main API, and ensure that sign-up requests include the locale information. Additionally, the changes refactor usage of thedebugModeflag for consistency and remove unused cleanup logic fromConfigurationManager.Locale support and propagation:
LocaleProvidersingleton (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 aStateFlow. Includes initialization, refresh, and cleanup methods.StateFlow<String?>propertylocalein theClerkobject, allowing other components to access and react to locale changes.LocaleProviderduring Clerk configuration setup to ensure locale is available early in the app lifecycle.Codebase cleanup and consistency:
debugModeflag inConfigurationManagerto consistently referenceClerk.debugModeinstead of a local variable, improving clarity and maintainability. [1] [2] [3] [4] [5]cleanup()method and related state management fromConfigurationManagerto simplify resource handling.These changes lay the groundwork for robust localization support in Clerk's authentication flows and improve code consistency.