From 9ac75da5f18cd47f614819c954177f379fd3723c Mon Sep 17 00:00:00 2001 From: Andrew Kushnir Date: Mon, 4 Nov 2019 16:04:12 -0800 Subject: [PATCH] fixup! fix(ivy): more descriptive errors for nested i18n sections --- .../compiler-cli/test/compliance/r3_view_compiler_i18n_spec.ts | 2 +- packages/compiler/src/render3/r3_template_transform.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 effb3a2486ceb..bcb1f76c9700e 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 @@ -3419,7 +3419,7 @@ describe('i18n support in the template compiler', () => { expect(errorThrown.ngParseErrors.length).toBe(1); const msg = errorThrown.ngParseErrors[0].toString(); expect(msg).toContain( - 'Could not mark an element as translatable inside of a translatable section'); + 'Cannot mark an element as translatable inside of a translatable section. Please remove the nested i18n marker.'); expect(msg).toContain(expectedErrorText); expect(msg).toMatch(/app\/spec\.ts\@\d+\:\d+/); }; diff --git a/packages/compiler/src/render3/r3_template_transform.ts b/packages/compiler/src/render3/r3_template_transform.ts index fcf27d1a6d210..4df6909321786 100644 --- a/packages/compiler/src/render3/r3_template_transform.ts +++ b/packages/compiler/src/render3/r3_template_transform.ts @@ -90,7 +90,7 @@ class HtmlAstToIvyAst implements html.Visitor { if (isI18nRootElement) { if (this.inI18nBlock) { this.reportError( - 'Could not mark an element as translatable inside of a translatable section', + 'Cannot mark an element as translatable inside of a translatable section. Please remove the nested i18n marker.', element.sourceSpan); } this.inI18nBlock = true;