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

Function parseI18nMeta

packages/compiler/src/render3/view/i18n/meta.ts:301–320  ·  view source on GitHub ↗
(meta: string = '')

Source from the content-addressed store, hash-verified

299 * @returns Object with id, meaning and description fields
300 */
301export function parseI18nMeta(meta: string = ''): I18nMeta {
302 let customId: string | undefined;
303 let meaning: string | undefined;
304 let description: string | undefined;
305
306 meta = meta.trim();
307 if (meta) {
308 const idIndex = meta.indexOf(I18N_ID_SEPARATOR);
309 const descIndex = meta.indexOf(I18N_MEANING_SEPARATOR);
310 let meaningAndDesc: string;
311 [meaningAndDesc, customId] =
312 idIndex > -1 ? [meta.slice(0, idIndex), meta.slice(idIndex + 2)] : [meta, ''];
313 [meaning, description] =
314 descIndex > -1
315 ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)]
316 : ['', meaningAndDesc];
317 }
318
319 return {customId, meaning, description};
320}
321
322// Converts i18n meta information for a message (id, description, meaning)
323// to a JsDoc statement formatted as expected by the Closure compiler.

Callers 2

i18n_spec.tsFile · 0.90
_parseMetadataMethod · 0.85

Calls 2

indexOfMethod · 0.80
sliceMethod · 0.65

Tested by

no test coverage detected