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

Function i18nExtract

packages/compiler-cli/src/transformers/i18n.ts:32–48  ·  view source on GitHub ↗
(
  formatName: string | null,
  outFile: string | null,
  host: ts.CompilerHost,
  options: CompilerOptions,
  bundle: MessageBundle,
  pathResolve: (...segments: string[]) => string = path.resolve,
)

Source from the content-addressed store, hash-verified

30}
31
32export function i18nExtract(
33 formatName: string | null,
34 outFile: string | null,
35 host: ts.CompilerHost,
36 options: CompilerOptions,
37 bundle: MessageBundle,
38 pathResolve: (...segments: string[]) => string = path.resolve,
39): string[] {
40 formatName = formatName || 'xlf';
41 // Checks the format and returns the extension
42 const ext = i18nGetExtension(formatName);
43 const content = i18nSerialize(bundle, formatName, options);
44 const dstFile = outFile || `messages.${ext}`;
45 const dstPath = pathResolve(options.outDir || options.basePath!, dstFile);
46 host.writeFile(dstPath, content, false, undefined, []);
47 return [dstPath];
48}
49
50export function i18nSerialize(
51 bundle: MessageBundle,

Callers 1

emitXi18nMethod · 0.90

Calls 3

i18nGetExtensionFunction · 0.85
i18nSerializeFunction · 0.85
writeFileMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…