export type Language = 'en' | 'es'; export declare function _detectDocumentLanguage(): Language | undefined; export declare function getLanguage(): Language; export declare function setLanguage(lang: Language): void; type Translations = { [key: string]: string | Translations; }; export declare function getTranslations(lang?: Language): Translations; export declare function addTranslations(lang: Language, translations: Translations): void; /** * Because language strings can contain region subtags, we need a way to compare * just the language portion of two language strings. This function compares two * locale strings that may or may not contain subtags according to IETF BCP 47. * The second string defaults to our globally set language. */ export declare function languageMatches(localeStringA: string, localeStringB?: string): boolean; /** * Falls back to a more generic locale if the more specific one isn't * available in this browser. Testing platforms tend to have only a * few locales. */ export declare function fallbackLocale(language: string, subtag: string): string; /** * Returns the translation for a given key for a given language. For most * use cases, the `t` function will be more appropriate, where the language * is not a required parameter. Use this when you need a translation from * a specific language. */ export declare function translate(lang: Language, key: string, data?: { [key: string]: string; }): string; /** * Returns the translation for a given key in the currently set language. */ export declare function t(key: Parameters[1], data?: Parameters[2]): string; export type TFunction = typeof t; /** * Returns a translation function bound to a specific language. * * Note that we don't want to use this to create the default `t` function * because it will bind with whatever the default language is AT THAT TIME, * so if the global language changes after we call this function, * translations coming out if it wouldn't pick up on the change. */ export declare function tWithLanguage(lang?: Language): (key: Parameters[1], data?: Parameters[2]) => string; export {};