diff --git a/packages/compiler/src/render3/view/i18n/get_msg_utils.ts b/packages/compiler/src/render3/view/i18n/get_msg_utils.ts index 8c7be771e2..e601904793 100644 --- a/packages/compiler/src/render3/view/i18n/get_msg_utils.ts +++ b/packages/compiler/src/render3/view/i18n/get_msg_utils.ts @@ -10,7 +10,7 @@ import {mapLiteral} from '../../../output/map_util'; import * as o from '../../../output/output_ast'; import {serializeIcuNode} from './icu_serializer'; -import {i18nMetaToDocStmt, metaFromI18nMessage} from './meta'; +import {i18nMetaToDocStmt} from './meta'; import {formatI18nPlaceholderName} from './util'; /** Closure uses `goog.getMsg(message)` to lookup translations */ @@ -32,7 +32,7 @@ export function createGoogleGetMsgStatements( // const MSG_... = goog.getMsg(..); // I18N_X = MSG_...; const statements = []; - const jsdocComment = i18nMetaToDocStmt(metaFromI18nMessage(message)); + const jsdocComment = i18nMetaToDocStmt(message); if (jsdocComment !== null) { statements.push(jsdocComment); } diff --git a/packages/compiler/src/render3/view/i18n/localize_utils.ts b/packages/compiler/src/render3/view/i18n/localize_utils.ts index 2622677cac..2e8dc4cdb6 100644 --- a/packages/compiler/src/render3/view/i18n/localize_utils.ts +++ b/packages/compiler/src/render3/view/i18n/localize_utils.ts @@ -9,7 +9,6 @@ import * as i18n from '../../../i18n/i18n_ast'; import * as o from '../../../output/output_ast'; import {serializeIcuNode} from './icu_serializer'; -import {metaFromI18nMessage} from './meta'; import {formatI18nPlaceholderName} from './util'; export function createLocalizeStatements( @@ -18,9 +17,8 @@ export function createLocalizeStatements( const statements = []; const {messageParts, placeHolders} = serializeI18nMessageForLocalize(message); - statements.push(new o.ExpressionStatement(variable.set(o.localizedString( - metaFromI18nMessage(message), messageParts, placeHolders, - placeHolders.map(ph => params[ph]))))); + statements.push(new o.ExpressionStatement(variable.set( + o.localizedString(message, messageParts, placeHolders, placeHolders.map(ph => params[ph]))))); return statements; } diff --git a/packages/compiler/src/render3/view/i18n/meta.ts b/packages/compiler/src/render3/view/i18n/meta.ts index fb4d5fc9d5..98e2ac1329 100644 --- a/packages/compiler/src/render3/view/i18n/meta.ts +++ b/packages/compiler/src/render3/view/i18n/meta.ts @@ -153,7 +153,7 @@ export class I18nMetaVisitor implements html.Visitor { */ private _parseMetadata(meta: string|i18n.I18nMeta): I18nMeta { return typeof meta === 'string' ? parseI18nMeta(meta) : - meta instanceof i18n.Message ? metaFromI18nMessage(meta) : {}; + meta instanceof i18n.Message ? meta : {}; } /** @@ -187,16 +187,6 @@ export class I18nMetaVisitor implements html.Visitor { } } -export function metaFromI18nMessage(message: i18n.Message, id: string | null = null): I18nMeta { - return { - id: typeof id === 'string' ? id : message.id || '', - customId: message.customId, - legacyIds: message.legacyIds, - meaning: message.meaning || '', - description: message.description || '' - }; -} - /** I18n separators for metadata **/ const I18N_MEANING_SEPARATOR = '|'; const I18N_ID_SEPARATOR = '@@';