diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts index 5b331533ee..58b3937361 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts @@ -219,7 +219,7 @@ describe('i18n support in the template compiler', () => { $I18N_7$ = $MSG_EXTERNAL_6435899732746131543$$APP_SPEC_TS_8$; } else { - $I18N_7$ = $localize \`:meaningC|@@6435899732746131543:Title C\`; + $I18N_7$ = $localize \`:meaningC|:Title C\`; } const $_c9$ = ["title", $I18N_7$]; var $I18N_11$; @@ -232,7 +232,7 @@ describe('i18n support in the template compiler', () => { $I18N_11$ = $MSG_EXTERNAL_5200291527729162531$$APP_SPEC_TS_12$; } else { - $I18N_11$ = $localize \`:meaningD|descD@@5200291527729162531:Title D\`; + $I18N_11$ = $localize \`:meaningD|descD:Title D\`; } const $_c13$ = ["title", $I18N_11$]; var $I18N_15$; @@ -365,7 +365,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_8809028065680254561$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:m|d@@8809028065680254561:introduction\`; + $I18N_1$ = $localize \`:m|d:introduction\`; } const $_c1$ = ["title", $I18N_1$]; … @@ -402,7 +402,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_5526535577705876535$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@5526535577705876535:static text\`; + $I18N_1$ = $localize \`static text\`; } var $I18N_2$; if (ngI18nClosureMode) { @@ -416,7 +416,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_8977039798304050198$$APP_SPEC_TS_2$; } else { - $I18N_2$ = $localize \`:m|d@@8977039798304050198:intro $` + + $I18N_2$ = $localize \`:m|d:intro $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } var $I18N_3$; @@ -431,7 +431,7 @@ describe('i18n support in the template compiler', () => { $I18N_3$ = $MSG_EXTERNAL_7432761130955693041$$APP_SPEC_TS_3$; } else { - $I18N_3$ = $localize \`:m1|d1@@7432761130955693041:$` + + $I18N_3$ = $localize \`:m1|d1:$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } const $_c1$ = [ @@ -452,7 +452,7 @@ describe('i18n support in the template compiler', () => { $I18N_6$ = $MSG_EXTERNAL_7566208596013750546$$APP_SPEC_TS_6$; } else { - $I18N_6$ = $localize \`:m2|d2@@7566208596013750546:$` + + $I18N_6$ = $localize \`:m2|d2:$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: and $` + String.raw `{"\uFFFD1\uFFFD"}:INTERPOLATION_1: and again $` + String.raw `{"\uFFFD2\uFFFD"}:INTERPOLATION_2:\`; @@ -465,7 +465,7 @@ describe('i18n support in the template compiler', () => { $I18N_7$ = $MSG_EXTERNAL_6639222533406278123$$APP_SPEC_TS_7$; } else { - $I18N_7$ = $localize \`:@@6639222533406278123:$` + + $I18N_7$ = $localize \`$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } const $_c3$ = [ @@ -516,7 +516,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_8977039798304050198$; } else { - $I18N_1$ = $localize \`:m|d@@8977039798304050198:intro $` + + $I18N_1$ = $localize \`:m|d:intro $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } const $_c3$ = ["title", $I18N_1$]; @@ -559,7 +559,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_8538466649243975456$$APP_SPEC_TS__1$; } else { - $I18N_1$ = $localize \`:m|d@@8538466649243975456:different scope $` + + $I18N_1$ = $localize \`:m|d:different scope $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } const $_c2$ = ["title", $I18N_1$]; @@ -609,7 +609,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_3462388422673575127$$APP_SPEC_TS_2$; } else { - $I18N_1$ = $localize \`:@@3462388422673575127:$` + + $I18N_1$ = $localize \`$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: title\`; } const $_c3$ = ["title", $I18N_1$]; @@ -658,7 +658,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_5526535577705876535$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@5526535577705876535:static text\`; + $I18N_1$ = $localize \`static text\`; } var $I18N_2$; if (ngI18nClosureMode) { @@ -672,7 +672,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_8977039798304050198$$APP_SPEC_TS_2$; } else { - $I18N_2$ = $localize \`:m|d@@8977039798304050198:intro $` + + $I18N_2$ = $localize \`:m|d:intro $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } var $I18N_3$; @@ -687,7 +687,7 @@ describe('i18n support in the template compiler', () => { $I18N_3$ = $MSG_EXTERNAL_7432761130955693041$$APP_SPEC_TS_3$; } else { - $I18N_3$ = $localize \`:m1|d1@@7432761130955693041:$` + + $I18N_3$ = $localize \`:m1|d1:$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } const $_c1$ = [ @@ -708,7 +708,7 @@ describe('i18n support in the template compiler', () => { $I18N_6$ = $MSG_EXTERNAL_7566208596013750546$$APP_SPEC_TS_6$; } else { - $I18N_6$ = $localize \`:m2|d2@@7566208596013750546:$` + + $I18N_6$ = $localize \`:m2|d2:$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: and $` + String.raw `{"\uFFFD1\uFFFD"}:INTERPOLATION_1: and again $` + String.raw `{"\uFFFD2\uFFFD"}:INTERPOLATION_2:\`; @@ -721,7 +721,7 @@ describe('i18n support in the template compiler', () => { $I18N_7$ = $MSG_EXTERNAL_6639222533406278123$$APP_SPEC_TS_7$; } else { - $I18N_7$ = $localize \`:@@6639222533406278123:$` + + $I18N_7$ = $localize \`$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } const $_c3$ = [ @@ -775,7 +775,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_8538466649243975456$$APP_SPEC_TS__3$; } else { - $I18N_2$ = $localize \`:m|d@@8538466649243975456:different scope $` + + $I18N_2$ = $localize \`:m|d:different scope $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } const $_c4$ = ["title", $I18N_2$]; @@ -827,7 +827,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_7727043314656808423$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:m|d@@7727043314656808423:Element title\`; + $I18N_0$ = $localize \`:m|d:Element title\`; } const $_c1$ = ["title", $I18N_0$]; var $I18N_2$; @@ -836,7 +836,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_4969674997806975147$$APP_SPEC_TS_2$; } else { - $I18N_2$ = $localize \`:@@4969674997806975147:Some content\`; + $I18N_2$ = $localize \`Some content\`; } … template: function MyComponent_Template(rf, ctx) { @@ -926,7 +926,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_APP_SPEC_TS_1$; } else { - $I18N_0$ = $localize \`:@@3784161717320915177:Some text\`; + $I18N_0$ = $localize \`Some text\`; } `; verify(input, output); @@ -944,7 +944,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_4924931801512133405$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@4924931801512133405:Some text 'with single quotes', "with double quotes" and without quotes.\`; + $I18N_0$ = $localize \`Some text 'with single quotes', "with double quotes" and without quotes.\`; } `; @@ -967,7 +967,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_4890179241114413722$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@4890179241114413722:My i18n block #1\`; + $I18N_0$ = $localize \`My i18n block #1\`; } var $I18N_1$; if (ngI18nClosureMode) { @@ -975,7 +975,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_2413150872298537152$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@2413150872298537152:My i18n block #2\`; + $I18N_1$ = $localize \`My i18n block #2\`; } var $I18N_2$; if (ngI18nClosureMode) { @@ -983,7 +983,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_5023003143537152794$$APP_SPEC_TS_2$; } else { - $I18N_2$ = $localize \`:@@5023003143537152794:My i18n block #3\`; + $I18N_2$ = $localize \`My i18n block #3\`; } … template: function MyComponent_Template(rf, ctx) { @@ -1028,7 +1028,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_7597881511811528589$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@7597881511811528589: Named interpolation: $` + + $I18N_0$ = $localize \` Named interpolation: $` + String.raw `{"\uFFFD0\uFFFD"}:PH_A: Named interpolation with spaces: $` + String.raw `{"\uFFFD1\uFFFD"}:PH_B: \`; } @@ -1065,7 +1065,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_6749967533321674787$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@6749967533321674787:$` + + $I18N_0$ = $localize \`$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } … @@ -1104,7 +1104,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_APP_SPEC_TS_1$$APP_SPEC_TS_1$; } else { - $I18N_0$ = $localize \`:@@1194644703943451474: $` + + $I18N_0$ = $localize \` $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: $` + String.raw `{"\uFFFD1\uFFFD"}:INTERPOLATION_1: $` + String.raw `{"\uFFFD2\uFFFD"}:INTERPOLATION_2: \`; @@ -1144,7 +1144,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_572579892698764378$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@572579892698764378:My i18n block #$` + + $I18N_0$ = $localize \`My i18n block #$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } var $I18N_1$; @@ -1155,7 +1155,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_609623417156596326$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@609623417156596326:My i18n block #$` + + $I18N_1$ = $localize \`My i18n block #$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } var $I18N_2$; @@ -1166,7 +1166,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_3998119318957372120$$APP_SPEC_TS_2$; } else { - $I18N_2$ = $localize \`:@@3998119318957372120:My i18n block #$` + + $I18N_2$ = $localize \`My i18n block #$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } … @@ -1228,7 +1228,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_7905233330103651696$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@7905233330103651696: My i18n block #$` + + $I18N_0$ = $localize \` My i18n block #$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: $` + String.raw `{"\uFFFD#2\uFFFD"}:START_TAG_SPAN:Plain text in nested element$` + String.raw `{"\uFFFD/#2\uFFFD"}:CLOSE_TAG_SPAN:\`; @@ -1246,7 +1246,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_5788821996131681377$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@5788821996131681377: My i18n block #$` + + $I18N_1$ = $localize \` My i18n block #$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: $` + String.raw `{"[\uFFFD#6\uFFFD|\uFFFD#7\uFFFD]"}:START_TAG_DIV:$` + String.raw `{"[\uFFFD#6\uFFFD|\uFFFD#7\uFFFD]"}:START_TAG_DIV:$` + String.raw @@ -1317,7 +1317,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_4782264005467235841$$APP_SPEC_TS_3$; } else { - $I18N_2$ = $localize \`:@@4782264005467235841:Span title $` + + $I18N_2$ = $localize \`Span title $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: and $` + String.raw `{"\uFFFD1\uFFFD"}:INTERPOLATION_1:\`; } @@ -1332,7 +1332,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_4446430594603971069$$APP_SPEC_TS_5$; } else { - $I18N_0$ = $localize \`:@@4446430594603971069: My i18n block #1 with value: $` + + $I18N_0$ = $localize \` My i18n block #1 with value: $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: $` + String.raw `{"\uFFFD#2\uFFFD"}:START_TAG_SPAN: Plain text in nested element (block #1) $` + String.raw `{"\uFFFD/#2\uFFFD"}:CLOSE_TAG_SPAN:\`; @@ -1345,7 +1345,7 @@ describe('i18n support in the template compiler', () => { $I18N_7$ = $MSG_EXTERNAL_2719594642740200058$$APP_SPEC_TS_8$; } else { - $I18N_7$ = $localize \`:@@2719594642740200058:Span title $` + + $I18N_7$ = $localize \`Span title $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } const $_c9$ = ["title", $I18N_7$]; @@ -1359,7 +1359,7 @@ describe('i18n support in the template compiler', () => { $I18N_6$ = $MSG_EXTERNAL_2778714953278357902$$APP_SPEC_TS_10$; } else { - $I18N_6$ = $localize \`:@@2778714953278357902: My i18n block #2 with value $` + + $I18N_6$ = $localize \` My i18n block #2 with value $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: $` + String.raw `{"\uFFFD#7\uFFFD"}:START_TAG_SPAN: Plain text in nested element (block #2) $` + String.raw `{"\uFFFD/#7\uFFFD"}:CLOSE_TAG_SPAN:\`; @@ -1429,7 +1429,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_7679414751795588050$$APP_SPEC_TS__1$; } else { - $I18N_1$ = $localize \`:@@7679414751795588050: Some other content $` + + $I18N_1$ = $localize \` Some other content $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION: $` + String.raw `{"\uFFFD#3\uFFFD"}:START_TAG_DIV: More nested levels with bindings $` + String.raw `{"\uFFFD1\uFFFD"}:INTERPOLATION_1: $` + @@ -1498,7 +1498,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_2367729185105559721$$APP_SPEC_TS__2$; } else { - $I18N_2$ = $localize \`:@@2367729185105559721:App logo #$` + + $I18N_2$ = $localize \`App logo #$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } const $_c4$ = ["title", $I18N_2$]; @@ -1613,7 +1613,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_1221890473527419724$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@1221890473527419724: Some content $` + + $I18N_0$ = $localize \` Some content $` + String.raw `{"\uFFFD*2:1\uFFFD\uFFFD#1:1\uFFFD"}:START_TAG_DIV_2: Some other content $` + String.raw `{"\uFFFD0:1\uFFFD"}:INTERPOLATION: $` + String.raw @@ -1696,7 +1696,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_119975189388320493$$APP_SPEC_TS__1$; } else { - $I18N_1$ = $localize \`:@@119975189388320493:Some other content $` + + $I18N_1$ = $localize \`Some other content $` + String.raw `{"\uFFFD#2\uFFFD"}:START_TAG_SPAN:$` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:$` + String.raw `{"\uFFFD/#2\uFFFD"}:CLOSE_TAG_SPAN:\`; @@ -1745,7 +1745,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_APP_SPEC_TS_2$; } else { - $I18N_1$ = $localize \`:@@3902961887793684628:Hello\`; + $I18N_1$ = $localize \`Hello\`; } … template: function MyComponent_Template(rf, ctx) { @@ -1775,7 +1775,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_4890179241114413722$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@4890179241114413722:My i18n block #1\`; + $I18N_0$ = $localize \`My i18n block #1\`; } … template: function MyComponent_Template(rf, ctx) { @@ -1802,7 +1802,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_8806993169187953163$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@8806993169187953163:{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -1839,7 +1839,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_2413150872298537152$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@2413150872298537152:My i18n block #2\`; + $I18N_0$ = $localize \`My i18n block #2\`; } var $I18N_1$; if (ngI18nClosureMode) { @@ -1847,7 +1847,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_4890179241114413722$$APP_SPEC_TS__1$; } else { - $I18N_1$ = $localize \`:@@4890179241114413722:My i18n block #1\`; + $I18N_1$ = $localize \`My i18n block #1\`; } function MyComponent_ng_template_0_Template(rf, ctx) { if (rf & 1) { @@ -1882,7 +1882,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_5295701706185791735$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@5295701706185791735:Text #1\`; + $I18N_1$ = $localize \`Text #1\`; } const $_c2$ = [${AttributeMarker.Styles}, "padding", "10px"]; var $I18N_3$; @@ -1891,7 +1891,7 @@ describe('i18n support in the template compiler', () => { $I18N_3$ = $MSG_EXTERNAL_4722270221386399294$$APP_SPEC_TS_3$; } else { - $I18N_3$ = $localize \`:@@4722270221386399294:Text #2\`; + $I18N_3$ = $localize \`Text #2\`; } … consts: 4, @@ -1927,7 +1927,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_355394464191978948$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@355394464191978948:Some content: $` + + $I18N_0$ = $localize \`Some content: $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } … @@ -1964,7 +1964,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_355394464191978948$$APP_SPEC_TS__0$; } else { - $I18N_0$ = $localize \`:@@355394464191978948:Some content: $` + + $I18N_0$ = $localize \`Some content: $` + String.raw `{"\uFFFD0\uFFFD"}:INTERPOLATION:\`; } function MyComponent_ng_template_0_Template(rf, ctx) { @@ -2012,7 +2012,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_702706566400598764$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@702706566400598764:$` + + $I18N_0$ = $localize \`$` + String.raw `{"\uFFFD*2:1\uFFFD"}:START_TAG_NG_TEMPLATE:Template content: $` + String.raw `{"\uFFFD0:1\uFFFD"}:INTERPOLATION:$` + String.raw `{"\uFFFD/*2:1\uFFFD"}:CLOSE_TAG_NG_TEMPLATE:$` + @@ -2067,7 +2067,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_8806993169187953163$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@8806993169187953163:{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2078,7 +2078,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_7842238767399919809$$APP_SPEC_TS__1$; } else { - $I18N_1$ = $localize \`:@@7842238767399919809:{VAR_SELECT, select, male {male} female {female} other {other}}\`; + $I18N_1$ = $localize \`{VAR_SELECT, select, male {male} female {female} other {other}}\`; } $I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2163,7 +2163,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_2051477021417799640$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@2051477021417799640:$` + + $I18N_0$ = $localize \`$` + String.raw `{"[\uFFFD*2:1\uFFFD|\uFFFD*2:2\uFFFD|\uFFFD*1:3\uFFFD]"}:START_TAG_NG_TEMPLATE: Template A: $` + String.raw `{"\uFFFD0:1\uFFFD"}:INTERPOLATION: $` + String.raw @@ -2221,7 +2221,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_7842238767399919809$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@7842238767399919809:{VAR_SELECT, select, male {male} female {female} other {other}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, male {male} female {female} other {other}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2232,7 +2232,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_8806993169187953163$$APP_SPEC_TS__1$; } else { - $I18N_1$ = $localize \`:@@8806993169187953163:{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; + $I18N_1$ = $localize \`{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; } $I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2287,7 +2287,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_4891196282781544695$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@4891196282781544695:$` + + $I18N_0$ = $localize \`$` + String.raw `{"\uFFFD#2\uFFFD\uFFFD/#2\uFFFD"}:TAG_IMG: is my logo #1 \`; } var $I18N_2$; @@ -2298,7 +2298,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_461986953980355147$$APP_SPEC_TS__2$; } else { - $I18N_2$ = $localize \`:@@461986953980355147:$` + + $I18N_2$ = $localize \`$` + String.raw `{"\uFFFD#1\uFFFD\uFFFD/#1\uFFFD"}:TAG_IMG: is my logo #2 \`; } function MyComponent_ng_template_3_Template(rf, ctx) { @@ -2344,7 +2344,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_8537814667662432133$$APP_SPEC_TS__0$; } else { - $I18N_0$ = $localize \`:@@8537814667662432133: Root content $` + + $I18N_0$ = $localize \` Root content $` + String.raw `{"\uFFFD*1:1\uFFFD\uFFFD#1:1\uFFFD"}:START_TAG_NG_CONTAINER: Nested content $` + String.raw `{"\uFFFD/#1:1\uFFFD\uFFFD/*1:1\uFFFD"}:CLOSE_TAG_NG_CONTAINER:\`; @@ -2371,7 +2371,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_6563391987554512024$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@6563391987554512024:Test\`; + $I18N_0$ = $localize \`Test\`; } var $I18N_1$; if (ngI18nClosureMode) { @@ -2379,7 +2379,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_6563391987554512024$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@6563391987554512024:Test\`; + $I18N_1$ = $localize \`Test\`; } … `; @@ -2401,7 +2401,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_APP_SPEC_TS_1$; } else { - $I18N_0$ = $localize \`:@@161173306924314453: Hello $` + + $I18N_0$ = $localize \` Hello $` + String.raw `{"\uFFFD#2\uFFFD"}:START_TAG_NG_CONTAINER:there$` + String.raw `{"\uFFFD/#2\uFFFD"}:CLOSE_TAG_NG_CONTAINER:\`; } @@ -2437,7 +2437,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_APP_SPEC_TS_1$; } else { - $I18N_0$ = $localize \`:@@1968828034476446869: Hello $` + + $I18N_0$ = $localize \` Hello $` + String.raw `{"\uFFFD#2\uFFFD"}:START_TAG_NG_CONTAINER:there $` + String.raw `{"\uFFFD#3\uFFFD"}:START_TAG_STRONG:!$` + String.raw `{"\uFFFD/#3\uFFFD"}:CLOSE_TAG_STRONG:$` + @@ -2477,7 +2477,7 @@ describe('i18n support in the template compiler', () => { const $MSG_EXTERNAL_3308216566145348998$$APP_SPEC_TS___2$ = goog.getMsg("Content A"); $I18N_1$ = $MSG_EXTERNAL_3308216566145348998$$APP_SPEC_TS___2$; } else { - $I18N_1$ = $localize \`:@@3308216566145348998:Content A\`; + $I18N_1$ = $localize \`Content A\`; } function MyComponent_0_ng_template_0_Template(rf, ctx) { if (rf & 1) { @@ -2494,7 +2494,7 @@ describe('i18n support in the template compiler', () => { const $MSG_EXTERNAL_8349021389088127654$$APP_SPEC_TS__4$ = goog.getMsg("Content B"); $I18N_3$ = $MSG_EXTERNAL_8349021389088127654$$APP_SPEC_TS__4$; } else { - $I18N_3$ = $localize \`:@@8349021389088127654:Content B\`; + $I18N_3$ = $localize \`Content B\`; } function MyComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) { @@ -2541,7 +2541,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_963542717423364282$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@963542717423364282:\n Some text\n $` + + $I18N_0$ = $localize \`\n Some text\n $` + String.raw `{"\uFFFD#3\uFFFD"}:START_TAG_SPAN:Text inside span$` + String.raw `{"\uFFFD/#3\uFFFD"}:CLOSE_TAG_SPAN:\n \`; } @@ -2576,7 +2576,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_7842238767399919809$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@7842238767399919809:{VAR_SELECT, select, male {male} female {female} other {other}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, male {male} female {female} other {other}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2612,7 +2612,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_4166854826696768832$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@4166854826696768832:{VAR_SELECT, select, single {'single quotes'} double {"double quotes"} other {other}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, single {'single quotes'} double {"double quotes"} other {other}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2634,7 +2634,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_8806993169187953163$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@8806993169187953163:{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2674,7 +2674,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_7842238767399919809$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@7842238767399919809:{VAR_SELECT, select, male {male} female {female} other {other}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, male {male} female {female} other {other}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2688,7 +2688,7 @@ describe('i18n support in the template compiler', () => { $I18N_3$ = $MSG_EXTERNAL_8806993169187953163$$APP_SPEC_TS__3$; } else { - $I18N_3$ = $localize \`:@@8806993169187953163:{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; + $I18N_3$ = $localize \`{VAR_SELECT, select, 10 {ten} 20 {twenty} other {other}}\`; } $I18N_3$ = $r3$.ɵɵi18nPostprocess($I18N_3$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2714,7 +2714,7 @@ describe('i18n support in the template compiler', () => { $I18N_5$ = $MSG_EXTERNAL_1922743304863699161$$APP_SPEC_TS__5$; } else { - $I18N_5$ = $localize \`:@@1922743304863699161:{VAR_SELECT, select, 0 {no emails} 1 {one email} other {{INTERPOLATION} emails}}\`; + $I18N_5$ = $localize \`{VAR_SELECT, select, 0 {no emails} 1 {one email} other {{INTERPOLATION} emails}}\`; } $I18N_5$ = $r3$.ɵɵi18nPostprocess($I18N_5$, { "VAR_SELECT": "\uFFFD0\uFFFD", @@ -2771,7 +2771,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_2949673783721159566$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@2949673783721159566:{VAR_SELECT, select, 10 {ten} 20 {twenty} other {{INTERPOLATION}}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, 10 {ten} 20 {twenty} other {{INTERPOLATION}}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD", @@ -2810,7 +2810,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_2417296354340576868$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@2417296354340576868:{VAR_SELECT, select, male {male - {START_BOLD_TEXT}male{CLOSE_BOLD_TEXT}} female {female {START_BOLD_TEXT}female{CLOSE_BOLD_TEXT}} other {{START_TAG_DIV}{START_ITALIC_TEXT}other{CLOSE_ITALIC_TEXT}{CLOSE_TAG_DIV}}}\`; + $I18N_1$ = $localize \`{VAR_SELECT, select, male {male - {START_BOLD_TEXT}male{CLOSE_BOLD_TEXT}} female {female {START_BOLD_TEXT}female{CLOSE_BOLD_TEXT}} other {{START_TAG_DIV}{START_ITALIC_TEXT}other{CLOSE_ITALIC_TEXT}{CLOSE_TAG_DIV}}}\`; } $I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$, { "VAR_SELECT": "\uFFFD0\uFFFD", @@ -2836,7 +2836,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_5791551881115084301$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@5791551881115084301: $` + + $I18N_0$ = $localize \` $` + String.raw `{$I18N_1$}:ICU: $` + String.raw `{"\uFFFD#2\uFFFD"}:START_BOLD_TEXT:Other content$` + String.raw `{"\uFFFD/#2\uFFFD"}:CLOSE_BOLD_TEXT:$` + @@ -2881,7 +2881,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_6879461626778511059$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@6879461626778511059:{VAR_SELECT, select, male {male of age: {INTERPOLATION}} female {female} other {other}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, male {male of age: {INTERPOLATION}} female {female} other {other}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD", @@ -2921,7 +2921,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_7842238767399919809$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@7842238767399919809:{VAR_SELECT, select, male {male} female {female} other {other}}\`; + $I18N_1$ = $localize \`{VAR_SELECT, select, male {male} female {female} other {other}}\`; } $I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2932,7 +2932,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_EXTERNAL_7068143081688428291$$APP_SPEC_TS_2$; } else { - $I18N_2$ = $localize \`:@@7068143081688428291:{VAR_SELECT, select, 10 {ten} 20 {twenty} 30 {thirty} other {other}}\`; + $I18N_2$ = $localize \`{VAR_SELECT, select, 10 {ten} 20 {twenty} 30 {thirty} other {other}}\`; } $I18N_2$ = $r3$.ɵɵi18nPostprocess($I18N_2$, { "VAR_SELECT": "\uFFFD1\uFFFD" @@ -2946,7 +2946,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_2967249209167308918$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@2967249209167308918: $` + + $I18N_0$ = $localize \` $` + String.raw `{$I18N_1$}:ICU: $` + String.raw `{$I18N_2$}:ICU_1: \`; } … @@ -2988,7 +2988,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@7842238767399919809:{VAR_SELECT, select, male {male} female {female} other {other}}\`; + $I18N_1$ = $localize \`{VAR_SELECT, select, male {male} female {female} other {other}}\`; } $I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -2999,7 +2999,7 @@ describe('i18n support in the template compiler', () => { $I18N_2$ = $MSG_APP_SPEC_TS_2$; } else { - $I18N_2$ = $localize \`:@@7842238767399919809:{VAR_SELECT, select, male {male} female {female} other {other}}\`; + $I18N_2$ = $localize \`{VAR_SELECT, select, male {male} female {female} other {other}}\`; } $I18N_2$ = $r3$.ɵɵi18nPostprocess($I18N_2$, { "VAR_SELECT": "\uFFFD1\uFFFD" @@ -3011,7 +3011,7 @@ describe('i18n support in the template compiler', () => { $I18N_4$ = $MSG_APP_SPEC_TS__4$; } else { - $I18N_4$ = $localize \`:@@7842238767399919809:{VAR_SELECT, select, male {male} female {female} other {other}}\`; + $I18N_4$ = $localize \`{VAR_SELECT, select, male {male} female {female} other {other}}\`; } $I18N_4$ = $r3$.ɵɵi18nPostprocess($I18N_4$, { "VAR_SELECT": "\uFFFD0:1\uFFFD" @@ -3027,7 +3027,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@7986645988117050801: $` + + $I18N_0$ = $localize \` $` + String.raw `{"\uFFFDI18N_EXP_ICU\uFFFD"}:ICU: $` + String.raw `{"\uFFFD#2\uFFFD"}:START_TAG_DIV: $` + String.raw `{"\uFFFDI18N_EXP_ICU\uFFFD"}:ICU: $` + String.raw @@ -3096,7 +3096,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_343563413083115114$$APP_SPEC_TS_0$; } else { - $I18N_1$ = $localize \`:@@343563413083115114:{VAR_SELECT_1, select, male {male of age: {VAR_SELECT, select, 10 {ten} 20 {twenty} 30 {thirty} other {other}}} female {female} other {other}}\`; + $I18N_1$ = $localize \`{VAR_SELECT_1, select, male {male of age: {VAR_SELECT, select, 10 {ten} 20 {twenty} 30 {thirty} other {other}}} female {female} other {other}}\`; } $I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$, { "VAR_SELECT": "\uFFFD0\uFFFD", @@ -3108,7 +3108,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_3052001905251380936$$APP_SPEC_TS_3$; } else { - $I18N_0$ = $localize \`:@@3052001905251380936: $` + + $I18N_0$ = $localize \` $` + String.raw `{$I18N_1$}:ICU: \`; } … consts: 2, @@ -3151,7 +3151,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_6870293071705078389$$APP_SPEC_TS_1$; } else { - $I18N_0$ = $localize \`:@@6870293071705078389:{VAR_PLURAL, plural, =0 {zero} =2 {{INTERPOLATION} {VAR_SELECT, select, cat {cats} dog {dogs} other {animals}} !} other {other - {INTERPOLATION}}}\`; + $I18N_0$ = $localize \`{VAR_PLURAL, plural, =0 {zero} =2 {{INTERPOLATION} {VAR_SELECT, select, cat {cats} dog {dogs} other {animals}} !} other {other - {INTERPOLATION}}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD", @@ -3194,7 +3194,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_7842238767399919809$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@7842238767399919809:{VAR_SELECT, select, male {male} female {female} other {other}}\`; + $I18N_1$ = $localize \`{VAR_SELECT, select, male {male} female {female} other {other}}\`; } $I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$, { "VAR_SELECT": "\uFFFD0\uFFFD" @@ -3206,7 +3206,7 @@ describe('i18n support in the template compiler', () => { $I18N_3$ = $MSG_EXTERNAL_7068143081688428291$$APP_SPEC_TS__3$; } else { - $I18N_3$ = $localize \`:@@7068143081688428291:{VAR_SELECT, select, 10 {ten} 20 {twenty} 30 {thirty} other {other}}\`; + $I18N_3$ = $localize \`{VAR_SELECT, select, 10 {ten} 20 {twenty} 30 {thirty} other {other}}\`; } $I18N_3$ = $r3$.ɵɵi18nPostprocess($I18N_3$, { "VAR_SELECT": "\uFFFD0:1\uFFFD" @@ -3222,7 +3222,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_1194472282609532229$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@1194472282609532229: $` + + $I18N_0$ = $localize \` $` + String.raw `{$I18N_1$}:ICU: $` + String.raw `{"\uFFFD*2:1\uFFFD\uFFFD#1:1\uFFFD"}:START_TAG_SPAN: $` + String.raw `{$I18N_3$}:ICU_1: $` + @@ -3280,7 +3280,7 @@ describe('i18n support in the template compiler', () => { $I18N_1$ = $MSG_EXTERNAL_7825031864601787094$$APP_SPEC_TS_1$; } else { - $I18N_1$ = $localize \`:@@7825031864601787094:{VAR_SELECT, select, male {male {INTERPOLATION}} female {female {INTERPOLATION_1}} other {other}}\`; + $I18N_1$ = $localize \`{VAR_SELECT, select, male {male {INTERPOLATION}} female {female {INTERPOLATION_1}} other {other}}\`; } $I18N_1$ = $r3$.ɵɵi18nPostprocess($I18N_1$, { "VAR_SELECT": "\uFFFD0\uFFFD", @@ -3294,7 +3294,7 @@ describe('i18n support in the template compiler', () => { $I18N_4$ = $MSG_EXTERNAL_2310343208266678305$$APP_SPEC_TS__3$; } else { - $I18N_4$ = $localize \`:@@2310343208266678305:{VAR_SELECT, select, 10 {ten} 20 {twenty} 30 {thirty} other {other: {INTERPOLATION}}}\`; + $I18N_4$ = $localize \`{VAR_SELECT, select, 10 {ten} 20 {twenty} 30 {thirty} other {other: {INTERPOLATION}}}\`; } $I18N_4$ = $r3$.ɵɵi18nPostprocess($I18N_4$, { "VAR_SELECT": "\uFFFD0:1\uFFFD", @@ -3311,7 +3311,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_7186042105600518133$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@7186042105600518133: $` + + $I18N_0$ = $localize \` $` + String.raw `{I18N_1}:ICU: $` + String.raw `{"\uFFFD*2:1\uFFFD\uFFFD#1:1\uFFFD"}:START_TAG_SPAN: $` + String.raw `{I18N_4}:ICU_1: $` + @@ -3370,7 +3370,7 @@ describe('i18n support in the template compiler', () => { $I18N_0$ = $MSG_EXTERNAL_6318060397235942326$$APP_SPEC_TS_0$; } else { - $I18N_0$ = $localize \`:@@6318060397235942326:{VAR_SELECT, select, male {male {PH_A}} female {female {PH_B}} other {other {PH_WITH_SPACES}}}\`; + $I18N_0$ = $localize \`{VAR_SELECT, select, male {male {PH_A}} female {female {PH_B}} other {other {PH_WITH_SPACES}}}\`; } $I18N_0$ = $r3$.ɵɵi18nPostprocess($I18N_0$, { "VAR_SELECT": "\uFFFD0\uFFFD", diff --git a/packages/compiler/src/i18n/digest.ts b/packages/compiler/src/i18n/digest.ts index 459461715d..6c735e2a20 100644 --- a/packages/compiler/src/i18n/digest.ts +++ b/packages/compiler/src/i18n/digest.ts @@ -157,7 +157,7 @@ export function fingerprint(str: string): [number, number] { return [hi, lo]; } -export function computeMsgId(msg: string, meaning: string): string { +export function computeMsgId(msg: string, meaning: string = ''): string { let [hi, lo] = fingerprint(msg); if (meaning) { diff --git a/packages/compiler/src/i18n/i18n_ast.ts b/packages/compiler/src/i18n/i18n_ast.ts index 02ddf74733..03663ab030 100644 --- a/packages/compiler/src/i18n/i18n_ast.ts +++ b/packages/compiler/src/i18n/i18n_ast.ts @@ -10,6 +10,7 @@ import {ParseSourceSpan} from '../parse_util'; export class Message { sources: MessageSpan[]; + id: string = this.customId; /** * @param nodes message AST @@ -22,7 +23,7 @@ export class Message { constructor( public nodes: Node[], public placeholders: {[phName: string]: string}, public placeholderToMessage: {[phName: string]: Message}, public meaning: string, - public description: string, public id: string) { + public description: string, public customId: string) { if (nodes.length) { this.sources = [{ filePath: nodes[0].sourceSpan.start.file.url, diff --git a/packages/compiler/src/render3/view/i18n/meta.ts b/packages/compiler/src/render3/view/i18n/meta.ts index f627d846b0..1b14d4b8b8 100644 --- a/packages/compiler/src/render3/view/i18n/meta.ts +++ b/packages/compiler/src/render3/view/i18n/meta.ts @@ -18,6 +18,7 @@ import {I18N_ATTR, I18N_ATTR_PREFIX, hasI18nAttrs, icuFromI18nMessage} from './u export type I18nMeta = { id?: string, + customId?: string, description?: string, meaning?: string }; @@ -47,7 +48,7 @@ export class I18nMetaVisitor implements html.Visitor { const parsed: I18nMeta = typeof meta === 'string' ? parseI18nMeta(meta) : metaFromI18nMessage(meta as i18n.Message); const message = this._createI18nMessage( - nodes, parsed.meaning || '', parsed.description || '', parsed.id || '', visitNodeFn); + nodes, parsed.meaning || '', parsed.description || '', parsed.customId || '', visitNodeFn); if (!message.id) { // generate (or restore) message id if not specified in template message.id = typeof meta !== 'string' && (meta as i18n.Message).id || decimalDigest(message); @@ -140,6 +141,7 @@ export function processI18nMeta( export function metaFromI18nMessage(message: i18n.Message, id: string | null = null): I18nMeta { return { id: typeof id === 'string' ? id : message.id || '', + customId: message.customId, meaning: message.meaning || '', description: message.description || '' }; @@ -160,7 +162,7 @@ const I18N_ID_SEPARATOR = '@@'; * @returns Object with id, meaning and description fields */ export function parseI18nMeta(meta?: string): I18nMeta { - let id: string|undefined; + let customId: string|undefined; let meaning: string|undefined; let description: string|undefined; @@ -168,14 +170,14 @@ export function parseI18nMeta(meta?: string): I18nMeta { const idIndex = meta.indexOf(I18N_ID_SEPARATOR); const descIndex = meta.indexOf(I18N_MEANING_SEPARATOR); let meaningAndDesc: string; - [meaningAndDesc, id] = + [meaningAndDesc, customId] = (idIndex > -1) ? [meta.slice(0, idIndex), meta.slice(idIndex + 2)] : [meta, '']; [meaning, description] = (descIndex > -1) ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] : ['', meaningAndDesc]; } - return {id, meaning, description}; + return {customId, meaning, description}; } /** @@ -190,8 +192,8 @@ export function serializeI18nHead(meta: I18nMeta, messagePart: string): string { if (meta.meaning) { metaBlock = `${meta.meaning}|${metaBlock}`; } - if (meta.id) { - metaBlock = `${metaBlock}@@${meta.id}`; + if (meta.customId) { + metaBlock = `${metaBlock}@@${meta.customId}`; } if (metaBlock === '') { // There is no metaBlock, so we must ensure that any starting colon is escaped. diff --git a/packages/compiler/test/i18n/digest_spec.ts b/packages/compiler/test/i18n/digest_spec.ts index 22bd7b6eb6..9cb788efac 100644 --- a/packages/compiler/test/i18n/digest_spec.ts +++ b/packages/compiler/test/i18n/digest_spec.ts @@ -20,6 +20,7 @@ import {computeMsgId, digest, sha1} from '../../src/i18n/digest'; meaning: '', description: '', sources: [], + customId: 'i', })).toEqual('i'); }); }); diff --git a/packages/compiler/test/render3/view/i18n_spec.ts b/packages/compiler/test/render3/view/i18n_spec.ts index 6e06ef9e50..c69ad86693 100644 --- a/packages/compiler/test/render3/view/i18n_spec.ts +++ b/packages/compiler/test/render3/view/i18n_spec.ts @@ -241,8 +241,8 @@ describe('Utils', () => { expect(serializeI18nTemplatePart('abc', ':message')).toEqual(':abc::message'); }); - function meta(id?: string, meaning?: string, description?: string): I18nMeta { - return {id, meaning, description}; + function meta(customId?: string, meaning?: string, description?: string): I18nMeta { + return {customId, meaning, description}; } }); }); diff --git a/packages/core/test/acceptance/i18n_spec.ts b/packages/core/test/acceptance/i18n_spec.ts index 8c2972d326..fc7cd220e8 100644 --- a/packages/core/test/acceptance/i18n_spec.ts +++ b/packages/core/test/acceptance/i18n_spec.ts @@ -13,10 +13,11 @@ import localeRo from '@angular/common/locales/ro'; import {Component, ContentChild, ContentChildren, Directive, HostBinding, Input, LOCALE_ID, QueryList, TemplateRef, Type, ViewChild, ViewContainerRef, Pipe, PipeTransform} from '@angular/core'; import {setDelayProjection} from '@angular/core/src/render3/instructions/projection'; import {TestBed} from '@angular/core/testing'; -import {loadTranslations} from '@angular/localize'; +import {loadTranslations, clearTranslations} from '@angular/localize'; import {By} from '@angular/platform-browser'; import {expect} from '@angular/platform-browser/testing/src/matchers'; import {onlyInIvy} from '@angular/private/testing'; +import {computeMsgId} from '@angular/compiler'; onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => { @@ -24,16 +25,19 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => { TestBed.configureTestingModule({declarations: [AppComp, DirectiveWithTplRef, UppercasePipe]}); }); - afterEach(() => { setDelayProjection(false); }); + afterEach(() => { + setDelayProjection(false); + clearTranslations(); + }); it('should translate text', () => { - loadTranslations({'3667842621564887364': 'texte'}); + loadTranslations({[computeMsgId('text')]: 'texte'}); const fixture = initWithTemplate(AppComp, `
`;
const fixture = initWithTemplate(AppComp, `
`);
@@ -1007,6 +1117,7 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
});
it('should apply i18n attributes during second template pass', () => {
+ loadTranslations({[computeMsgId('Set')]: 'Set'});
@Directive({
selector: '[test]',
inputs: ['test'],
@@ -1044,13 +1155,13 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
it('with complex expressions', () => {
loadTranslations({
- '305276527729153743': '{$INTERPOLATION} - {$INTERPOLATION_1} - {$INTERPOLATION_2} (fr)'
+ [computeMsgId('{$INTERPOLATION} - {$INTERPOLATION_1} - {$INTERPOLATION_2}')]:
+ '{$INTERPOLATION} - {$INTERPOLATION_1} - {$INTERPOLATION_2} (fr)'
});
const fixture = initWithTemplate(AppComp, `
`);
- // the `obj` field is not yet defined, so 2nd and 3rd interpolations return empty
- // strings
+ // the `obj` field is not yet defined, so 2nd and 3rd interpolations return empty strings
expect(fixture.nativeElement.firstChild.title).toEqual(`ANGULAR - - (fr)`);
fixture.componentRef.instance.obj = {
@@ -1092,10 +1203,12 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
TestBed.configureTestingModule({declarations: [ClsDir, MyApp]});
loadTranslations({
// Note that this translation switches the order of the expressions!
- '2244013204777604001': 'début {$INTERPOLATION_1} milieu {$INTERPOLATION} fin',
- '7297507129788731971':
+ [computeMsgId('start {$INTERPOLATION} middle {$INTERPOLATION_1} end')]:
+ 'début {$INTERPOLATION_1} milieu {$INTERPOLATION} fin',
+ [computeMsgId(
+ '{VAR_PLURAL, plural, =0 {no {START_BOLD_TEXT}emails{CLOSE_BOLD_TEXT}!} =1 {one {START_ITALIC_TEXT}email{CLOSE_ITALIC_TEXT}} other {{INTERPOLATION} emails}}')]:
'{VAR_PLURAL, plural, =0 {aucun {START_BOLD_TEXT}email{CLOSE_BOLD_TEXT}!} =1 {un {START_ITALIC_TEXT}email{CLOSE_ITALIC_TEXT}} other {{INTERPOLATION} emails}}',
- '7694415136422535717': ' traduction: {$ICU} '
+ [computeMsgId(' trad: {$ICU} ')]: ' traduction: {$ICU} '
});
const fixture = TestBed.createComponent(MyApp);
fixture.detectChanges();
@@ -1138,8 +1251,8 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
TestBed.configureTestingModule({declarations: [AppComp, MyComp]});
loadTranslations({
- '3299467052279745802': 'Bonjour {$INTERPOLATION}',
- '694232821652669635': 'fonctionne',
+ [computeMsgId('Hello {$INTERPOLATION}')]: 'Bonjour {$INTERPOLATION}',
+ [computeMsgId('works')]: 'fonctionne',
});
const fixture = initWithTemplate(
AppComp,
@@ -1155,8 +1268,19 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
it('should support adding/moving/removing nodes', () => {
loadTranslations({
- '3934630822967503512':
- '{$START_TAG_DIV2}{$CLOSE_TAG_DIV2}{$START_TAG_DIV8}{$CLOSE_TAG_DIV8}{$START_TAG_DIV4}{$CLOSE_TAG_DIV4}{$START_TAG_DIV5}{$CLOSE_TAG_DIV5}Bonjour monde{$START_TAG_DIV3}{$CLOSE_TAG_DIV3}{$START_TAG_DIV7}{$CLOSE_TAG_DIV7}'
+ [computeMsgId(
+ '{$START_TAG_DIV2}{$CLOSE_TAG_DIV2}' +
+ '{$START_TAG_DIV3}{$CLOSE_TAG_DIV3}' +
+ '{$START_TAG_DIV4}{$CLOSE_TAG_DIV4}' +
+ '{$START_TAG_DIV5}{$CLOSE_TAG_DIV5}' +
+ '{$START_TAG_DIV6}{$CLOSE_TAG_DIV6}' +
+ '{$START_TAG_DIV7}{$CLOSE_TAG_DIV7}' +
+ '{$START_TAG_DIV8}{$CLOSE_TAG_DIV8}')]: '{$START_TAG_DIV2}{$CLOSE_TAG_DIV2}' +
+ '{$START_TAG_DIV8}{$CLOSE_TAG_DIV8}' +
+ '{$START_TAG_DIV4}{$CLOSE_TAG_DIV4}' +
+ '{$START_TAG_DIV5}{$CLOSE_TAG_DIV5}Bonjour monde' +
+ '{$START_TAG_DIV3}{$CLOSE_TAG_DIV3}' +
+ '{$START_TAG_DIV7}{$CLOSE_TAG_DIV7}'
});
const fixture = initWithTemplate(AppComp, `