xnx3 / translate

Two lines of js realize automatic html translation. No need to change the page, no language configuration file, no API key, SEO friendly!
Apache License 2.0
538 stars 75 forks source link

翻译的时候出错 #12

Open fuxiaohui opened 1 year ago

fuxiaohui commented 1 year ago

报的错误为: Uncaught (in promise) SyntaxError: Invalid regular expression: /This event is sponsored by the International Youth Leadership Foundation (referred to as /g: Unterminated group

定位到指定位置: f[s][r].array[E] < 1 || (Q = Q.replace(new RegExp(translate.util.regExp.pattern(f[s][r].array[E]),"g"), translate.util.regExp.resultText("\n")));

fuxiaohui commented 1 year ago

我是暂时把 Q = Q.replace(new RegExp(translate.util.regExp.pattern(f[s][r].array[E]),"g"), translate.util.regExp.resultText("\n") 先去掉了,项目先正常执行,后面看看有什么问题

xnx3 commented 1 year ago

前两天修复了一个跟这个有关的,翻译文本中包含括号会导致异常的问题,可能跟你这个有关,可以试试,如果不是,你可以用git里的 /translate.js/translate.js ,而不是使用cdn的,毕竟cdn的是被压缩后的,没法定位到哪行出现什么