diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/TEST_CASES.json b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/TEST_CASES.json index 03adc3f01bf..fbdb17762e3 100644 --- a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/TEST_CASES.json +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/TEST_CASES.json @@ -231,6 +231,20 @@ ] } ] + }, + { + "description": "should handle ICUs with element tags, as the root message", + "inputFiles": [ + "icu_root.ts" + ], + "expectations": [ + { + "extraChecks": [ + "verifyPlaceholdersIntegrity", + "verifyUniqueConsts" + ] + } + ] } ] } diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/icu_root.js b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/icu_root.js new file mode 100644 index 00000000000..b4a4cdf92e3 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/icu_root.js @@ -0,0 +1,45 @@ +consts: () => { + let i18n_0; + if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) { + /** + * @desc someText1 + */ + const MSG_EXTERNAL_4505060179465988919$$ICU_WHITESPACE_TS_1 = goog.getMsg("{VAR_SELECT, select, WEBSITE {{START_TAG_STRONG}someText{CLOSE_TAG_STRONG}\n }}"); + i18n_0 = MSG_EXTERNAL_4505060179465988919$$ICU_WHITESPACE_TS_1; + } else { + … + } i18n_0 = i0.ɵɵi18nPostprocess(i18n_0, { "CLOSE_TAG_STRONG": "", "START_TAG_STRONG": "", "VAR_SELECT": "\uFFFD0\uFFFD" }); + let i18n_2; + if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) { + /** + * @suppress {msgDescriptions} + */ + const MSG_EXTERNAL_4505060179465988919$$ICU_WHITESPACE_TS_3 = goog.getMsg("{VAR_SELECT, select, WEBSITE {{START_TAG_STRONG}someText{CLOSE_TAG_STRONG}\n }}"); + i18n_2 = MSG_EXTERNAL_4505060179465988919$$ICU_WHITESPACE_TS_3; + } else { + … + } + i18n_2 = i0.ɵɵi18nPostprocess(i18n_2, { "CLOSE_TAG_STRONG": "", "START_TAG_STRONG": "", "VAR_SELECT": "\uFFFD0\uFFFD" }); + return [i18n_0, i18n_2]; +} +… + +function MyComponent_Template(rf, ctx) { + if (rf & 1) { + i0.ɵɵelementStart(0, "span"); + i0.ɵɵi18n(1, 0); + i0.ɵɵelementEnd(); + i0.ɵɵelementStart(2, "span"); + i0.ɵɵtext(3, " "); + i0.ɵɵi18n(4, 1); + i0.ɵɵtext(5, " "); + i0.ɵɵelementEnd(); + } if (rf & 2) { + i0.ɵɵadvance(1); + i0.ɵɵi18nExp(ctx.someField); + i0.ɵɵi18nApply(1); + i0.ɵɵadvance(3); + i0.ɵɵi18nExp(ctx.someField); + i0.ɵɵi18nApply(4); + } +} \ No newline at end of file diff --git a/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/icu_root.ts b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/icu_root.ts new file mode 100644 index 00000000000..c119ea331f1 --- /dev/null +++ b/packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_i18n/icu_logic/icu_root.ts @@ -0,0 +1,28 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'my-component', + standalone: true, + template: ` + { + someField, + select, + WEBSITE { + someText + } + } + + + { + someField, + select, + WEBSITE { + someText + } + } + +`, +}) +export class MyComponent { + someField!: any; +} \ No newline at end of file