diff --git a/modules/@angular/compiler/src/i18n/extractor_merger.ts b/modules/@angular/compiler/src/i18n/extractor_merger.ts index 71a1f614f3..13e6868f72 100644 --- a/modules/@angular/compiler/src/i18n/extractor_merger.ts +++ b/modules/@angular/compiler/src/i18n/extractor_merger.ts @@ -211,7 +211,8 @@ class _Visitor implements html.Visitor { // Extract only top level nodes with the (implicit) "i18n" attribute if not in a block or an ICU // message const i18nAttr = _getI18nAttr(el); - const isImplicit = this._implicitTags.some((tag: string): boolean => el.name === tag); + const isImplicit = this._implicitTags.some((tag: string): boolean => el.name === tag) && + !this._inIcu && !this._isInTranslatableSection; const isTopLevelImplicit = !wasInImplicitNode && isImplicit; this._inImplicitNode = this._inImplicitNode || isImplicit; diff --git a/modules/@angular/compiler/test/i18n/extractor_merger_spec.ts b/modules/@angular/compiler/test/i18n/extractor_merger_spec.ts index b09da17d4f..ddd8ca8c18 100644 --- a/modules/@angular/compiler/test/i18n/extractor_merger_spec.ts +++ b/modules/@angular/compiler/test/i18n/extractor_merger_spec.ts @@ -54,6 +54,12 @@ export function main() { it('should not create a message for empty elements', () => { expect(extract('
')).toEqual([]); }); + + it('should ignore implicit elements in translatable elements', () => { + expect(extract('ignore
}} }}ignore
}} }}', ['p'])) + .toEqual([]); + }); }); describe('attributes', () => { @@ -297,20 +328,6 @@ export function main() { ]); }); }); - - describe('implicit elements', () => { - it('should report implicit element in translatable element', () => { - expect(extractErrors(``, ['b'])).toEqual([ - ['Could not mark an element as translatable inside a translatable section', ''], - ]); - }); - - it('should report implicit element in translatable blocks', () => { - expect(extractErrors(``, ['b'])).toEqual([ - ['Could not mark an element as translatable inside a translatable section', ''], - ]); - }); - }); }); });