import { Strings } from "./util/strings"; import { GlobalAppStatePropertyParameters } from "./appFactory/GlobalAppStateProperty"; /** * An object literal. All fields are required, * except `getSupportedLanguages` and its fields. */ interface LangOptions { /** * A default language (provided as a lang code) * to fall back to if both restoring language * preference and auto-detecting language * was unsuccessful. `defaultLang` must * exist in `defaultSupportedLanguages`. */ defaultLang: string; /** * An array of lang codes representing the languages * that your site/application supports. */ defaultSupportedLanguages: string[]; /** * A function that retrieves string resources. * @param lang A lang code * @returns String resources for that lang code, either synchronously or asynchronously */ getStrings(lang: string): Strings | Promise; /** * An object literal containing functions that retrieve * arrays of lang codes representing the languages * that you site/application supports. The arrays * returned by these functions override * `defaultSupportedLanguages`. */ getSupportedLanguages?: { /** * A function for retrieving the array of lang codes server-side. * @returns The array of lang codes either synchronously or asynchronously */ serverSide?(): string[] | Promise; /** * A function for retrieving the array of lang codes client-side. * @returns The array of lang codes either synchronously or asynchronously */ clientSide?(): string[] | Promise; }; } /** * A ready-made global app state property which constitutes * a minimal yet powerful internationalization solution. * @param options A `LangOptions` object * @returns A `GlobalAppStatePropertyParameters` object */ declare function lang(options: LangOptions): GlobalAppStatePropertyParameters; export default lang; //# sourceMappingURL=lang.d.ts.map