Browse Source

chore: allow new language from Transifex

Gerald 5 years ago
parent
commit
caa4e144a1
1 changed files with 8 additions and 2 deletions
  1. 8 2
      scripts/i18n.js

+ 8 - 2
scripts/i18n.js

@@ -27,8 +27,14 @@ class Locale {
       const ext = path.extname(file);
       const transformer = transformers[ext];
       if (transformer) {
-        const res = await fs.readFile(`${localeDir}/${file}`, 'utf8');
-        Object.assign(this.data, transformer(res));
+        try {
+          const res = await fs.readFile(`${localeDir}/${file}`, 'utf8');
+          Object.assign(this.data, transformer(res));
+        } catch (err) {
+          if (err.code !== 'ENOENT') {
+            throw err;
+          }
+        }
       }
     }
     Object.keys(this.data)