File tree 2 files changed +4
-3
lines changed 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -6,20 +6,21 @@ const openCCPath = "https://cdn.jsdelivr.net/npm/opencc-js@1.0.5/dist/umd/full.m
6
6
const dictPath = "https:/cdn.jsdelivr.net/npm/kuromoji@0.1.2/dict" ;
7
7
8
8
class Translator {
9
- constructor ( lang ) {
9
+ constructor ( lang , isUsingNetease = false ) {
10
10
this . finished = {
11
11
ja : false ,
12
12
ko : false ,
13
13
zh : false ,
14
14
} ;
15
+ this . isUsingNetease = isUsingNetease ;
15
16
16
17
this . applyKuromojiFix ( ) ;
17
18
this . injectExternals ( lang ) ;
18
19
this . createTranslator ( lang ) ;
19
20
}
20
21
21
22
includeExternal ( url ) {
22
- if ( CONFIG . visual . translate && ! document . querySelector ( `script[src="${ url } "]` ) ) {
23
+ if ( ( CONFIG . visual . translate || this . isUsingNetease ) && ! document . querySelector ( `script[src="${ url } "]` ) ) {
23
24
const script = document . createElement ( "script" ) ;
24
25
script . setAttribute ( "type" , "text/javascript" ) ;
25
26
script . setAttribute ( "src" , url ) ;
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ const Utils = {
70
70
*/
71
71
async toSimplifiedChinese ( s ) {
72
72
// create a singleton Translator instance
73
- if ( ! this . _translatorInstance ) this . translator = new Translator ( "zh" ) ;
73
+ if ( ! this . _translatorInstance ) this . translator = new Translator ( "zh" , true ) ;
74
74
75
75
// translate to Simplified Chinese
76
76
// as Traditional Chinese differs between HK and TW, forcing to use OpenCC standard
You can’t perform that action at this time.
0 commit comments