(
format: string,
sourceLocale: string,
rootPath: AbsoluteFsPath,
useLegacyIds: boolean,
formatOptions: FormatOptions = {},
fs: PathManipulation,
diagnostics: Diagnostics,
)
| 122 | } |
| 123 | |
| 124 | function 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…