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

Method load

packages/compiler/src/i18n/serializers/xliff.ts:111–134  ·  view source on GitHub ↗
(
    content: string,
    url: string,
  )

Source from the content-addressed store, hash-verified

109 }
110
111 override load(
112 content: string,
113 url: string,
114 ): {locale: string; i18nNodesByMsgId: {[msgId: string]: i18n.Node[]}} {
115 // xliff to xml nodes
116 const xliffParser = new XliffParser();
117 const {locale, msgIdToHtml, errors} = xliffParser.parse(content, url);
118
119 // xml nodes to i18n nodes
120 const i18nNodesByMsgId: {[msgId: string]: i18n.Node[]} = {};
121 const converter = new XmlToI18n();
122
123 Object.keys(msgIdToHtml).forEach((msgId) => {
124 const {i18nNodes, errors: e} = converter.convert(msgIdToHtml[msgId], url);
125 errors.push(...e);
126 i18nNodesByMsgId[msgId] = i18nNodes;
127 });
128
129 if (errors.length) {
130 throw new Error(`xliff parse errors:\n${errors.join('\n')}`);
131 }
132
133 return {locale: locale!, i18nNodesByMsgId};
134 }
135
136 override digest(message: i18n.Message): string {
137 return digest(message);

Callers

nothing calls this directly

Calls 6

parseMethod · 0.95
convertMethod · 0.95
keysMethod · 0.65
joinMethod · 0.65
forEachMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected