forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.ts
More file actions
228 lines (199 loc) · 4.72 KB
/
interfaces.ts
File metadata and controls
228 lines (199 loc) · 4.72 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/**
* Options for the passthrough locale.
*
* @public
*/
export interface IPassthroughLocaleOptions {
/**
* If this is set to `true`, a passthrough locale will be included in the output
*/
usePassthroughLocale?: boolean;
/**
* If {@link IPassthroughLocaleOptions.usePassthroughLocale} is set, use this name for the passthrough locale.
* Defaults to "passthrough"
*/
passthroughLocaleName?: string;
}
/**
* Options for typing generation.
*
* @public
*/
export interface ITypingsGenerationOptions {
/**
* This property specifies the folder in which `.d.ts` files for loc files should be dropped.
*/
generatedTsFolder: string;
/**
* This optional property overrides the compiler context for discovery of localization files
* for which typings should be generated.
*/
sourceRoot?: string;
/**
* If this option is set to `true`, loc modules typings will be exported wrapped in a `default` property.
*/
exportAsDefault?: boolean;
}
/**
* @public
*/
export interface IDefaultLocaleOptions {
/**
* This required property specifies the name of the locale used in the
* `.resx` and `.loc.json` files in the source
*/
localeName: string;
/**
* If this option is set to `true`, strings that are missing from
* `localizedData.translatedStrings` will be provided by the default locale
*/
fillMissingTranslationStrings?: boolean;
}
/**
* Options for the pseudolocale library.
*
* @internalRemarks
* Eventually this should be replaced with DefinitelyTyped types.
*
* @public
*/
export interface IPseudolocaleOptions {
prepend?: string;
append?: string;
delimiter?: string;
startDelimiter?: string;
endDelimiter?: string;
extend?: number;
override?: string;
}
/**
* Options for generated pseudolocales.
*
* @public
*/
export interface IPseudolocalesOptions {
[pseudoLocaleName: string]: IPseudolocaleOptions;
}
/**
* @public
*/
export interface ILocalizedData {
/**
* Options for the locale used in the source localized data files.
*/
defaultLocale: IDefaultLocaleOptions;
/**
* Use this parameter to specify the translated data.
*/
translatedStrings: ILocalizedStrings;
/**
* Options around including a passthrough locale.
*/
passthroughLocale?: IPassthroughLocaleOptions;
/**
* Options for pseudo-localization.
*/
pseudolocales?: IPseudolocalesOptions;
}
/**
* Options for how localization stats data should be produced.
*
* @public
*/
export interface ILocalizationStatsOptions {
/**
* This option is used to designate a path at which a JSON file describing the localized
* assets produced should be written.
*/
dropPath?: string;
/**
* This option is used to specify a callback to be called with the stats data that would be
* dropped at `localizationStats.dropPath` after compilation completes.
*/
callback?: (stats: ILocalizationStats) => void;
}
/**
* The options for localization.
*
* @public
*/
export interface ILocalizationPluginOptions {
/**
* Localization data.
*/
localizedData: ILocalizedData;
/**
* This option is used to specify `.resx` and `.loc.json` files that should not be processed by this plugin.
*/
filesToIgnore?: string[];
/**
* The value to replace the [locale] token with for chunks without localized strings. Defaults to "none"
*/
noStringsLocaleName?: string;
/**
* Options for how localization stats data should be produced.
*/
localizationStats?: ILocalizationStatsOptions;
/**
* This option is used to specify how and if TypeScript typings should be generated for loc files.
*/
typingsOptions?: ITypingsGenerationOptions;
}
/**
* @internal
*/
export interface ILocalizationFile {
[stringName: string]: ILocalizedString;
}
/**
* @internal
*/
export interface ILocalizedString {
value: string;
comment?: string;
}
/**
* @public
*/
export interface ILocaleFileData {
[stringName: string]: string;
}
/**
* @public
*/
export interface ILocaleData {
[locFilePath: string]: ILocaleFileData;
}
/**
* @public
*/
export interface ILocalizedStrings {
[locale: string]: ILocaleData;
}
/**
* @public
*/
export interface ILocaleElementMap {
[locale: string]: string
}
/**
* @public
*/
export interface ILocalizationStatsEntrypoint {
localizedAssets: ILocaleElementMap;
}
/**
* @public
*/
export interface ILocalizationStatsChunkGroup {
localizedAssets: ILocaleElementMap;
}
/**
* @public
*/
export interface ILocalizationStats {
entrypoints: { [name: string]: ILocalizationStatsEntrypoint };
namedChunkGroups: { [name: string]: ILocalizationStatsChunkGroup };
}