forked from i18next/i18next-parser
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
116 lines (104 loc) · 3.47 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import EventEmitter from "events";
export type SupportedLexer = "HandlebarsLexer" | "HTMLLexer" | "JavascriptLexer" | "JsxLexer" | "VueLexer";
// BaseLexer is not importable therefore this is the best if done simple
export class CustomLexerClass extends EventEmitter {}
export type CustomLexer = typeof CustomLexerClass;
export interface CustomLexerConfig extends Record<string, unknown> {
lexer: CustomLexer;
}
export interface HandlebarsLexerConfig {
lexer: "HandlebarsLexer";
functions?: string[];
}
export interface HTMLLexerConfig {
lexer: "HTMLLexer";
functions?: string[];
attr?: string;
optionAttr?: string;
}
export interface JavascriptLexerConfig {
lexer: "JavascriptLexer";
functions?: string[];
namespaceFunctions?: string[];
attr?: string;
parseGenerics?: false;
typeMap?: Record<string, unknown>;
}
export interface JavascriptWithTypesLexerConfig {
lexer: "JavascriptLexer";
functions?: string[];
namespaceFunctions?: string[];
attr?: string;
parseGenerics: true;
typeMap: Record<string, unknown>;
}
export interface JsxLexerConfig {
lexer: "JsxLexer";
functions?: string[];
namespaceFunctions?: string[];
attr?: string;
transSupportBasicHtmlNodes?: boolean;
transKeepBasicHtmlNodesFor?: string[];
parseGenerics?: false;
typeMap?: Record<string, unknown>;
}
export interface JsxWithTypesLexerConfig {
lexer: "JsxLexer";
functions?: string[];
namespaceFunctions?: string[];
attr?: string;
transSupportBasicHtmlNodes?: boolean;
transKeepBasicHtmlNodesFor?: string[];
parseGenerics: true;
typeMap: Record<string, unknown>;
}
export interface VueLexerConfig {
lexer: "VueLexer";
functions?: string[];
}
export type LexerConfig =
| HandlebarsLexerConfig
| HTMLLexerConfig
| JavascriptLexerConfig
| JavascriptWithTypesLexerConfig
| JsxLexerConfig
| JsxWithTypesLexerConfig
| VueLexerConfig
| CustomLexerConfig;
export interface UserConfig {
contextSeparator?: string;
createOldCatalogs?: boolean;
defaultNamespace?: string;
defaultValue?: string | ((locale?: string, namespace?: string, key?: string) => string | Promise<string>);
indentation?: number;
keepRemoved?: boolean;
keySeparator?: string | false;
lexers?: {
hbs?: (SupportedLexer | CustomLexer | LexerConfig)[];
handlebars?: (SupportedLexer | CustomLexer | LexerConfig)[];
htm?: (SupportedLexer | CustomLexer | LexerConfig)[];
html?: (SupportedLexer | CustomLexer | LexerConfig)[];
mjs?: (SupportedLexer | CustomLexer | LexerConfig)[];
js?: (SupportedLexer | CustomLexer | LexerConfig)[];
ts?: (SupportedLexer | CustomLexer | LexerConfig)[];
jsx?: (SupportedLexer | CustomLexer | LexerConfig)[];
tsx?: (SupportedLexer | CustomLexer | LexerConfig)[];
default?: (SupportedLexer | CustomLexer | LexerConfig)[];
};
lineEnding?: "auto" | "crlf" | "\r\n" | "cr" | "\r" | "lf" | "\n";
locales?: string[];
namespaceSeparator?: string | false;
output?: string;
pluralSeparator?: string;
input?: string | string[];
sort?: boolean | ((a: string, b: string) => -1 | 0 | 1);
skipDefaultValues?: boolean | ((locale?: string, namespace?: string) => boolean);
useKeysAsDefaultValue?: boolean | ((locale?: string, namespace?: string) => boolean);
verbose?: boolean;
failOnWarnings?: boolean;
failOnUpdate?: boolean;
customValueTemplate?: Record<string, string> | null;
resetDefaultValueLocale?: string | null;
i18nextOptions?: Record<string, unknown> | null;
yamlOptions?: Record<string, unknown> | null;
}