MCPcopy Create free account
hub / github.com/angular/angular / getTranslationForTemplate

Function getTranslationForTemplate

packages/core/src/render3/i18n/i18n_parse.ts:552–563  ·  view source on GitHub ↗
(message: string, subTemplateIndex: number)

Source from the content-addressed store, hash-verified

550 * external template and removes all sub-templates.
551 */
552export function getTranslationForTemplate(message: string, subTemplateIndex: number) {
553 if (isRootTemplateMessage(subTemplateIndex)) {
554 // We want the root template message, ignore all sub-templates
555 return removeInnerTemplateTranslation(message);
556 } else {
557 // We want a specific sub-template
558 const start =
559 message.indexOf(`:${subTemplateIndex}${MARKER}`) + 2 + subTemplateIndex.toString().length;
560 const end = message.search(new RegExp(`${MARKER}\\/\\*\\d+:${subTemplateIndex}${MARKER}`));
561 return removeInnerTemplateTranslation(message.substring(start, end));
562 }
563}
564
565/**
566 * Generate the OpCodes for ICU expressions.

Callers 2

i18n_spec.tsFile · 0.90
i18nStartFirstCreatePassFunction · 0.85

Calls 5

isRootTemplateMessageFunction · 0.90
indexOfMethod · 0.80
toStringMethod · 0.65
searchMethod · 0.45

Tested by

no test coverage detected