From d1ea8654e634862a6b5dde383581ec331a928570 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 14 Dec 2021 23:03:18 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20YAML=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=B8=E3=81=AE=E3=83=90=E3=83=83=E3=82=AF=E3=82=B9=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E6=96=87=E5=AD=97=E6=B7=B7=E5=85=A5=E5=AF=BE?= =?UTF-8?q?=E7=AD=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/locales/index.js b/locales/index.js index a0181cd7a..8350b3d9c 100644 --- a/locales/index.js +++ b/locales/index.js @@ -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] = (() => {