refactor(compiler): add source-map spans to localized strings (#32912)
Previously localized strings were not mapped to their original source location, so it was not possible to back-trace them in tools like the i18n message extractor. PR Close #32912
This commit is contained in:

committed by
Andrew Kushnir

parent
decd95e7f0
commit
dda3f49952
@ -274,9 +274,11 @@ class ExpressionTranslatorVisitor implements ExpressionVisitor, StatementVisitor
|
||||
}
|
||||
|
||||
visitLocalizedString(ast: LocalizedString, context: Context): ts.Expression {
|
||||
return this.scriptTarget >= ts.ScriptTarget.ES2015 ?
|
||||
const localizedString = this.scriptTarget >= ts.ScriptTarget.ES2015 ?
|
||||
createLocalizedStringTaggedTemplate(ast, context, this) :
|
||||
createLocalizedStringFunctionCall(ast, context, this, this.imports);
|
||||
this.setSourceMapRange(localizedString, ast);
|
||||
return localizedString;
|
||||
}
|
||||
|
||||
visitExternalExpr(ast: ExternalExpr, context: Context): ts.PropertyAccessExpression
|
||||
|
Reference in New Issue
Block a user