summaryrefslogtreecommitdiff
path: root/ext/bg/js/japanese.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-17 01:32:01 +0300
committerGitHub <noreply@github.com>2020-04-17 01:32:01 +0300
commit8c16a6e580bfdd70e27df1816ca90807062cf9b5 (patch)
tree25f551dfaa68427cd873fbd822abf0f2bfe09b76 /ext/bg/js/japanese.js
parente6053eefa594524c7adcec4986a5a2c499adf192 (diff)
parent619df42aedaa8da97d0a16d539b7211349143a0a (diff)
Merge pull request #456 from siikamiika/parse-text-refactor
Parse text refactor
Diffstat (limited to 'ext/bg/js/japanese.js')
-rw-r--r--ext/bg/js/japanese.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/bg/js/japanese.js b/ext/bg/js/japanese.js
index 5fef27a7..ac81acb5 100644
--- a/ext/bg/js/japanese.js
+++ b/ext/bg/js/japanese.js
@@ -124,25 +124,25 @@
return wanakana.toRomaji(text);
}
- function convertReading(expressionFragment, readingFragment, readingMode) {
+ function convertReading(expression, reading, readingMode) {
switch (readingMode) {
case 'hiragana':
- return convertKatakanaToHiragana(readingFragment || '');
+ return convertKatakanaToHiragana(reading);
case 'katakana':
- return convertHiraganaToKatakana(readingFragment || '');
+ return convertHiraganaToKatakana(reading);
case 'romaji':
- if (readingFragment) {
- return convertToRomaji(readingFragment);
+ if (reading) {
+ return convertToRomaji(reading);
} else {
- if (isStringEntirelyKana(expressionFragment)) {
- return convertToRomaji(expressionFragment);
+ if (isStringEntirelyKana(expression)) {
+ return convertToRomaji(expression);
}
}
- return readingFragment;
+ return reading;
case 'none':
- return null;
+ return '';
default:
- return readingFragment;
+ return reading;
}
}
@@ -300,7 +300,7 @@
const readingLeft = reading2.substring(group.text.length);
const segs = segmentize(readingLeft, groups.splice(1));
if (segs) {
- return [{text: group.text}].concat(segs);
+ return [{text: group.text, furigana: ''}].concat(segs);
}
}
} else {
@@ -368,7 +368,7 @@
}
if (stemLength !== source.length) {
- output.push({text: source.substring(stemLength)});
+ output.push({text: source.substring(stemLength), furigana: ''});
}
return output;