| 87 | } |
| 88 | |
| 89 | async load() { |
| 90 | const langs = await fs.readdir(this.base); |
| 91 | this.langs = langs; |
| 92 | await Promise.all(langs.map(async lang => { |
| 93 | const locale = new Locale(lang, this.base); |
| 94 | await locale.load(); |
| 95 | this.locales[lang] = locale; |
| 96 | })); |
| 97 | const defaultData = this.locales[this.defaultLang]; |
| 98 | Object.keys(defaultData.desc).forEach(key => { |
| 99 | this.data[key] = { |
| 100 | ...defaultData.data[key], |
| 101 | touched: this.options.markUntouched ? false : defaultData.get(key).touched !== false, |
| 102 | }; |
| 103 | }); |
| 104 | } |
| 105 | |
| 106 | getData(lang, options) { |
| 107 | options = options || {}; |