Cleanup
This commit is contained in:
parent
d3272efef7
commit
3c9f2c6a2e
@ -20,9 +20,9 @@
|
|||||||
class Deinflection {
|
class Deinflection {
|
||||||
constructor(term, tags=[], rule='') {
|
constructor(term, tags=[], rule='') {
|
||||||
this.children = [];
|
this.children = [];
|
||||||
this.term = term;
|
this.term = term;
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
this.rule = rule;
|
this.rule = rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(validator) {
|
validate(validator) {
|
||||||
|
@ -27,9 +27,9 @@ class Translator {
|
|||||||
kanjidic: 'bg/data/kanjidic.json'
|
kanjidic: 'bg/data/kanjidic.json'
|
||||||
};
|
};
|
||||||
|
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
this.tags = null;
|
this.tagMeta = null;
|
||||||
this.dictionary = new Dictionary();
|
this.dictionary = new Dictionary();
|
||||||
this.deinflector = new Deinflector();
|
this.deinflector = new Deinflector();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class Translator {
|
|||||||
this.deinflector.setRules(JSON.parse(response));
|
this.deinflector.setRules(JSON.parse(response));
|
||||||
break;
|
break;
|
||||||
case 'tags':
|
case 'tags':
|
||||||
this.tags = JSON.parse(response);
|
this.tagMeta = JSON.parse(response);
|
||||||
break;
|
break;
|
||||||
case 'kanjidic':
|
case 'kanjidic':
|
||||||
this.dictionary.addKanjiDict(key, JSON.parse(response));
|
this.dictionary.addKanjiDict(key, JSON.parse(response));
|
||||||
@ -165,7 +165,7 @@ class Translator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let popular = false;
|
let popular = false;
|
||||||
let tagItems = [];
|
let tagItems = [];
|
||||||
for (let tag of entry.tags) {
|
for (let tag of entry.tags) {
|
||||||
const tagItem = {
|
const tagItem = {
|
||||||
@ -175,10 +175,10 @@ class Translator {
|
|||||||
name: tag
|
name: tag
|
||||||
};
|
};
|
||||||
|
|
||||||
const tagMeta = this.tags[tag];
|
const tagMeta = this.tagMeta[tag];
|
||||||
if (tagMeta) {
|
if (tagMeta) {
|
||||||
for (const key in tagMeta) {
|
for (const tagProp in tagMeta) {
|
||||||
tagItem[key] = tagMeta[key] || tagItem[key];
|
tagItem[tagProp] = tagMeta[tagProp] || tagItem[tagProp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user