From 27e6912aa9d053835c7a0ecfbba356997eeabee8 Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Wed, 17 Jul 2019 15:42:21 +0200 Subject: [PATCH] refactor(i18n): translation var script #33 --- tools/extract-i18n-watch.js | 6 +++++- tools/extract-i18n.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/extract-i18n-watch.js b/tools/extract-i18n-watch.js index dfec13158..9066ed9cc 100644 --- a/tools/extract-i18n-watch.js +++ b/tools/extract-i18n-watch.js @@ -3,5 +3,9 @@ const fs = require('fs'); const MAIN_TRANSLATION_FILE = __dirname + '/../src/assets/i18n/en.json'; fs.watchFile(MAIN_TRANSLATION_FILE, () => { - extractI18n(); + try { + extractI18n(); + } catch (e) { + console.error(e); + } }); diff --git a/tools/extract-i18n.js b/tools/extract-i18n.js index bdb86bc2c..8794f38b1 100644 --- a/tools/extract-i18n.js +++ b/tools/extract-i18n.js @@ -1,8 +1,8 @@ const fs = require('fs'); -const path = __dirname + '/../src/assets/i18n/en.json'; +const TRANSLATION_SRC = __dirname + '/../src/assets/i18n/en.json'; module.exports = () => { - const _tr = fs.readFileSync(path); + const _tr = fs.readFileSync(TRANSLATION_SRC); const tr = JSON.parse(_tr); const parse = (o, pref = '') => {