Skip to main content

Interface.UsePreferredLocaleSyncOptions

Options for the usePreferredLocaleSync hook.

Generic over the locale type T (defaults to string): pass the app's own Locale union (e.g. via supportedLocales: Object.values(Locale)) so onLocaleChange receives a precisely typed value and no as Locale cast is needed.

Type Parameters

Type ParameterDefault type
T extends stringstring

Properties

PropertyTypeDescription
currentLocale?string(Optional) The locale currently active in the app. When provided and equal to the user's preference, onLocaleChange is skipped to avoid redundant re-application (and redundant localStorage writes) of an already-active locale.
onLocaleChange(locale: T) => voidCallback invoked when user's preferred locale should be applied
supportedLocalesT[]Array of locale codes supported by the consuming app