summaryrefslogtreecommitdiff
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.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index 35b49608..84a6e1d7 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -19,17 +19,19 @@
class Translator {
constructor() {
- this.database = new Database();
- this.deinflector = new Deinflector();
- this.loaded = false;
+ this.database = null;
+ this.deinflector = null;
}
async prepare() {
- if (!this.loaded) {
- const reasons = await jsonLoadInt('/bg/lang/deinflect.json');
- this.deinflector.setReasons(reasons);
+ if (!this.database) {
+ this.database = new Database();
await this.database.prepare();
- this.loaded = true;
+ }
+
+ if (!this.deinflector) {
+ const reasons = await jsonLoadInt('/bg/lang/deinflect.json');
+ this.deinflector = new Deinflector(reasons);
}
}