UNPKG

1.37 kBTypeScriptView Raw
1export declare const LOCALE_CHANGED = "bearer-locale-changed";
2export declare class I18n {
3 private _locale;
4 private _dictionnary;
5 /**
6 * load a dictionary (key/value) containing all the translations required by a dictionary
7 * @argument {string} integration the identifier of the Integration you want to connect to ex: 12345-attach-github-pull-request
8 * @argument {(Object | Promise<Object>)} dictionary dictionary containing all key/value pairs of the integration
9 * @argument {{locale: string}} options { locale: 'en'}
10 */
11 load: (integrationName: string | null, dictionnary: IntegrationTranlsationEntry | TransLationObject | Promise<IntegrationTranlsationEntry | TransLationObject>, { locale }?: Partial<{
12 locale: string;
13 }>) => Promise<void>;
14 private localeChanged;
15 get: (integrationName: string | null, key: string, options?: Partial<{
16 locale: string;
17 }>) => TransLationValue;
18 /**
19 * set the current locale you want your integrations to use
20 */
21 locale: string;
22}
23declare const i18n: I18n;
24declare type IntegrationTranlsationEntry = {
25 [integrationName: string]: TransLationObject;
26};
27declare type TransLationValue = string | number | TransLationObject;
28interface TransLationObject {
29 [key: string]: TransLationValue;
30}
31export default i18n;