diff --git a/packages/core/src/render3/i18n.ts b/packages/core/src/render3/i18n.ts index 5c0f9c28e6..2700cce34d 100644 --- a/packages/core/src/render3/i18n.ts +++ b/packages/core/src/render3/i18n.ts @@ -1316,13 +1316,14 @@ const LOCALIZE_PH_REGEXP = /\{\$(.*?)\}/g; * @codeGenApi * @deprecated this method is temporary & should not be used as it will be removed soon */ -export function ɵɵi18nLocalize(input: string, placeholders: {[key: string]: string} = {}) { +export function ɵɵi18nLocalize(input: string, placeholders?: {[key: string]: string}) { if (typeof TRANSLATIONS[input] !== 'undefined') { // to account for empty string input = TRANSLATIONS[input]; } - return Object.keys(placeholders).length ? - input.replace(LOCALIZE_PH_REGEXP, (match, key) => placeholders[key] || '') : - input; + if (placeholders !== undefined && Object.keys(placeholders).length) { + return input.replace(LOCALIZE_PH_REGEXP, (_, key) => placeholders[key] || ''); + } + return input; } /**