WIP
This commit is contained in:
parent
b2d9b613ad
commit
4bebe92159
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -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/*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
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
@ -108,12 +108,12 @@ class Dictionary {
|
|||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const loaders = [];
|
const loaders = [];
|
||||||
for (let i = 0; i <= index.refs; ++i) {
|
for (let i = 1; i <= index.banks; ++i) {
|
||||||
const refUrl = `${indexDir}/ref_${i}.json`;
|
const bankUrl = `${indexDir}/bank_${i}.json`;
|
||||||
loaders.push(() => {
|
loaders.push(() => {
|
||||||
return loadJson(refUrl).then((refs) => {
|
return loadJson(bankUrl).then((defs) => {
|
||||||
const rows = [];
|
const rows = [];
|
||||||
for (const [expression, reading, tags, ...glossary] of refs) {
|
for (const [expression, reading, tags, ...glossary] of defs) {
|
||||||
rows.push({expression, reading, tags, glossary});
|
rows.push({expression, reading, tags, glossary});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,13 +137,13 @@ class Dictionary {
|
|||||||
|
|
||||||
return loadJson(indexUrl).then((index) => {
|
return loadJson(indexUrl).then((index) => {
|
||||||
const loaders = [];
|
const loaders = [];
|
||||||
for (let i = 0; i <= index.refs; ++i) {
|
for (let i = 1; i <= index.banks; ++i) {
|
||||||
const refUrl = `${indexDir}/ref_${i}.json`;
|
const bankUrl = `${indexDir}/bank_${i}.json`;
|
||||||
loaders.push(() => {
|
loaders.push(() => {
|
||||||
return loadJson(refUrl).then((refs) => {
|
return loadJson(bankUrl).then((defs) => {
|
||||||
const rows = [];
|
const rows = [];
|
||||||
for (const [character, onyomi, kunyomi, tags, ...glossary] of refs) {
|
for (const [character, onyomi, kunyomi, tags, ...meanings] of defs) {
|
||||||
rows.push({character, onyomi, kunyomi, tags, glossary});
|
rows.push({character, onyomi, kunyomi, tags, meanings});
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.db.kanji.bulkAdd(rows);
|
return this.db.kanji.bulkAdd(rows);
|
||||||
|
@ -43,6 +43,7 @@ class Translator {
|
|||||||
} else {
|
} else {
|
||||||
this.dictionary.initDb();
|
this.dictionary.initDb();
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
|
this.dictionary.importKanjiDict('bg/data/kanjidic/index.json'),
|
||||||
this.dictionary.importTermDict('bg/data/edict/index.json'),
|
this.dictionary.importTermDict('bg/data/edict/index.json'),
|
||||||
this.dictionary.importTermDict('bg/data/enamdict/index.json')
|
this.dictionary.importTermDict('bg/data/enamdict/index.json')
|
||||||
]);
|
]);
|
||||||
|
Loading…
Reference in New Issue
Block a user