@@ -62,8 +62,8 @@ export class LocalizationPlugin implements Webpack.Plugin {
6262 private _filesToIgnore : Set < string > = new Set < string > ( ) ;
6363 private _stringPlaceholderCounter : number = 0 ;
6464 private _stringPlaceholderMap : Map < string , { [ locale : string ] : string } > = new Map < string , { [ locale : string ] : string } > ( ) ;
65- private _passthroughStringsMap : Map < string , string > = new Map < string , string > ( )
6665 private _locales : Set < string > = new Set < string > ( ) ;
66+ private _passthroughLocaleName : string ;
6767 private _defaultLocale : string ;
6868 private _fillMissingTranslationStrings : boolean ;
6969 private _localeNamePlaceholder : IStringPlaceholder ;
@@ -300,8 +300,12 @@ export class LocalizationPlugin implements Webpack.Plugin {
300300
301301 const placeholder : IStringPlaceholder = this . stringKeys . get ( stringKey ) ! ;
302302 if ( ! this . _stringPlaceholderMap . has ( placeholder . suffix ) ) {
303- this . _stringPlaceholderMap . set ( placeholder . suffix , { } ) ;
304- this . _passthroughStringsMap . set ( placeholder . suffix , stringName ) ;
303+ this . _stringPlaceholderMap . set (
304+ placeholder . suffix ,
305+ {
306+ [ this . _passthroughLocaleName ] : stringName
307+ }
308+ ) ;
305309 }
306310
307311 const stringValue : string = locFileData [ stringName ] ;
@@ -403,7 +407,7 @@ export class LocalizationPlugin implements Webpack.Plugin {
403407 } else {
404408 issues . push (
405409 `The string "${ localizedElement . stringName } " in "${ localizedElement . locFilePath } " is missing in the ` +
406- `locales ${ locale } `
410+ `locale ${ locale } `
407411 ) ;
408412
409413 newValue = '-- MISSING STRING --' ;
@@ -437,7 +441,7 @@ export class LocalizationPlugin implements Webpack.Plugin {
437441
438442 if ( issues . length > 0 ) {
439443 compilation . errors . push ( Error (
440- `Issues during localized string validation :\n${ issues . map ( ( issue ) => ` ${ issue } ` ) . join ( '\n' ) } `
444+ `localization :\n${ issues . map ( ( issue ) => ` ${ issue } ` ) . join ( '\n' ) } `
441445 ) ) ;
442446 }
443447
@@ -478,6 +482,20 @@ export class LocalizationPlugin implements Webpack.Plugin {
478482 this . _localeNamePlaceholder = this . _getPlaceholderString ( ) ;
479483 this . _stringPlaceholderMap . set ( this . _localeNamePlaceholder . suffix , localeNameMap ) ;
480484
485+ // START options.localizedData.passthroughLocale
486+ if ( this . _options . localizedData . passthroughLocale ) {
487+ const {
488+ usePassthroughLocale,
489+ passthroughLocaleName = 'passthrough'
490+ } = this . _options . localizedData . passthroughLocale ;
491+ if ( usePassthroughLocale ) {
492+ this . _passthroughLocaleName = passthroughLocaleName ;
493+ this . _locales . add ( passthroughLocaleName ) ;
494+ this . _stringPlaceholderMap . get ( this . _localeNamePlaceholder . suffix ) ! [ passthroughLocaleName ] = passthroughLocaleName ;
495+ }
496+ }
497+ // END options.localizedData.passthroughLocale
498+
481499 // START options.localizedData.translatedStrings
482500 const { translatedStrings } = this . _options . localizedData ;
483501 if ( translatedStrings ) {
@@ -531,22 +549,6 @@ export class LocalizationPlugin implements Webpack.Plugin {
531549 }
532550 // END options.localizedData.translatedStrings
533551
534- // START options.localizedData.passthroughLocale
535- if ( this . _options . localizedData . passthroughLocale ) {
536- const {
537- usePassthroughLocale,
538- passthroughLocaleName = 'passthrough'
539- } = this . _options . localizedData . passthroughLocale ;
540- if ( usePassthroughLocale ) {
541- this . _locales . add ( passthroughLocaleName ) ;
542- this . _stringPlaceholderMap . get ( this . _localeNamePlaceholder . suffix ) ! [ passthroughLocaleName ] = passthroughLocaleName ;
543- this . _passthroughStringsMap . forEach ( ( stringName : string , stringKey : string ) => {
544- this . _stringPlaceholderMap . get ( stringKey ) ! [ passthroughLocaleName ] = stringName ;
545- } ) ;
546- }
547- }
548- // END options.localizedData.passthroughLocale
549-
550552 // START options.localizedData.defaultLocale
551553 if ( this . _options . localizedData . defaultLocale ) {
552554 const { localeName, fillMissingTranslationStrings } = this . _options . localizedData . defaultLocale ;
0 commit comments