aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-23 20:28:38 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-24 20:15:25 -0500
commit538d83c5a6d846adfd275462910888572d52caf1 (patch)
tree226992f969a3a9fbf38b12d68b9f8158b68cfbff /ext/bg/js/translator.js
parent317bf35bc039fb82b558c66adac236ff6a84d762 (diff)
Reorganized variants to better reflect usage order
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r--ext/bg/js/translator.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index cda1099f..6ddf5431 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -323,27 +323,31 @@ class Translator {
getAllDeinflections(text, options) {
const translationOptions = options.translation;
const textOptionVariantArray = [
- Translator.getTextOptionEntryVariants(translationOptions.convertKatakanaToHiragana),
Translator.getTextOptionEntryVariants(translationOptions.convertHalfWidthCharacters),
Translator.getTextOptionEntryVariants(translationOptions.convertNumericCharacters),
- Translator.getTextOptionEntryVariants(translationOptions.convertAlphabeticCharacters)
+ Translator.getTextOptionEntryVariants(translationOptions.convertAlphabeticCharacters),
+ Translator.getTextOptionEntryVariants(translationOptions.convertKatakanaToHiragana)
];
const deinflections = [];
const used = new Set();
- for (const [hiragana, halfWidth, numeric, alphabetic] of Translator.getArrayVariants(textOptionVariantArray)) {
+ for (const [halfWidth, numeric, alphabetic, hiragana] of Translator.getArrayVariants(textOptionVariantArray)) {
let text2 = text;
let sourceMapping = null;
if (halfWidth) {
if (sourceMapping === null) { sourceMapping = Translator.createTextSourceMapping(text2); }
text2 = jpConvertHalfWidthKanaToFullWidth(text2, sourceMapping);
}
- if (numeric) { text2 = jpConvertNumericTofullWidth(text2); }
+ if (numeric) {
+ text2 = jpConvertNumericTofullWidth(text2);
+ }
if (alphabetic) {
if (sourceMapping === null) { sourceMapping = Translator.createTextSourceMapping(text2); }
text2 = jpConvertAlphabeticToKana(text2, sourceMapping);
}
- if (hiragana) { text2 = jpKatakanaToHiragana(text2); }
+ if (hiragana) {
+ text2 = jpKatakanaToHiragana(text2);
+ }
for (let i = text2.length; i > 0; --i) {
const text2Substring = text2.substring(0, i);