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

Function getSerializer

packages/localize/tools/src/extract/index.ts:124–164  ·  view source on GitHub ↗
(
  format: string,
  sourceLocale: string,
  rootPath: AbsoluteFsPath,
  useLegacyIds: boolean,
  formatOptions: FormatOptions = {},
  fs: PathManipulation,
  diagnostics: Diagnostics,
)

Source from the content-addressed store, hash-verified

122}
123
124function getSerializer(
125 format: string,
126 sourceLocale: string,
127 rootPath: AbsoluteFsPath,
128 useLegacyIds: boolean,
129 formatOptions: FormatOptions = {},
130 fs: PathManipulation,
131 diagnostics: Diagnostics,
132): TranslationSerializer {
133 switch (format) {
134 case 'xlf':
135 case 'xlif':
136 case 'xliff':
137 return new Xliff1TranslationSerializer(
138 sourceLocale,
139 rootPath,
140 useLegacyIds,
141 formatOptions,
142 fs,
143 );
144 case 'xlf2':
145 case 'xlif2':
146 case 'xliff2':
147 return new Xliff2TranslationSerializer(
148 sourceLocale,
149 rootPath,
150 useLegacyIds,
151 formatOptions,
152 fs,
153 );
154 case 'xmb':
155 return new XmbTranslationSerializer(rootPath, useLegacyIds, fs);
156 case 'json':
157 return new SimpleJsonTranslationSerializer(sourceLocale);
158 case 'arb':
159 return new ArbTranslationSerializer(sourceLocale, rootPath, fs);
160 case 'legacy-migrate':
161 return new LegacyMessageIdMigrationSerializer(diagnostics);
162 }
163 throw new Error(`No translation serializer can handle the provided format: ${format}`);
164}

Callers 1

extractTranslationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…