diff options
Diffstat (limited to 'ext/js/language/translator.js')
-rw-r--r-- | ext/js/language/translator.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js index 8519b728..c35d2203 100644 --- a/ext/js/language/translator.js +++ b/ext/js/language/translator.js @@ -828,12 +828,14 @@ class Translator { { if (data.reading !== reading) { continue; } const pitches = []; - for (const {position, tags} of data.pitches) { + for (const {position, tags, nasal, devoice} of data.pitches) { const tags2 = []; if (Array.isArray(tags) && tags.length > 0) { tags2.push(this._createTagGroup(dictionary, tags)); } - pitches.push({position, tags: tags2}); + const nasalPositions = this._toNumberArray(nasal); + const devoicePositions = this._toNumberArray(devoice); + pitches.push({position, nasalPositions, devoicePositions, tags: tags2}); } for (const {pronunciations, headwordIndex} of targets) { pronunciations.push(this._createTermPronunciation( @@ -968,6 +970,10 @@ class Translator { return JSON.stringify(array); } + _toNumberArray(value) { + return Array.isArray(value) ? value : (typeof value === 'number' ? [value] : []); + } + // Kanji data _createKanjiStat(name, value, databaseInfo, dictionary) { |