UNPKG

1.41 kBTypeScriptView Raw
1export declare const localizationPath = "/services/i18n";
2export declare const AsyncLocalizationProvider: unique symbol;
3export interface AsyncLocalizationProvider {
4 getCurrentLanguage(): Promise<string>;
5 setCurrentLanguage(languageId: string): Promise<void>;
6 getAvailableLanguages(): Promise<LanguageInfo[]>;
7 loadLocalization(languageId: string): Promise<Localization>;
8}
9export interface Localization extends LanguageInfo {
10 translations: {
11 [key: string]: string;
12 };
13}
14export interface LanguageInfo {
15 languageId: string;
16 languageName?: string;
17 languagePack?: boolean;
18 localizedLanguageName?: string;
19}
20export declare type FormatType = string | number | boolean | undefined;
21export declare namespace Localization {
22 function format(message: string, args: FormatType[]): string;
23 function localize(localization: Localization | undefined, key: string, defaultValue: string, ...args: FormatType[]): string;
24 /**
25 * This function normalizes values from VSCode's localizations, which often contain additional mnemonics (`&&`).
26 * The normalization removes the mnemonics from the input string.
27 *
28 * @param value Localization value coming from VSCode
29 * @returns A normalized localized value
30 */
31 function normalize(value: string): string;
32 function transformKey(key: string): string;
33}
34//# sourceMappingURL=localization.d.ts.map
\No newline at end of file