UNPKG

@aws-amplify/core

Version:
58 lines (57 loc) 1.63 kB
import { I18nConfig } from './types'; /** * Language translation utility. */ export declare class I18n { /** * @private */ _options: I18nConfig | null; /** * @private */ _lang?: string | null; /** * @private */ _dict: Record<string, any>; /** * Sets the default language from the configuration when required. */ setDefaultLanguage(): void; /** * @method * Explicitly setting language * @param {String} lang */ setLanguage(lang: string): void; /** * @method * Get value * @param {String} key * @param {String} defVal - Default value */ get(key: string, defVal?: string | undefined): any; /** * @method * Get value according to specified language * @param {String} key * @param {String} language - Specified langurage to be used * @param {String} defVal - Default value */ getByLanguage(key: string, language: string, defVal?: string | null): any; /** * @method * Add vocabularies for one language * @param {String} language - Language of the dictionary * @param {Object} vocabularies - Object that has key-value as dictionary entry */ putVocabulariesForLanguage(language: string, vocabularies: Record<string, any>): void; /** * @method * Add vocabularies for one language * @param {Object} vocabularies - Object that has language as key, * vocabularies of each language as value */ putVocabularies(vocabularies: Record<string, Record<string, string>>): void; }