aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r--ext/bg/js/translator.js24
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();
});