( bundle: MessageBundle, formatName: string, options: CompilerOptions, )
| 48 | } |
| 49 | |
| 50 | export function i18nSerialize( |
| 51 | bundle: MessageBundle, |
| 52 | formatName: string, |
| 53 | options: CompilerOptions, |
| 54 | ): string { |
| 55 | const format = formatName.toLowerCase(); |
| 56 | let serializer: Serializer; |
| 57 | |
| 58 | switch (format) { |
| 59 | case 'xmb': |
| 60 | serializer = new Xmb(); |
| 61 | break; |
| 62 | case 'xliff2': |
| 63 | case 'xlf2': |
| 64 | serializer = new Xliff2(); |
| 65 | break; |
| 66 | case 'xlf': |
| 67 | case 'xliff': |
| 68 | default: |
| 69 | serializer = new Xliff(); |
| 70 | } |
| 71 | |
| 72 | return bundle.write(serializer, getPathNormalizer(options.basePath)); |
| 73 | } |
| 74 | |
| 75 | function getPathNormalizer(basePath?: string) { |
| 76 | // normalize source paths by removing the base path and always using "/" as a separator |
no test coverage detected
searching dependent graphs…