fix(compiler): i18n_extractor now outputs the correct source file name (#24885)

for non-inline templates

- Non-inline templates used to ouput the path to the component TS file
instead of the path to the original HTML file.
- Inline templates keep the same behavior.

Fixes #24884

PR Close #24885
This commit is contained in:
Carlos Ortiz Garcia
2018-07-13 16:14:08 -07:00
committed by Matias Niemelä
parent 9be8abd012
commit c8ad9657c9
3 changed files with 88 additions and 21 deletions

View File

@ -318,10 +318,12 @@ export class AotCompiler {
});
compMetas.forEach(compMeta => {
const html = compMeta.template !.template !;
// Template URL points to either an HTML or TS file depending on whether
// the file is used with `templateUrl:` or `template:`, respectively.
const templateUrl = compMeta.template !.templateUrl !;
const interpolationConfig =
InterpolationConfig.fromArray(compMeta.template !.interpolation);
errors.push(
...messageBundle.updateFromTemplate(html, file.fileName, interpolationConfig) !);
errors.push(...messageBundle.updateFromTemplate(html, templateUrl, interpolationConfig) !);
});
});

View File

@ -75,10 +75,14 @@ export class Extractor {
});
compMetas.forEach(compMeta => {
const html = compMeta.template !.template !;
// Template URL points to either an HTML or TS file depending on
// whether the file is used with `templateUrl:` or `template:`,
// respectively.
const templateUrl = compMeta.template !.templateUrl !;
const interpolationConfig =
InterpolationConfig.fromArray(compMeta.template !.interpolation);
errors.push(...this.messageBundle.updateFromTemplate(
html, file.fileName, interpolationConfig) !);
html, templateUrl, interpolationConfig) !);
});
});