jb-core
Version:
jb design system core modules
20 lines • 879 B
TypeScript
import type { JBI18N } from "./i18n";
export declare function getRequiredMessage(context: JBI18N, label?: string): string;
export declare class JBDictionary<T extends object> {
dictionary: Record<string, T>;
constructor(initialDictionary: Record<string, T>);
/**
* add new or replace existing language with given dictionary
* @param languageKey language standard key like "fa" or "en"
* @param dictionary key value object of strings and messages
*/
setLanguage(languageKey: string, dictionary: T): void;
/**
* get value of given key in dictionary with fallback to english dictionary
* @param i18n instance of i18n config
* @param key key of dictionary object
* @returns value of the dictionary with "en" fallback
*/
get<K extends keyof T>(i18n: JBI18N, key: K): T[K];
}
//# sourceMappingURL=dictionary.d.ts.map