@@ -309,9 +309,10 @@ export class LocalizationPlugin implements Webpack.Plugin {
309309 kind : 'localized' ;
310310 values : { [ locale : string ] : string } ;
311311 size : number ;
312+ quotemarkCharacter : string | undefined ;
312313 }
313314
314- const placeholderRegex : RegExp = new RegExp ( `${ lodash . escapeRegExp ( STRING_PLACEHOLDER_PREFIX ) } _(\\d+)` , 'g' ) ;
315+ const placeholderRegex : RegExp = new RegExp ( `${ lodash . escapeRegExp ( STRING_PLACEHOLDER_PREFIX ) } _(.+)_( \\d+)` , 'g' ) ;
315316 const result : Map < string , IProcessAssetResult > = new Map < string , IProcessAssetResult > ( ) ;
316317 const assetSource : string = asset . source ( ) ;
317318
@@ -326,7 +327,7 @@ export class LocalizationPlugin implements Webpack.Plugin {
326327 } ;
327328 reconstructionSeries . push ( staticElement ) ;
328329
329- const [ placeholder , placeholderSerialNumber ] = regexResult ;
330+ const [ placeholder , quotemark , placeholderSerialNumber ] = regexResult ;
330331
331332 const values : { [ locale : string ] : string } | undefined = this . _stringPlaceholderMap . get ( placeholderSerialNumber ) ;
332333 if ( ! values ) {
@@ -340,7 +341,8 @@ export class LocalizationPlugin implements Webpack.Plugin {
340341 const localizedElement : ILocalizedReconstructionElement = {
341342 kind : 'localized' ,
342343 values : values ,
343- size : placeholder . length
344+ size : placeholder . length ,
345+ quotemarkCharacter : quotemark !== '"' ? quotemark : undefined
344346 } ;
345347 reconstructionSeries . push ( localizedElement ) ;
346348 lastIndex = regexResult . index + placeholder . length ;
@@ -362,7 +364,12 @@ export class LocalizationPlugin implements Webpack.Plugin {
362364 reconstruction . push ( ( element as IStaticReconstructionElement ) . staticString ) ;
363365 } else {
364366 const localizedElement : ILocalizedReconstructionElement = element as ILocalizedReconstructionElement ;
365- const newValue : string = localizedElement . values [ locale ] ;
367+ let newValue : string = localizedElement . values [ locale ] ;
368+ if ( localizedElement . quotemarkCharacter ) {
369+ // Replace the quotemark character with the correctly-escaped character
370+ newValue = newValue . replace ( / \" / g, localizedElement . quotemarkCharacter )
371+ }
372+
366373 reconstruction . push ( newValue ) ;
367374 sizeDiff += ( newValue . length - localizedElement . size ) ;
368375 }
@@ -718,7 +725,7 @@ export class LocalizationPlugin implements Webpack.Plugin {
718725
719726 const suffix : string = ( this . _stringPlaceholderCounter ++ ) . toString ( ) ;
720727 return {
721- value : `${ STRING_PLACEHOLDER_PREFIX } _${ suffix } ` ,
728+ value : `${ STRING_PLACEHOLDER_PREFIX } _"_ ${ suffix } ` ,
722729 suffix : suffix
723730 } ;
724731 }
0 commit comments