diff options
author | marv <rotrobmin@gmail.com> | 2023-12-18 01:57:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-18 09:57:14 +0000 |
commit | fef568b89db1517481f76b0acfcd6796da693d20 (patch) | |
tree | c6ba042ec7f9b6c8dd39c0fbe1328d8e0bfcc7eb /ext/js/language | |
parent | d594d49ea81e1b546b6e39b7f85f098d9dc6fc48 (diff) |
Fix Non JP Scanning Option for Kanji Dictionaries (#372)
* Fix non JP scanning option for kanji dictionaries
* Fix trailing comma
* Add removeNonJapaneseCharacters to test inputs
Diffstat (limited to 'ext/js/language')
-rw-r--r-- | ext/js/language/translator.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js index aa1b71dd..e33ea4d4 100644 --- a/ext/js/language/translator.js +++ b/ext/js/language/translator.js @@ -125,6 +125,9 @@ export class Translator { * @returns {Promise<import('dictionary').KanjiDictionaryEntry[]>} An array of definitions. See the _createKanjiDefinition() function for structure details. */ async findKanji(text, options) { + if (options.removeNonJapaneseCharacters) { + text = this._getJapaneseOnlyText(text); + } const {enabledDictionaryMap} = options; const kanjiUnique = new Set(); for (const c of text) { |