diff --git a/packages/compiler/src/ml_parser/lexer.ts b/packages/compiler/src/ml_parser/lexer.ts
index 672eccce5d..8257f89929 100644
--- a/packages/compiler/src/ml_parser/lexer.ts
+++ b/packages/compiler/src/ml_parser/lexer.ts
@@ -684,7 +684,7 @@ function isExpansionFormStart(
}
function isExpansionCaseStart(peek: number): boolean {
- return peek === chars.$EQ || chars.isAsciiLetter(peek);
+ return peek === chars.$EQ || chars.isAsciiLetter(peek) || chars.isDigit(peek);
}
function compareCharCodeCaseInsensitive(code1: number, code2: number): boolean {
diff --git a/packages/compiler/test/i18n/integration_common.ts b/packages/compiler/test/i18n/integration_common.ts
index 1ce8b3503d..bb612e5783 100644
--- a/packages/compiler/test/i18n/integration_common.ts
+++ b/packages/compiler/test/i18n/integration_common.ts
@@ -78,6 +78,9 @@ export function validateHtml(
cmp.sex = 'f';
tb.detectChanges();
expect(el.query(By.css('#i18n-8')).nativeElement).toHaveText('femme');
+ cmp.sex = '0';
+ tb.detectChanges();
+ expect(el.query(By.css('#i18n-8')).nativeElement).toHaveText('autre');
cmp.count = 123;
tb.detectChanges();
@@ -121,7 +124,7 @@ export const HTML = `
{count, plural, =0 {zero} =1 {one} =2 {two} other {many}}
- {sex, select, m {male} f {female}}
+ {sex, select, m {male} f {female} 0 {other}}
{sexB, select, m {male} f {female}}
diff --git a/packages/compiler/test/i18n/integration_xliff_spec.ts b/packages/compiler/test/i18n/integration_xliff_spec.ts
index 7f2a394e56..b370590b30 100644
--- a/packages/compiler/test/i18n/integration_xliff_spec.ts
+++ b/packages/compiler/test/i18n/integration_xliff_spec.ts
@@ -85,15 +85,15 @@ const XLIFF_TOMERGE = `
{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {many} }
{VAR_PLURAL, plural, =0 {zero} =1 {un} =2 {deux} other {beaucoup} }
-
+
-
- {VAR_SELECT, select, m {male} f {female} }
- {VAR_SELECT, select, m {homme} f {femme} }
+
+ {VAR_SELECT, select, 0 {other} m {male} f {female} }
+ {VAR_SELECT, select, 0 {autre} m {homme} f {femme}}
@@ -123,12 +123,12 @@ const XLIFF_TOMERGE = `
- Markers in html comments
+ Markers in html comments
- Balises dans les commentaires html
+ Balises dans les commentaires html
@@ -218,7 +218,7 @@ const XLIFF_EXTRACTED = `
36
-
+
@@ -227,8 +227,8 @@ const XLIFF_EXTRACTED = `
21
-
- {VAR_SELECT, select, m {male} f {female} }
+
+ {VAR_SELECT, select, 0 {other} m {male} f {female} }
file.ts
22
@@ -284,7 +284,7 @@ const XLIFF_EXTRACTED = `
- Markers in html comments
+ Markers in html comments
diff --git a/packages/compiler/test/i18n/integration_xmb_xtb_spec.ts b/packages/compiler/test/i18n/integration_xmb_xtb_spec.ts
index 6432a72034..679a22e218 100644
--- a/packages/compiler/test/i18n/integration_xmb_xtb_spec.ts
+++ b/packages/compiler/test/i18n/integration_xmb_xtb_spec.ts
@@ -64,6 +64,8 @@ const XTB = `
sur des balises non traductibles
sur des balises traductibles
{VAR_PLURAL, plural, =0 {zero} =1 {un} =2 {deux} other {beaucoup}}
+
+ {VAR_SELECT, select, 0 {autre} m {homme} f {femme} }
{VAR_SELECT, select, m {homme} f {femme}}
@@ -84,17 +86,21 @@ const XTB = `
MAP_NAME
`;
-const XMB = ` file.ts:3i18n attribute on tags
+const XMB = `file.ts:3i18n attribute on tags
file.ts:5nested
file.ts:7nested
file.ts:9file.ts:10<i>with placeholders</i>
file.ts:13on not translatable node
file.ts:14on translatable node
file.ts:19file.ts:36{VAR_PLURAL, plural, =0 {zero} =1 {one} =2 {two} other {<b>many</b>} }
- file.ts:21,23file.ts:24,26
+ file.ts:21,23
ICU
- file.ts:22file.ts:25{VAR_SELECT, select, m {male} f {female} }
+ file.ts:22{VAR_SELECT, select, 0 {other} m {male} f {female} }
+ file.ts:24,26
+ ICU
+
+ file.ts:25{VAR_SELECT, select, m {male} f {female} }
file.ts:28INTERPOLATION
file.ts:29sex = INTERPOLATION
file.ts:30CUSTOM_NAME
diff --git a/packages/compiler/test/ml_parser/html_parser_spec.ts b/packages/compiler/test/ml_parser/html_parser_spec.ts
index 7f2194274b..1a8b2bd630 100644
--- a/packages/compiler/test/ml_parser/html_parser_spec.ts
+++ b/packages/compiler/test/ml_parser/html_parser_spec.ts
@@ -363,6 +363,11 @@ export function main() {
]);
});
+ it('should support ICU expressions with cases that contain numbers', () => {
+ const p = parser.parse(`{sex, select, male {m} female {f} 0 {other}}`, 'TestComp', true);
+ expect(p.errors.length).toEqual(0);
+ });
+
it('should error when expansion case is not closed', () => {
const p = parser.parse(`{messages.length, plural, =0 {one`, 'TestComp', true);
expect(humanizeErrors(p.errors)).toEqual([