UNPKG

2.03 kBTypeScriptView Raw
1export declare enum MessageFormat {
2 file = "file",
3 bundle = "bundle",
4 both = "both"
5}
6export declare enum BundleFormat {
7 standalone = "standalone",
8 languagePack = "languagePack"
9}
10export interface Options {
11 locale?: string;
12 cacheLanguageResolution?: boolean;
13 messageFormat?: MessageFormat;
14 bundleFormat?: BundleFormat;
15}
16export interface LocalizeInfo {
17 key: string;
18 comment: string[];
19}
20export interface LocalizeFunc {
21 (info: LocalizeInfo, message: string, ...args: (string | number | boolean | undefined | null)[]): string;
22 (key: string, message: string, ...args: (string | number | boolean | undefined | null)[]): string;
23}
24export interface LoadFunc {
25 (file?: string): LocalizeFunc;
26}
27export declare type SingleFileJsonFormat = string[] | {
28 messages: string[];
29 keys: string[];
30};
31export interface NlsBundle {
32 [key: string]: string[];
33}
34export declare type KeyInfo = string | LocalizeInfo;
35export interface MetaDataEntry {
36 messages: string[];
37 keys: KeyInfo[];
38}
39export interface MetadataHeader {
40 id: string;
41 type: string;
42 hash: string;
43 outDir: string;
44}
45export interface MetaDataFile {
46 [key: string]: MetaDataEntry;
47}
48export interface TranslationConfig {
49 [extension: string]: string;
50}
51export interface I18nBundle {
52 version: string;
53 contents: {
54 [module: string]: {
55 [messageKey: string]: string;
56 };
57 };
58}
59export interface LanguageBundle {
60 header: MetadataHeader;
61 nlsBundle: NlsBundle;
62}
63export declare function isDefined(value: any): boolean;
64export declare let isPseudo: boolean;
65export declare function setPseudo(pseudo: boolean): void;
66export declare function format(message: string, args: any[]): string;
67export declare function localize(_key: string | LocalizeInfo, message: string, ...args: any[]): string;
68export declare function loadMessageBundle(file?: string): LocalizeFunc;
69export declare function config(opts?: Options): LoadFunc;
70//# sourceMappingURL=common.d.ts.map
\No newline at end of file