fix(plugin-locale): 修复 win 环境处理文件路径问题

This commit is contained in:
1zumii 2024-03-05 11:11:51 +08:00
parent 557aaaf586
commit 779ac16410

View File

@ -23,11 +23,9 @@ export function getLocales(cwd) {
export function getLocalesJSON(cwd) {
const locales = getLocales(cwd);
return JSON.stringify(locales, null, 2)
return JSON.stringify(locales)
.replace(
/"message": ("(.+?)")/g,
(global, m1, m2) => `"message": ${m2.replace(/\^/g, '"')}`
)
.replace(/\\r\\n/g, '\r\n')
.replace(/\\n/g, '\r\n');
);
}