summaryrefslogtreecommitdiff
path: root/ext/js/language/translator.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-06 15:53:45 -0500
committerGitHub <noreply@github.com>2021-03-06 15:53:45 -0500
commit16217728afe0f9ff7dcbb7c7b7ead454ccc8705f (patch)
tree126bc188bd675343ee4e796826177e14f6664094 /ext/js/language/translator.js
parenta65742a884223451324fcab5cfaeb6ebdfe32ec1 (diff)
Improve empty reading handling (#1497)
* Handle empty readings earlier in the definition creation process * Remove empty reading check * Remove special handling of empty readings
Diffstat (limited to 'ext/js/language/translator.js')
-rw-r--r--ext/js/language/translator.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js
index 28cc1f3c..0533f70b 100644
--- a/ext/js/language/translator.js
+++ b/ext/js/language/translator.js
@@ -648,8 +648,7 @@ class Translator {
for (const {expressions, frequencies: frequencies1, pitches: pitches1} of allDefinitions) {
for (let i = 0, ii = expressions.length; i < ii; ++i) {
- let {expression, reading, frequencies: frequencies2, pitches: pitches2} = expressions[i];
- if (reading.length === 0) { reading = expression; }
+ const {expression, reading, frequencies: frequencies2, pitches: pitches2} = expressions[i];
let readingMap = expressionMap.get(expression);
if (typeof readingMap === 'undefined') {
readingMap = new Map();
@@ -1079,7 +1078,8 @@ class Translator {
}
async _createTermDefinitionFromDatabaseDefinition(databaseDefinition, source, rawSource, sourceTerm, reasons, isPrimary, enabledDictionaryMap) {
- const {expression, reading, definitionTags, termTags, glossary, score, dictionary, id, sequence} = databaseDefinition;
+ const {expression, reading: rawReading, definitionTags, termTags, glossary, score, dictionary, id, sequence} = databaseDefinition;
+ const reading = (rawReading.length > 0 ? rawReading : expression);
const dictionaryOrder = this._getDictionaryOrder(dictionary, enabledDictionaryMap);
const termTagsExpanded = await this._expandTags(termTags, dictionary);
const definitionTagsExpanded = await this._expandTags(definitionTags, dictionary);