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

Function getTranslationForTemplate

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

Source from the content-addressed store, hash-verified

561 * external template and removes all sub-templates.
562 */
563export function getTranslationForTemplate(message: string, subTemplateIndex: number) {
564 if (isRootTemplateMessage(subTemplateIndex)) {
565 // We want the root template message, ignore all sub-templates
566 return removeInnerTemplateTranslation(message);
567 } else {
568 // We want a specific sub-template
569 const start =
570 message.indexOf(`:${subTemplateIndex}${MARKER}`) + 2 + subTemplateIndex.toString().length;
571 const end = message.search(new RegExp(`${MARKER}\\/\\*\\d+:${subTemplateIndex}${MARKER}`));
572 return removeInnerTemplateTranslation(message.substring(start, end));
573 }
574}
575
576/**
577 * 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