@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
51 lines (50 loc) • 2.24 kB
TypeScript
import { Locale, StringMap, ProgramTheme, ProgramThemeMessages, Segment, ViewModel, MessagesModule, VerificationResponse } from '../types/types';
/**
* @private
* NOTE: webpack will not import chunks recursively, or with more than one variable in the path.
* Here we're using a fully statically-defined import, for reliability.
*/
export declare const getMessagesModuleByLocale: (locale: Locale) => Promise<MessagesModule>;
/**
* @description Pluck only the messages we want to override defaults with.
* Empty string values like `""` are allowed so messages can be hidden.
* Messages with `undefined` values are omitted.
*
* @private
*/
export declare const getThemeMessages: (msgs: ProgramThemeMessages) => StringMap;
export declare const getOptionsMessages: (locale: Locale) => Object;
/**
* Map old locales (Java 7) to new standards
* @private
*/
export declare const modernizeLocale: (locale: Locale) => string;
/**
* @description Get all messages for a given locale.
* Return a flattened messages object, where properties are dot-string style.
*/
export declare const getMessages: (locale: Locale, programThemeMessages?: ProgramThemeMessages, segment?: Segment) => Promise<StringMap>;
/**
* @description Retrieves the locale used to display the verification form. It will attempt to bring the best default by looking at these places:
* - Retrieve from previous user selection in ChangeLocaleComponent
* - Retrieve based on the country selected
* - Retrieve from Options
* - Retrieve from the URL
* - Retrieve from the VerificationResponse
* - Retrieve library DEFAULT_LOCALE
* If found a locale but is not supported by the library, it'll return DEFAULT_LOCALE instead.
*/
export declare const getLocaleSafely: (viewModel?: ViewModel, verificationResponse?: VerificationResponse) => Locale;
/**
* @deprecated Use `getMessages()` instead
*/
export declare const getIntlMessages: (locale: Locale, programTheme?: ProgramTheme) => StringMap;
/**
* @deprecated Use `getLocaleSafely()` instead
*/
export declare const getLocale: (programTheme?: ProgramTheme) => Locale;
/**
* @deprecated
*/
export declare const setLocale: () => void;
export declare const standardizeLocale: (locale: Locale) => string;