Type Alias LocaleOptions<TLocale>

LocaleOptions: {
    default: TLocale;
    initial?: TLocale;
    persist?: boolean;
    supported: readonly TLocale[];
}

Type Parameters

  • TLocale extends string

Type declaration

  • default: TLocale

    The default locale if the user's preferred locale is not supported. This must be one of the items in supported.

  • Optionalinitial?: TLocale

    Initial value for locale

    If not set, it will default to calling getPreferredLocale(), which is based on the browser's language settings.

    If persist is true, it will also check the value from localStorage

    If the initial value is not supported, it will default to the default locale

  • Optionalpersist?: boolean

    Persist the locale preference to localStorage

  • supported: readonly TLocale[]

    List of supported locale or languages. These can be full locale strings like "en-US" or just languages like "en"