MCPcopy Index your code
hub / github.com/angular/angular / getTranslationForTemplate

Function getTranslationForTemplate

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…