diff --git a/modules/@angular/compiler/src/i18n/message_extractor.ts b/modules/@angular/compiler/src/i18n/message_extractor.ts index 0810c6b288..c4be339f07 100644 --- a/modules/@angular/compiler/src/i18n/message_extractor.ts +++ b/modules/@angular/compiler/src/i18n/message_extractor.ts @@ -5,8 +5,6 @@ import {HtmlAst, HtmlElementAst} from '../html_ast'; import {HtmlParser} from '../html_parser'; import {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from '../interpolation_config'; import {ParseError} from '../parse_util'; - -import {expandNodes} from './expander'; import {Message, id} from './message'; import {I18N_ATTR_PREFIX, I18nError, Part, messageFromAttribute, messageFromI18nAttribute, partition} from './shared'; @@ -106,14 +104,13 @@ export class MessageExtractor { this._errors = []; this._interpolationConfig = interpolationConfig; - let res = this._htmlParser.parse(template, sourceUrl, true); - if (res.errors.length > 0) { - return new ExtractionResult([], res.errors); - } else { - let expanded = expandNodes(res.rootNodes); - this._recurse(expanded.nodes); - return new ExtractionResult(this._messages, this._errors.concat(expanded.errors)); + const res = this._htmlParser.parse(template, sourceUrl, true); + + if (res.errors.length == 0) { + this._recurse(res.rootNodes); } + + return new ExtractionResult(this._messages, this._errors.concat(res.errors)); } private _extractMessagesFromPart(part: Part): void { diff --git a/modules/@angular/compiler/test/i18n/message_extractor_spec.ts b/modules/@angular/compiler/test/i18n/message_extractor_spec.ts index a435e183d0..5643eeb996 100644 --- a/modules/@angular/compiler/test/i18n/message_extractor_spec.ts +++ b/modules/@angular/compiler/test/i18n/message_extractor_spec.ts @@ -153,28 +153,7 @@ export function main() { new Message('value', 'meaning', 'desc') ]); }); - - // TODO(vicb) - this should be extracted to a single message - // see https://github.com/angular/angular/issues/9067 - xit('should extract messages from expansion forms', () => { - let res = extractor.extract( - ` -
- {messages.length, plural, - =0 {You have no messages} - =1 {You have one message} - other {You have messages} - } -
`, - 'someurl'); - - expect(res.messages).toEqual([ - new Message('You have no messages', 'plural_=0', null), - new Message('You have one message', 'plural_=1', null), - new Message('You have messages', 'plural_other', null), - ]); - }); - + it('should remove duplicate messages', () => { let res = extractor.extract( ` @@ -239,14 +218,6 @@ export function main() { expect(res.errors.length).toEqual(1); expect(res.errors[0].msg).toEqual('Unexpected character "s"'); }); - - it('should return parse errors on unknown plural cases', () => { - let res = extractor.extract('{n, plural, unknown {-}}', 'someUrl'); - expect(res.errors.length).toEqual(1); - expect(res.errors[0].msg) - .toEqual( - 'Plural cases should be "=" or one of zero, one, two, few, many, other'); - }); }); }); }