fix(ivy): template compiler should render correct $localize placeholder names (#32509)
The `goog.getMsg()` function requires placeholder names to be camelCased. This is not the case for `$localize`. Here placeholder names need match what is serialized to translation files. Specifically such placeholder names keep their casing but have all characters that are not in `a-z`, `A-Z`, `0-9` and `_` converted to `_`. PR Close #32509
This commit is contained in:

committed by
Matias Niemelä

parent
9166baf709
commit
ea6a2e9f25
@ -2021,13 +2021,15 @@ export function getTranslationDeclStmts(
|
||||
message: i18n.Message, variable: o.ReadVarExpr, closureVar: o.ReadVarExpr,
|
||||
params: {[name: string]: o.Expression} = {},
|
||||
transformFn?: (raw: o.ReadVarExpr) => o.Expression): o.Statement[] {
|
||||
const formattedParams = i18nFormatPlaceholderNames(params, /* useCamelCase */ true);
|
||||
const statements: o.Statement[] = [
|
||||
declareI18nVariable(variable),
|
||||
o.ifStmt(
|
||||
o.variable(NG_I18N_CLOSURE_MODE),
|
||||
createGoogleGetMsgStatements(variable, message, closureVar, formattedParams),
|
||||
createLocalizeStatements(variable, message, formattedParams)),
|
||||
createGoogleGetMsgStatements(
|
||||
variable, message, closureVar,
|
||||
i18nFormatPlaceholderNames(params, /* useCamelCase */ true)),
|
||||
createLocalizeStatements(
|
||||
variable, message, i18nFormatPlaceholderNames(params, /* useCamelCase */ false))),
|
||||
];
|
||||
|
||||
if (transformFn) {
|
||||
|
Reference in New Issue
Block a user