fix(compiler-cli): normalize sourcepaths for i18n extracted files (#20417)
Fixes #20416 PR Close #20417
This commit is contained in:
parent
6293ca23c3
commit
de78307928
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue