( formatName: string | null, outFile: string | null, host: ts.CompilerHost, options: CompilerOptions, bundle: MessageBundle, pathResolve: (...segments: string[]) => string = path.resolve, )
| 30 | } |
| 31 | |
| 32 | export 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 | |
| 50 | export function i18nSerialize( |
| 51 | bundle: MessageBundle, |
no test coverage detected
searching dependent graphs…