export { getNLSLanguage, getNLSMessages } from './nls.messages.js'; export type LocaleType = 'zh-CN' | 'en-US'; export declare enum PreferenceScope { Default = 0, User = 1 } export declare const setLocale: (locale: LocaleType) => void; export interface ILocalizeInfo { key: string; comment: string[]; } export interface ILocalizedString { original: string; value: string; } /** * 这里的类型注释本质是为了让编译时类型校验能通过 * @param data * @param message * * 在编译后,localize 调用方式为 * localize('path/to/file', index, defaultMessage, ...args); */ export declare function localize(data: string | ILocalizeInfo, message: string, ...args: any[]): string; export declare function localize2(data: string | ILocalizeInfo, message: string, ...args: any[]): ILocalizedString; export interface INLSLanguagePackConfiguration { /** * The path to the translations config file that contains pointers to * all message bundles for `main` and extensions. */ readonly translationsConfigFile: string; /** * The path to the file containing the translations for this language * pack as flat string array. */ readonly messagesFile: string; /** * The path to the file that can be used to signal a corrupt language * pack, for example when reading the `messagesFile` fails. This will * instruct the application to re-create the cache on next startup. */ readonly corruptMarkerFile: string; } export interface INLSConfiguration { /** * Locale as defined in `argv.json` or `app.getLocale()`. */ readonly userLocale: string; /** * Locale as defined by the OS (e.g. `app.getPreferredSystemLanguages()`). */ readonly osLocale: string; /** * The actual language of the UI that ends up being used considering `userLocale` * and `osLocale`. */ readonly resolvedLanguage: string; /** * Defined if a language pack is used that is not the * default english language pack. This requires a language * pack to be installed as extension. */ readonly languagePack?: INLSLanguagePackConfiguration; /** * The path to the file containing the default english messages * as flat string array. The file is only present in built * versions of the application. */ readonly defaultMessagesFile: string; /** * Below properties are deprecated and only there to continue support * for `vscode-nls` module that depends on them. * Refs https://github.com/microsoft/vscode-nls/blob/main/src/node/main.ts#L36-L46 */ /** @deprecated */ readonly locale: string; /** @deprecated */ readonly availableLanguages: Record; /** @deprecated */ readonly _languagePackSupport?: boolean; /** @deprecated */ readonly _languagePackId?: string; /** @deprecated */ readonly _translationsConfigFile?: string; /** @deprecated */ readonly _cacheRoot?: string; /** @deprecated */ readonly _resolvedLanguagePackCoreLocation?: string; /** @deprecated */ readonly _corruptedFile?: string; }