fix(ivy): sanitize external i18n ids before generating const names (#28522)
Prior to this change there was no i18n id sanitization before we output goog.getMsg calls. Due to the fact that message ids are used as a part of const names, some characters were bcausing issues while executing generated code. This commit adds sanitization to i18n ids used to generate i18n-related consts. PR Close #28522
This commit is contained in:

committed by
Matias Niemelä

parent
7c5c1fae62
commit
3f73dfa151
@ -362,7 +362,7 @@ export class TemplateDefinitionBuilder implements t.Visitor<void>, LocalResolver
|
||||
if (this.i18nUseExternalIds) {
|
||||
const prefix = getTranslationConstPrefix(`EXTERNAL_`);
|
||||
const uniqueSuffix = this.constantPool.uniqueName(suffix);
|
||||
name = `${prefix}${messageId}$$${uniqueSuffix}`;
|
||||
name = `${prefix}${sanitizeIdentifier(messageId)}$$${uniqueSuffix}`;
|
||||
} else {
|
||||
const prefix = getTranslationConstPrefix(suffix);
|
||||
name = this.constantPool.uniqueName(prefix);
|
||||
|
Reference in New Issue
Block a user