fix(compiler): remove i18n markup even if no translations (#17999)
Fixes #11042
This commit is contained in:

committed by
Jason Aden

parent
2ba3ada27f
commit
9c3386b1b7
@ -7,9 +7,12 @@
|
||||
*/
|
||||
|
||||
import {MissingTranslationStrategy, ɵConsole as Console} from '@angular/core';
|
||||
|
||||
import {HtmlParser} from '../ml_parser/html_parser';
|
||||
import {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from '../ml_parser/interpolation_config';
|
||||
import {ParseTreeResult} from '../ml_parser/parser';
|
||||
|
||||
import {digest} from './digest';
|
||||
import {mergeTranslations} from './extractor_merger';
|
||||
import {Serializer} from './serializers/serializer';
|
||||
import {Xliff} from './serializers/xliff';
|
||||
@ -32,6 +35,9 @@ export class I18NHtmlParser implements HtmlParser {
|
||||
const serializer = createSerializer(translationsFormat);
|
||||
this._translationBundle =
|
||||
TranslationBundle.load(translations, 'i18n', serializer, missingTranslation, console);
|
||||
} else {
|
||||
this._translationBundle =
|
||||
new TranslationBundle({}, null, digest, undefined, missingTranslation, console);
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,11 +47,6 @@ export class I18NHtmlParser implements HtmlParser {
|
||||
const parseResult =
|
||||
this._htmlParser.parse(source, url, parseExpansionForms, interpolationConfig);
|
||||
|
||||
if (!this._translationBundle) {
|
||||
// Do not enable i18n when no translation bundle is provided
|
||||
return parseResult;
|
||||
}
|
||||
|
||||
if (parseResult.errors.length) {
|
||||
return new ParseTreeResult(parseResult.rootNodes, parseResult.errors);
|
||||
}
|
||||
|
Reference in New Issue
Block a user