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

Function _parseMessageMeta

packages/compiler/src/i18n/extractor_merger.ts:681–694  ·  view source on GitHub ↗
(i18n?: string)

Source from the content-addressed store, hash-verified

679}
680
681function _parseMessageMeta(i18n?: string): {meaning: string; description: string; id: string} {
682 if (!i18n) return {meaning: '', description: '', id: ''};
683
684 const idIndex = i18n.indexOf(ID_SEPARATOR);
685 const descIndex = i18n.indexOf(MEANING_SEPARATOR);
686 const [meaningAndDesc, id] =
687 idIndex > -1 ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''];
688 const [meaning, description] =
689 descIndex > -1
690 ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)]
691 : ['', meaningAndDesc];
692
693 return {meaning, description, id: id.trim()};
694}
695
696function isTextNode(ast: html.Node[]): ast is [html.Text] {
697 return ast.length === 1 && ast[0] instanceof html.Text;

Callers 2

_addMessageMethod · 0.85
_translateAttributesMethod · 0.85

Calls 1

indexOfMethod · 0.80

Tested by

no test coverage detected