Skip to content

Commit 4af2e63

Browse files
committed
Restructure the options object.
1 parent 5fbba31 commit 4af2e63

File tree

5 files changed

+178
-152
lines changed

5 files changed

+178
-152
lines changed

common/reviews/api/localization-plugin.api.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Terminal } from '@microsoft/node-core-library';
88
import * as Webpack from 'webpack';
99

1010
// @public (undocumented)
11-
export interface ILocale {
11+
export interface ILocaleData {
1212
// (undocumented)
1313
[locFilePath: string]: ILocaleFileData;
1414
}
@@ -19,12 +19,6 @@ export interface ILocaleFileData {
1919
[stringName: string]: string;
2020
}
2121

22-
// @public (undocumented)
23-
export interface ILocales {
24-
// (undocumented)
25-
[locale: string]: ILocale;
26-
}
27-
2822
// @public
2923
export interface ILocalizationPluginOptions {
3024
// (undocumented)
@@ -35,8 +29,8 @@ export interface ILocalizationPluginOptions {
3529
localizationStatsCallback?: (stats: ILocalizationStats) => void;
3630
// (undocumented)
3731
localizationStatsDropPath?: string;
38-
localizedStrings: ILocales;
39-
passthroughLocale?: IPassthroughLocaleOptions;
32+
// (undocumented)
33+
localizedData: ILocalizedData;
4034
// (undocumented)
4135
typingsOptions?: ITypingsGenerationOptions;
4236
}
@@ -69,6 +63,18 @@ export interface ILocalizationStatsEntrypoint {
6963
};
7064
}
7165

66+
// @public (undocumented)
67+
export interface ILocalizedData {
68+
passthroughLocale?: IPassthroughLocaleOptions;
69+
strings: ILocalizedStrings;
70+
}
71+
72+
// @public (undocumented)
73+
export interface ILocalizedStrings {
74+
// (undocumented)
75+
[locale: string]: ILocaleData;
76+
}
77+
7278
// @public (undocumented)
7379
export interface IPassthroughLocaleOptions {
7480
passthroughLocaleName?: string;

webpack/localization-plugin/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ any translations.
3030

3131
## Options
3232

33-
### `localizedStrings = { }`
33+
### `localizedData = { }`
34+
35+
#### `localizedData.strings = { }`
3436

3537
This option is used to specify the localization data to be used in the build. This object has the following
3638
structure:
@@ -41,7 +43,7 @@ structure:
4143
For example:
4244

4345
```JavaScript
44-
localizedStrings: {
46+
strings: {
4547
"en-us": {
4648
"./src/strings1.loc.json": {
4749
"string1": "the first string"
@@ -55,20 +57,20 @@ localizedStrings: {
5557
}
5658
```
5759

58-
### `passthroughLocale = { }`
60+
#### `localizedData.passthroughLocale = { }`
5961

6062
This option is used to specify how and if a passthrough locale should be generated. A passthrough locale
6163
is a generated locale in which each string's value is its name. This is useful for debugging and for identifying
6264
cases where a locale is missing.
6365

6466
This option takes two optional properties:
6567

66-
#### `passthroughLocale.usePassthroughLocale = true | false`
68+
##### `localizedData.passthroughLocale.usePassthroughLocale = true | false`
6769

6870
If `passthroughLocale.usePassthroughLocale` is set to `true`, a passthrough locale will be included in the output.
6971
By default, the passthrough locale's name is "passthrough."
7072

71-
#### `passthroughLocale.passthroughLocaleName = '...'`
73+
##### `localizedData.passthroughLocale.passthroughLocaleName = '...'`
7274

7375
If `passthroughLocale.usePassthroughLocale` is set to `true`, the "passthrough" locale name can be overridden
7476
by setting a value on `passthroughLocale.passthroughLocaleName`.

0 commit comments

Comments
 (0)