Skip to content

Commit

Permalink
fix(plugin-locale): 修复 win 环境处理文件路径问题 (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
1zumii authored Mar 5, 2024
1 parent 557aaaf commit f53ceda
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/fes-plugin-locale/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
);
}

0 comments on commit f53ceda

Please sign in to comment.