Giter Club home page Giter Club logo

Comments (2)

ninja33 avatar ninja33 commented on August 27, 2024

恩,你的建议很好。插件当前的做法是在浏览器右上方快捷选项处选择不同词典后,再次点击单词以查出不同的结果。你的问题我理解为“希望能在弹窗里,直接在不同的词典间切换,查看翻译结果”。技术上是可行的,毕竟goldendict就是这么干的,但实际上goldendict完全是本地词典,不需要考虑网络开销以及等待时间,所以你可以看到goldendict的切换实质上只是定位快捷,你用鼠标拖动查询结果窗口可以看见,它把你选中的所有词典内容一次性都翻译了。

但是这个在网络词典查询上就不太可行。目前弹窗是用来显示查询结果,没有结果就不显示。那么在某个词典有查询结果并显示弹窗的情况下,原来的逻辑就到此结束了。但要是加上下拉菜单选择另一本词典,那么就要触发另一次查询,而新选的词典未必有解释,那么可不可以做一个预查询,有结果的再显示在下拉菜单里呢?这里就涉及到在线词典的每次弹窗是要一次性把所有词典的内容都查出来,还是按照后台选项的当前词典按需查询。目前为了降低网络开销是按需查询。如果不是把当前所选单词的内容一次性都查出来,在弹窗里做一个切换的下拉菜单就不是很有意义。但如果一次性都查完的话呢,效率会很差,你选中5本词典,就要等5本中查询时间最长那本词典有返回信息了,才会显示弹窗。而大部分时间里只会看1-2本词典内容,这就造成了有些词典的内容查了未必会切过去看,浪费大部分的等待时间。最后,并不是所有选中的词典都能合在一起做预查询的,比如不同语种的词典就不行,强行合并只会造成查询超时。

网络词典查询的响应时长如果超过1秒,实际使用感受就会很差。插件目前的方案是在易用性和效率之间,向效率妥协了。

那么你讲的这个问题在目前插件的设计方案里,其实可以用自定义查询脚本来解决。其实你不用切换,你把2-3本你喜欢的常用的词典脚本,而且是同语种的词典,合并成一本词典。在后台的脚本清单里,有一本合并了离线柯林斯和离线牛津的词典, 脚本名称为 builtin_encn_CollinsOxford 你可以作为查考去看看,然后自定义合并出一本自己喜欢的词典。

如有任何问题,可以继续留言讨论。

from odh.

TheKiteRunning avatar TheKiteRunning commented on August 27, 2024

我下去试一下,非常感谢老黄的耐心解释!

from odh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.