Skip to content
Snippets Groups Projects
Commit d1ea8654 authored by syuilo's avatar syuilo
Browse files

fix: YAMLファイルへのバックスペース文字混入対策

parent 13288e1e
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,10 @@ const primaries = {
'zh': 'CN',
};
const locales = languages.reduce((a, c) => (a[c] = yaml.load(fs.readFileSync(`${__dirname}/${c}.yml`, 'utf-8')) || {}, a), {});
// 何故か文字列にバックスペース文字が混入することがあり、YAMLが壊れるので取り除く
const clean = (text) => text.replace(new RegExp(String.fromCodePoint(0x08), 'g'), '');
const locales = languages.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(`${__dirname}/${c}.yml`, 'utf-8'))) || {}, a), {});
module.exports = Object.entries(locales)
.reduce((a, [k ,v]) => (a[k] = (() => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment