File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ describe("js macro", () => {
8787 expect ( tokens ) . toEqual ( [
8888 {
8989 type : "text" ,
90- value : 'Message \\ u0020' ,
90+ value : 'Message \/ u0020' ,
9191 } ,
9292 ] )
9393 } )
Original file line number Diff line number Diff line change @@ -361,7 +361,7 @@ export default class MacroJs {
361361 */
362362 clearBackslashes ( value : string ) {
363363 // it's an unicode char so we should keep them
364- if ( value . includes ( '\\u' ) ) return value
364+ if ( value . includes ( '\\u' ) ) return value . replace ( removeExtraScapedLiterals , "\/u" )
365365 // if not we replace the extra scaped literals
366366 return value . replace ( removeExtraScapedLiterals , "`" )
367367 }
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { zip, makeCounter } from "./utils"
77import { ID , COMMENT , MESSAGE } from "./constants"
88
99const pluralRuleRe = / ( _ [ \d \w ] + | z e r o | o n e | t w o | f e w | m a n y | o t h e r ) /
10- const removeExtraScapedLiterals = / (?: \\ ( .) ) /
10+ const removeExtraScapedLiterals = / (?: \\ ( .) ) / g
1111const jsx2icuExactChoice = ( value ) =>
1212 value . replace ( / _ ( \d + ) / , "=$1" ) . replace ( / _ ( \w + ) / , "$1" )
1313
@@ -365,7 +365,7 @@ export default class MacroJSX {
365365 * */
366366 clearBackslashes ( value : string ) {
367367 // it's an unicode char so we should keep them
368- if ( value . includes ( '\\u' ) ) return value
368+ if ( value . includes ( '\\u' ) ) return value . replace ( removeExtraScapedLiterals , "\/u" )
369369 // if not we replace the extra scaped literals
370370 return value . replace ( removeExtraScapedLiterals , "`" )
371371 }
You can’t perform that action at this time.
0 commit comments