diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-08-22 08:48:19 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-08-22 08:48:19 -0700 |
commit | 9621a0cd4b8ea395b78418d2aca210183394f4a4 (patch) | |
tree | 91f124648b05e6127c70c873cf57634c72de2809 /ext/bg/js/translator.js | |
parent | a062b25178dd8d916a8cdf87cffa36b5365ab021 (diff) |
WIP
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r-- | ext/bg/js/translator.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 9fd1ab59..75f91055 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -41,16 +41,20 @@ class Translator { this.loaded = true; callback(); }).catch(() => { - this.dictionary.initDb(); - return Translator.loadData('bg/data/edict.json'); - }).then((response) => { - this.dictionary.importTermDict(JSON.parse(response)); - return Translator.loadData('bg/data/enamdict.json'); - }).then((response) => { - this.dictionary.importTermDict(JSON.parse(response)); - return Translator.loadData('bg/data/kanjidic.json'); - }).then((response) => { - this.dictionary.importKanjiDict(JSON.parse(response)); + return this.dictionary.resetDb().then(() => { + return Translator.loadData('bg/data/edict.json'); + }).then((response) => { + return this.dictionary.importTermDict(JSON.parse(response)); + }).then(() => { + return Translator.loadData('bg/data/enamdict.json'); + }).then((response) => { + return this.dictionary.importTermDict(JSON.parse(response)); + }).then(() => { + return Translator.loadData('bg/data/kanjidic.json'); + }).then((response) => { + return this.dictionary.importKanjiDict(JSON.parse(response)); + }); + }).then(() => { this.loaded = true; callback(); }); |