diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-08-24 09:14:23 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-08-24 09:14:23 -0700 |
commit | 4bebe9215999e9983e47e3fc9a1e7d6d94d0a3bb (patch) | |
tree | 97981d8579082f3687407e0a6e45cc5e92291624 | |
parent | b2d9b613ad3a673abb20033808877962545644d4 (diff) |
WIP
-rw-r--r-- | .gitattributes | 4 | ||||
-rw-r--r-- | ext/bg/js/dictionary.js | 18 | ||||
-rw-r--r-- | ext/bg/js/translator.js | 1 |
3 files changed, 13 insertions, 10 deletions
diff --git a/.gitattributes b/.gitattributes index c575774d..c891610e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,5 @@ -util/data/*dic* filter=lfs diff=lfs merge=lfs -text ext/bg/data/*dic* filter=lfs diff=lfs merge=lfs -text +ext/bg/data/edict/*.json filter=lfs diff=lfs merge=lfs -text +ext/bg/data/enamdict/*.json filter=lfs diff=lfs merge=lfs -text +ext/bg/data/kanjidic/*.json filter=lfs diff=lfs merge=lfs -text *.ttf filter=lfs diff=lfs merge=lfs -text diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js index 3fceef65..4baa41c8 100644 --- a/ext/bg/js/dictionary.js +++ b/ext/bg/js/dictionary.js @@ -108,12 +108,12 @@ class Dictionary { } }).then(() => { const loaders = []; - for (let i = 0; i <= index.refs; ++i) { - const refUrl = `${indexDir}/ref_${i}.json`; + for (let i = 1; i <= index.banks; ++i) { + const bankUrl = `${indexDir}/bank_${i}.json`; loaders.push(() => { - return loadJson(refUrl).then((refs) => { + return loadJson(bankUrl).then((defs) => { const rows = []; - for (const [expression, reading, tags, ...glossary] of refs) { + for (const [expression, reading, tags, ...glossary] of defs) { rows.push({expression, reading, tags, glossary}); } @@ -137,13 +137,13 @@ class Dictionary { return loadJson(indexUrl).then((index) => { const loaders = []; - for (let i = 0; i <= index.refs; ++i) { - const refUrl = `${indexDir}/ref_${i}.json`; + for (let i = 1; i <= index.banks; ++i) { + const bankUrl = `${indexDir}/bank_${i}.json`; loaders.push(() => { - return loadJson(refUrl).then((refs) => { + return loadJson(bankUrl).then((defs) => { const rows = []; - for (const [character, onyomi, kunyomi, tags, ...glossary] of refs) { - rows.push({character, onyomi, kunyomi, tags, glossary}); + for (const [character, onyomi, kunyomi, tags, ...meanings] of defs) { + rows.push({character, onyomi, kunyomi, tags, meanings}); } return this.db.kanji.bulkAdd(rows); diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js index 30045378..d1a92d08 100644 --- a/ext/bg/js/translator.js +++ b/ext/bg/js/translator.js @@ -43,6 +43,7 @@ class Translator { } else { this.dictionary.initDb(); return Promise.all([ + this.dictionary.importKanjiDict('bg/data/kanjidic/index.json'), this.dictionary.importTermDict('bg/data/edict/index.json'), this.dictionary.importTermDict('bg/data/enamdict/index.json') ]); |