aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/translator.js')
-rw-r--r--ext/bg/js/translator.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/bg/js/translator.js b/ext/bg/js/translator.js
index 46d63ed0..1a024a40 100644
--- a/ext/bg/js/translator.js
+++ b/ext/bg/js/translator.js
@@ -166,6 +166,21 @@ class Translator {
}
}
+ static isHiragana(c) {
+ const code = c.charCodeAt(0);
+ return code >= 0x3040 && code < 0x30a0;
+ }
+
+ static isKatakana(c) {
+ const code = c.charCodeAt(0);
+ return code >= 0x30a0 && code < 0x3100;
+ }
+
+ static isKanji(c) {
+ const code = c.charCodeAt(0);
+ return code >= 0x4e00 && code < 0x9fb0 || code >= 0x3400 && code < 0x4dc0;
+ }
+
static loadData(url, callback) {
const xhr = new XMLHttpRequest();
xhr.addEventListener('load', () => callback(xhr.responseText));