Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【v10.2.3 已修复】使用谷歌翻译单词 / 词组(例如 mechanism)时划词翻译偶尔会消失 / 白屏 #1835

Closed
Serendipithub opened this issue Sep 13, 2023 · 26 comments
Labels
bug 优先级 P0 最优先要解决的问题,会为此立刻发布一个新版本解决,一般只有非常严重的 bug 才会设置为 P0。

Comments

@Serendipithub
Copy link

Serendipithub commented Sep 13, 2023

作者的话:

v10.2.3 已修复此问题,解决方案见 https://hcfy.app/blog/2023/09/13/ggcrash

以下是原文


基本信息

划词翻译版本:v10.2.2
浏览器版本:Chrome Version 116.0.5845.187 (Official Build) (64-bit)
操作系统:Windows 11

重现问题的步骤

  1. 随便打开一个网页
  2. 进行翻译
  3. 程序崩溃, 先闪出翻译框, 然后消失. 我打开独立窗口看了下控制台, 显示如下
    image
461.js:2 TypeError: Cannot read properties of undefined (reading 'join')
    at 704.js:1:15961
    at Array.map (<anonymous>)
    at N (704.js:1:15932)
    at _a (461.js:2:243984)
    at Tu (461.js:2:255615)
    at _s (461.js:2:301706)
    at wl (461.js:2:289991)
    at yl (461.js:2:289919)
    at gl (461.js:2:289782)
    at al (461.js:2:286589)
du @ 461.js:2
461.js:2 Uncaught TypeError: Cannot read properties of undefined (reading 'join')
    at 704.js:1:15961
    at Array.map (<anonymous>)
    at N (704.js:1:15932)
    at _a (461.js:2:243984)
    at Tu (461.js:2:255615)
    at _s (461.js:2:301706)
    at wl (461.js:2:289991)
    at yl (461.js:2:289919)
    at gl (461.js:2:289782)
    at al (461.js:2:286589)

预期行为

预期正常翻译

实际行为

实际闪烁翻译框后页面消失

补充信息

我调试了一下
image

发现 const s = e.terms.join(", ");这一行中的e根本没有terms这个属性, 所以命令行提示TypeError: Cannot read properties of undefined (reading 'join'), 明显是读取terms为undefined的错误.

@lmk123 lmk123 added bug 优先级 P0 最优先要解决的问题,会为此立刻发布一个新版本解决,一般只有非常严重的 bug 才会设置为 P0。 and removed 待确认 labels Sep 13, 2023
@lmk123
Copy link
Member

lmk123 commented Sep 13, 2023

感谢如此详细的反馈!我正在加紧修复中,完成后将立刻发布新版本

@Serendipithub
Copy link
Author

同样的BUG出现在了这个Issue中 https://github.com/hcfyapp/crx-selection-translate/issues/1836

@lmk123
Copy link
Member

lmk123 commented Sep 13, 2023

经过目前的两个反馈得出的结论:

  • 错误出现在“谷歌翻译”
  • 错误的原因是因为谷歌翻译返回的结果当中缺少了 terms

但奇怪的是我这边没有重现你们的问题,我试着用谷歌翻译 mechanism奖品礼品 均能正常出现翻译结果。

所以两位 @Serendipithub @SnowGuest 可否帮忙提供更多信息:

  • 你们的谷歌翻译是通过什么方式使用的?是镜像地址、用了梯子还是改了 IP?
  • 如果是镜像地址,麻烦提供具体的地址给我
  • 如果是改了 IP,麻烦提供具体的 IP 给我

虽然我可以简单的给 terms 做个 undefined 判断来解决这个问题,但是我还是希望我能重现这个问题并确认这个问题是否是由更深层次的原因造成的

@Serendipithub
Copy link
Author

谷歌翻译是默认的, 本身是使用的VPN.

@lmk123
Copy link
Member

lmk123 commented Sep 13, 2023

可否帮忙在你那边打开下面这个链接,它会下载一个 json 文件,然后把 json 文件内容提交到 issue 里

https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=zh-CN&dj=1&dt=t&dt=bd&dt=qc&dt=rm&dt=ex&dt=at&dt=ss&dt=rw&dt=ld&q=mechanism&tk=848544.848544

@Serendipithub
Copy link
Author

奇怪了, 我调整了deepl和Google 翻译的顺序后, 问题复现不出来了. 如下图, deepl在上, Google在下:
image

@Serendipithub
Copy link
Author

Serendipithub commented Sep 13, 2023

文件内容如下

{"sentences":[{"trans":"机制","orig":"mechanism","backend":10},{"translit":"Jīzhì","src_translit":"ˈmekəˌnizəm"}],"dict":[{"pos":"noun","terms":["机制","机理","机构","机械","机关"],"entry":[{"word":"机制","reverse_translation":["mechanism"],"score":0.43009463},{"word":"机理","reverse_translation":["mechanism"],"score":0.26914635},{"word":"机构","reverse_translation":["mechanism","agency","institution","organization"],"score":0.22313017},{"word":"机械","reverse_translation":["mechanical","machinery","machine","mechanism"],"score":0.007061308},{"word":"机关","reverse_translation":["organ","body","office","mechanism","stratagem","intrigue"],"score":2.3419065E-4}],"base_form":"mechanism","pos_enum":1}],"src":"en","alternative_translations":[{"src_phrase":"mechanism","alternative":[{"word_postproc":"机制","score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[10,3],"backend_infos":[{"backend":3}]},{"word_postproc":"机理","score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[2,8]},{"word_postproc":"机构","score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[2]}],"srcunicodeoffsets":[{"begin":0,"end":9}],"raw_src_segment":"mechanism","start_pos":0,"end_pos":0}],"confidence":1.0,"spell":{},"ld_result":{"srclangs":["en"],"srclangs_confidences":[1.0],"extended_srclangs":["en"]},"synsets":[{"pos":"noun","entry":[{"synonym":["apparatus","machine","appliance","tool","device","implement","utensil","instrument","contraption","contrivance","gadget","tackle","structure","system"],"definition_id":"m_en_gbus0628220.006"},{"synonym":["gizmo"],"definition_id":"m_en_gbus0628220.006","label_info":{"register":["informal"]}},{"synonym":["machinery","workings","works","movement","motion","action","gear","gears","wheels","components","motor","engine","power source"],"definition_id":"m_en_gbus0628220.006"},{"synonym":["innards","guts"],"definition_id":"m_en_gbus0628220.006","label_info":{"register":["informal"]}},{"synonym":["procedure","process","system","operation","method","technique","workings","means","medium","agency","channel","channels","vehicle","structure"],"definition_id":"m_en_gbus0628220.006"}],"base_form":"mechanism","pos_enum":1}],"examples":{"example":[{"text":"we have no \u003cb\u003emechanism\u003c/b\u003e for assessing the success of forwarded inquiries","source_type":3,"definition_id":"m_en_gbus0628220.011"},{"text":"his Irma La Douce is a musical based on the farce \u003cb\u003emechanism\u003c/b\u003e","source_type":3,"definition_id":"m_en_gbus0628220.012"},{"text":"the \u003cb\u003emechanism\u003c/b\u003e by which genes build bodies","source_type":3,"definition_id":"m_en_gbus0628220.011"},{"text":"the gunner injured his arm in the turret \u003cb\u003emechanism\u003c/b\u003e","source_type":3,"definition_id":"m_en_gbus0628220.006"}]}}

@Serendipithub
Copy link
Author

奇怪了, 我调整了deepl和Google 翻译的顺序后, 问题复现不出来了. 如下图, deepl在上, Google在下: image

现在单独的Google 翻译也没有问题了. 可能是刚才Google的翻译服务出现了问题? 不一定是即时翻译的BUG? 因为我们两个的ISSUE的时间真的挺相近的.

@haochuan9421
Copy link

MacOS 也遇到了这个问题, 根据我的使用来看,和翻译哪个单词关系不大,同一个单词有时可以翻译出来,有时会抛错

image

@Serendipithub
Copy link
Author

MacOS 也遇到了这个问题, 根据我的使用来看,和翻译哪个单词关系不大,同一个单词有时可以翻译出来,有时会抛错

image

我现在翻译没有任何问题了. 会不会是刚才的一段时间, Google Translate的API出现了问题?

@haochuan9421
Copy link

MacOS 也遇到了这个问题, 根据我的使用来看,和翻译哪个单词关系不大,同一个单词有时可以翻译出来,有时会抛错
image

我现在翻译没有任何问题了. 会不会是刚才的一段时间, Google Translate的API出现了问题?

我现在还可以复现这个问题

@Serendipithub
Copy link
Author

MacOS 也遇到了这个问题, 根据我的使用来看,和翻译哪个单词关系不大,同一个单词有时可以翻译出来,有时会抛错
image

我现在翻译没有任何问题了. 会不会是刚才的一段时间, Google Translate的API出现了问题?

我现在还可以复现这个问题

我建议你可以先关闭Google Translate, 只使用其他的接口(DeepL)缓一段时间, 可能等个几个小时Google就正常了

@lmk123
Copy link
Member

lmk123 commented Sep 13, 2023

@haochuan9421 可否帮忙在你那边打开下面这个链接,它会下载一个 json 文件,然后把 json 文件内容提交到 issue 里

https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=zh-CN&dj=1&dt=t&dt=bd&dt=qc&dt=rm&dt=ex&dt=at&dt=ss&dt=rw&dt=ld&q=mechanism&tk=848544.848544

@haochuan9421
Copy link

{"sentences":[{"trans":"机制","orig":"mechanism","backend":10},{"translit":"Jīzhì","src_translit":"ˈmekəˌnizəm"}],"dict":[{"pos":"noun","entry":[{"word":"机制","reverse_translation":["mechanism"],"score":0.43009463},{"word":"机理","reverse_translation":["mechanism"],"score":0.26914635},{"word":"机构","reverse_translation":["mechanism","agency","institution","organization"],"score":0.22313017},{"word":"机械","reverse_translation":["mechanical","machinery","machine","mechanism"],"score":0.007061308},{"word":"机关","reverse_translation":["organ","body","office","mechanism","stratagem","intrigue"],"score":2.3419065E-4}],"base_form":"mechanism","pos_enum":1}],"src":"en","alternative_translations":[{"src_phrase":"mechanism","alternative":[{"word_postproc":"机制","score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[10,3],"backend_infos":[{"backend":3}]},{"word_postproc":"机理","score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[2,8]},{"word_postproc":"机构","score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[2]}],"srcunicodeoffsets":[{"begin":0,"end":9}],"raw_src_segment":"mechanism","start_pos":0,"end_pos":0}],"confidence":1.0,"spell":{},"ld_result":{"srclangs":["en"],"srclangs_confidences":[1.0],"extended_srclangs":["en"]},"synsets":[{"pos":"noun","entry":[{"synonym":["apparatus","machine","appliance","tool","device","implement","utensil","instrument","contraption","contrivance","gadget","tackle","structure","system"],"definition_id":"m_en_gbus0628220.006"},{"synonym":["gizmo"],"definition_id":"m_en_gbus0628220.006","label_info":{"register":["informal"]}},{"synonym":["machinery","workings","works","movement","motion","action","gear","gears","wheels","components","motor","engine","power source"],"definition_id":"m_en_gbus0628220.006"},{"synonym":["innards","guts"],"definition_id":"m_en_gbus0628220.006","label_info":{"register":["informal"]}},{"synonym":["procedure","process","system","operation","method","technique","workings","means","medium","agency","channel","channels","vehicle","structure"],"definition_id":"m_en_gbus0628220.006"}],"base_form":"mechanism","pos_enum":1}],"examples":{"example":[{"text":"the \u003cb\u003emechanism\u003c/b\u003e by which genes build bodies","definition_id":"m_en_gbus0628220.011"},{"text":"his Irma La Douce is a musical based on the farce \u003cb\u003emechanism\u003c/b\u003e","definition_id":"m_en_gbus0628220.012"},{"text":"we have no \u003cb\u003emechanism\u003c/b\u003e for assessing the success of forwarded inquiries","definition_id":"m_en_gbus0628220.011"},{"text":"the gunner injured his arm in the turret \u003cb\u003emechanism\u003c/b\u003e","definition_id":"m_en_gbus0628220.006"}]}}

@Serendipithub
Copy link
Author

{"sentences":[{"trans":"机制","orig":"mechanism","backend":10},{"translit":"Jīzhì","src_translit":"ˈmekəˌnizəm"}],"dict":[{"pos":"noun","entry":[{"word":"机制","reverse_translation":["mechanism"],"score":0.43009463},{"word":"机理","reverse_translation":["mechanism"],"score":0.26914635},{"word":"机构","reverse_translation":["mechanism","agency","institution","organization"],"score":0.22313017},{"word":"机械","reverse_translation":["mechanical","machinery","machine","mechanism"],"score":0.007061308},{"word":"机关","reverse_translation":["organ","body","office","mechanism","stratagem","intrigue"],"score":2.3419065E-4}],"base_form":"mechanism","pos_enum":1}],"src":"en","alternative_translations":[{"src_phrase":"mechanism","alternative":[{"word_postproc":"机制","score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[10,3],"backend_infos":[{"backend":3}]},{"word_postproc":"机理","score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[2,8]},{"word_postproc":"机构","score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[2]}],"srcunicodeoffsets":[{"begin":0,"end":9}],"raw_src_segment":"mechanism","start_pos":0,"end_pos":0}],"confidence":1.0,"spell":{},"ld_result":{"srclangs":["en"],"srclangs_confidences":[1.0],"extended_srclangs":["en"]},"synsets":[{"pos":"noun","entry":[{"synonym":["apparatus","machine","appliance","tool","device","implement","utensil","instrument","contraption","contrivance","gadget","tackle","structure","system"],"definition_id":"m_en_gbus0628220.006"},{"synonym":["gizmo"],"definition_id":"m_en_gbus0628220.006","label_info":{"register":["informal"]}},{"synonym":["machinery","workings","works","movement","motion","action","gear","gears","wheels","components","motor","engine","power source"],"definition_id":"m_en_gbus0628220.006"},{"synonym":["innards","guts"],"definition_id":"m_en_gbus0628220.006","label_info":{"register":["informal"]}},{"synonym":["procedure","process","system","operation","method","technique","workings","means","medium","agency","channel","channels","vehicle","structure"],"definition_id":"m_en_gbus0628220.006"}],"base_form":"mechanism","pos_enum":1}],"examples":{"example":[{"text":"the \u003cb\u003emechanism\u003c/b\u003e by which genes build bodies","definition_id":"m_en_gbus0628220.011"},{"text":"his Irma La Douce is a musical based on the farce \u003cb\u003emechanism\u003c/b\u003e","definition_id":"m_en_gbus0628220.012"},{"text":"we have no \u003cb\u003emechanism\u003c/b\u003e for assessing the success of forwarded inquiries","definition_id":"m_en_gbus0628220.011"},{"text":"the gunner injured his arm in the turret \u003cb\u003emechanism\u003c/b\u003e","definition_id":"m_en_gbus0628220.006"}]}}{"sentences":[{"trans":"","orig":"机制","机制后端":10},{"translit":"Jīzhì","src_translit":"ˈmekəˌnizəm"}]," dict":[{"pos":"名词","entry":[{"word":"机制","re​​verse_translation":["mechanism"],"score":0.43009463},{"word":" ","re​​verse_translation":["机制"],"score":0.26914635},{"word":"机构","re​​verse_translation":["机制","机构","机构","组织"] ,"score":0.22313017},{"word":"机械","re​​verse_translation":["机械","机械","机器","机制"],"score":0.007061308},{"word" :"机关","re​​verse_translation":["机关","身体","办公室","机制","策略","阴谋"],"分数":2.3419065E-4}],"base_form": "mechanism","pos_enum":1}],"src":"en","alternative_translations":[{"src_phrase":"mechanism","alternative":[{"word_postproc":"机制","score ":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[10,3],"backend_infos":[{"backend":3}]},{"word_postproc":"宽度", "score":1000,"has_preceding_space":true,"attach_to_next_token":false,"backends":[2,8]},{"word_postproc":"机构","score":1000,"has_preceding_space":true, "attach_to_next_token":false,"backends":[2]}],"srcunicodeoffsets":[{"begin":0,"end":9}],"raw_src_segment":"机制","start_pos":0, "end_pos":0}],"confidence":1.0,"spell":{},"ld_result":{"srclangs":["en"],"srclangs_confidences":[1.0],"extended_srclangs":[" en"]},"synsets":[{"pos":"名词","entry":[{"synonym":["apparatus","machine","appliance","tool","device", "工具","器具","仪器","装置","发明","小工具","钓具","结构","系统"],"definition_id":"m_en_gbus0628220.006"},{"同义词":["gizmo"],"definition_id":"m_en_gbus0628220。006","label_info":{"register":["非正式"]}},{"synonym":["机械","工作","工作","运动","运动","动作", "齿轮","齿轮","车轮","组件","电机","发动机","动力源"],"definition_id":"m_en_gbus0628220.006"},{"synonym":["内部结构" ,"guts"],"definition_id":"m_en_gbus0628220.006","label_info":{"register":["非正式"]}},{"synonym":["过程","流程","系统" ,"操作","方法","技术","工作方式","手段","媒介","机构","渠道","渠道","车辆","结构"],"definition_id": "m_en_gbus0628220.006"}],"base_form":"机制","pos_enum":1}],"examples":{"example":[{"text":"\u003cb\u003emechanism\u003c/b\ u003e 基因构建身体的依据","definition_id":"m_en_gbus0628220.011"},{"text":"他的 Irma La Douce 是一部基于闹剧 \u003cb\u003emechanism\u003c/b\u003e 的音乐剧","definition_id ":"m_en_gbus0628220.012"},{"text":"我们没有用于评估转发查询是否成功的\u003cb\u003emechanism\u003c/b\u003e","definition_id":"m_en_gbus0628220.011"},{" text":"炮手在炮塔\u003cb\u003emechanism\u003c/b\u003e中手臂受伤","definition_id":"m_en_gbus0628220.006"}]}}

这么看确实是Google Translate的问题.
如图, 左侧是出现问题的JSON, 右侧是我现在没问题的JSON, 少了一个terms字段.
image

@lmk123
Copy link
Member

lmk123 commented Sep 13, 2023

经过对比,出现问题时的谷歌翻译接口少了 terms,如下图:

image

这下我就知道原因了,将尽快修复

@haochuan9421
Copy link

大佬尽快发一版吧,覆盖一下这个 Case,我还是比较习惯谷歌翻译的结果

@lmk123 lmk123 closed this as completed Sep 13, 2023
@lmk123 lmk123 changed the title BUG导致整个app崩溃 【v10.2.3 已修复】使用谷歌翻译单词 / 词组(例如 mechanism )时划词翻译偶尔会消失 / 白屏 Sep 13, 2023
@lmk123 lmk123 changed the title 【v10.2.3 已修复】使用谷歌翻译单词 / 词组(例如 mechanism )时划词翻译偶尔会消失 / 白屏 【v10.2.3 已修复】使用谷歌翻译单词 / 词组(例如 mechanism)时划词翻译偶尔会消失 / 白屏 Sep 13, 2023
@lmk123
Copy link
Member

lmk123 commented Sep 13, 2023

v10.2.3 的离线安装包已上传到网盘 https://hcfy.app/docs/install/#offline

由于我无法重现这个问题,所以希望 @haochuan9421 能在使用之后给我一个反馈,让我确认问题确实修复了

@haochuan9421
Copy link

v10.2.3 的离线安装包已上传到网盘 https://hcfy.app/docs/install/#offline

由于我无法重现这个问题,所以希望 @haochuan9421 能在使用之后给我一个反馈,让我确认问题确实修复了

👌

@haochuan9421
Copy link

使用谷歌翻译了差不多 20 次,目前没有再发生页面崩溃。

@lmk123
Copy link
Member

lmk123 commented Sep 13, 2023

@haochuan9421 感谢反馈,如果之后又遇到崩溃麻烦尽快提交到这里,我会第一时间修复

@haochuan9421
Copy link

@haochuan9421 感谢反馈,如果之后又遇到崩溃麻烦尽快提交到这里,我会第一时间修复

👌

@lmk123 lmk123 pinned this issue Sep 14, 2023
@Littleweisheit
Copy link

Littleweisheit commented Sep 14, 2023

火狐版怎么办?火狐几个月没更新了

@lmk123
Copy link
Member

lmk123 commented Sep 14, 2023

@Littleweisheit 今天提交了火狐审核,预计 10 个工作日后上架

@whtiehack
Copy link

whtiehack commented Sep 14, 2023

麻烦更新一下edge的...

@lmk123
Copy link
Member

lmk123 commented Sep 14, 2023

@whtiehack 已提交,正在审核,大约 10 个工作日

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 优先级 P0 最优先要解决的问题,会为此立刻发布一个新版本解决,一般只有非常严重的 bug 才会设置为 P0。
Projects
None yet
Development

No branches or pull requests

5 participants