Skip to content

Commit 6e5bedf

Browse files
committed
Add support for pulling in string data from the source files.
1 parent 4af2e63 commit 6e5bedf

9 files changed

Lines changed: 186 additions & 271 deletions

File tree

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
import { Terminal } from '@microsoft/node-core-library';
88
import * as Webpack from 'webpack';
99

10+
// @public (undocumented)
11+
export interface IDefaultLocaleOptions {
12+
// (undocumented)
13+
fillMissingTranslationStrings?: boolean;
14+
// (undocumented)
15+
localeName: string;
16+
}
17+
1018
// @public (undocumented)
1119
export interface ILocaleData {
1220
// (undocumented)
@@ -65,8 +73,17 @@ export interface ILocalizationStatsEntrypoint {
6573

6674
// @public (undocumented)
6775
export interface ILocalizedData {
76+
defaultLocale: IDefaultLocaleOptions;
6877
passthroughLocale?: IPassthroughLocaleOptions;
69-
strings: ILocalizedStrings;
78+
translatedStrings: ILocalizedStrings;
79+
}
80+
81+
// @internal (undocumented)
82+
export interface _ILocalizedString {
83+
// (undocumented)
84+
comment?: string;
85+
// (undocumented)
86+
value: string;
7087
}
7188

7289
// @public (undocumented)
@@ -75,6 +92,12 @@ export interface ILocalizedStrings {
7592
[locale: string]: ILocaleData;
7693
}
7794

95+
// @internal (undocumented)
96+
export interface _ILocFile {
97+
// (undocumented)
98+
[stringName: string]: _ILocalizedString;
99+
}
100+
78101
// @public (undocumented)
79102
export interface IPassthroughLocaleOptions {
80103
passthroughLocaleName?: string;
@@ -115,6 +138,8 @@ export interface ITypingsGeneratorOptions {
115138
// @public
116139
export class LocalizationPlugin implements Webpack.Plugin {
117140
constructor(options: ILocalizationPluginOptions);
141+
// @internal (undocumented)
142+
addDefaultLocFile(locFilePath: string, locFile: _ILocFile): void;
118143
// (undocumented)
119144
apply(compiler: Webpack.Compiler): void;
120145
// @internal (undocumented)

webpack/localization-plugin/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ any translations.
3232

3333
### `localizedData = { }`
3434

35-
#### `localizedData.strings = { }`
35+
#### `localizedData.translatedStrings = { }`
3636

3737
This option is used to specify the localization data to be used in the build. This object has the following
3838
structure:
@@ -43,7 +43,7 @@ structure:
4343
For example:
4444

4545
```JavaScript
46-
strings: {
46+
translatedStrings: {
4747
"en-us": {
4848
"./src/strings1.loc.json": {
4949
"string1": "the first string"

0 commit comments

Comments
 (0)