fix(compiler-cli): normalize sourcepaths for i18n extracted files (#20417)

Fixes #20416
PR Close #20417
This commit is contained in:
Olivier Combe 2017-11-14 10:22:19 +01:00 committed by Miško Hevery
parent 6293ca23c3
commit de78307928
1 changed files with 10 additions and 3 deletions

View File

@ -803,9 +803,16 @@ export function i18nSerialize(
default: default:
serializer = new Xliff(); serializer = new Xliff();
} }
return bundle.write(
serializer, (sourcePath: string) => return bundle.write(serializer, getPathNormalizer(options.basePath));
options.basePath ? path.relative(options.basePath, sourcePath) : sourcePath); }
function getPathNormalizer(basePath?: string) {
// normalize sourcepaths by removing the base path and always using "/" as a separator
return (sourcePath: string) => {
sourcePath = basePath ? path.relative(basePath, sourcePath) : sourcePath;
return sourcePath.split(path.sep).join('/');
};
} }
export function i18nGetExtension(formatName: string): string { export function i18nGetExtension(formatName: string): string {