summaryrefslogtreecommitdiff
path: root/ext/bg/js/translator.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-04-17 19:06:57 -0700
committerAlex Yatskov <alex@foosoft.net>2016-04-17 19:06:57 -0700
commitd5170414af9287143a9906fd81fde49318be4617 (patch)
tree27764bde977e1e17c36543f3f53d1b29b0584f74 /ext/bg/js/translator.js
parentde268e73a613b963ea982f34ca7439d57694facd (diff)
Adding kanji links
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));