深度翻译诞生记
Tofloor
poster avatar
186******98
deepin
2013-12-14 01:44
Author
在Windows和Mac下面都有好的屏幕取词软件, 但是Linux的屏幕取词都不尽如人意, 遇到图片、影印PDF、或者很多鼠标不能选中的时候, 就要自己输入, 然后拷贝粘贴到翻译工具上, 试想一下如果平时我们在专心看外文资料, 移动鼠标就能干的活要这么累, 那是多么的没有效率?

作为Linux Deepin团队一员, 我们有责任让Linux的每个特性都要比其他操作系统更好, 但是因为项目优先级, 一直没有开展深度翻译的工作, 只是有一天写新版深度影音写累了(新版深度影音功能更碉堡, 会在深度翻译正式版完成后快速开发, 期待的同学不要一直催哈 ), 突然想到实现Linux OCR 的核心技术的方法, 这才让这个项目得以完成任意软件的屏幕取词功能。

这里还要感谢侯哥(深度音乐的作者)在前后端的大力协作开发, 深度翻译才能这么快的面世, BTW 剧透一下, 侯哥的下一个作品 Deepin Talk 简直是太酷了, 同样值得大家期待。

好了, 先说一下测试版怎么安装吧:

1. 打开软件中心切换到 官方测试源

2. 点击右上角菜单选择 “更新软件列表”

3. 在软件中心首页搜索 deepin-translator 进行安装 (如果软件中心搜索不了, 请用  sudo apt-get install deepin-translator 来安装)

深度翻译使用 X11/QML/OCR 的技术实现65种语言的互相翻译, 安装完成以后, 在启动器中点击深度翻译启动, 会发现托盘区域深度翻译已经常驻了。 然后操作就很简单了, 在屏幕上任意位置双击单词就可以弹出翻译并自动朗读, 单词翻译默认用的是有道翻译, 还可以进行相关单词的搜索翻译, 选中一段英文也可以进行长句翻译和朗读。如果遇到图片或者不想点击就翻译光标处的单词, 按下Alt键即可进行屏幕取词翻译。

托盘点右键菜单可以对 “取词后发音”, “按住Alt键取词” 等选项进行自定义设置, 如果需要调整语言和切换翻译引擎, 可以在设置界面中调整。

深度翻译现在还处于测试版, 国际化、美化工作工作还没有做, 欢迎朋友们各种吐槽、建议和开发贡献, git 地址在: https://github.com/linuxdeepin/deepin-translator  , enjoy!

交互小细节:
1. 翻译平常虽然开着, 但是不是任何时候都想翻译,如果刚好要翻译光标处的单词, 双击都不够懒, 按一下Alt就行了

2. Alt 按键虽然方便, 但是对于大量开发人员平常在按组合键的时候就会非常多的触发翻译窗口弹出, 深度翻译已经细心的研究了用户按键的时间, 一般人按Alt组合键的间隔是小于 300 毫秒的, 所以我们只有在人只按住 Alt 键超过300毫秒才开始弹出翻译窗口, 如果深度翻译发现你只是按Ctrl组合键路过打酱油的, 它会乖乖的在后台不弹出任何窗口来干扰用户。

3. 经常我们都会查询单词, 但是有时候又不记得几天前差的单词是什么, 把单词翻译窗口的输入清空一下, 看到什么了? 深度翻译会记忆最后你查询的5个单词, 以帮你进行穿越回忆

4. 深度翻译在网络没有连接的时候, 会自动切换到本地词典和语音合成来满足用户的需求, 当
有网络的时候再自动选用效果更好的网络取词。

5. 有时候网络是通的, 但是自己在下载或者网速问题, 这时候可以点击托盘菜单中的 “启用本地翻译” 来避免网络延时问题。

6. 普通人大部分只在两种语言之间进行翻译, 深度翻译的菜单和设置界面都一个非常方便的 “反向翻译” 按钮让用户可以快速的在母语和英语之间来回切换。

7. 深度翻译词典支持: 有道、Google、星际译王, 语音合成引擎有 有道、Google、SVOX, 你可以任何组合词典和语音之间的配合。

8. 有时候图片或者超链的文字没法点, 我们可以用OCR识别后, 直接点击窗口右上角的插件小图标, 就可以直接复制到系统粘贴板, 当然也可以直接查询当前单词的维基百科和Google搜索。

9. 绑定按键到 deepin-translator --search 可以直接弹出输入框进行搜索翻译, 2014 应该会默认绑定到 Ctrl + Alt + f 上.

10. 更多智能化的小功能我还在做, 做完就第一时间给大家分享。 :)
Reply Favorite View the author
All Replies
4 / 7
To page
186******98
deepin
2013-12-16 23:42
#61
[quote]发现一个问题:
在勾选“按Ctrl键翻译选区”后,双击单词自动显示翻译无效了
更新了以后没有“按Ctrl键翻译选区”这一项了,不过设置界面也全变成英文了
DeepinScreenshot20131216111015.png[/quote]
翻译是因为今天做版本更新引起的, 已经修复了
Reply View the author
295749093
deepin
2013-12-16 23:45
#62
DeepinScreenshot20131216144614.png
已经切换到测试源了,更新的时候报这个,如何解决?
Reply View the author
186******98
deepin
2013-12-16 23:55
#63
因为在你更新的时候我们又在测试源推送新版本了, 请用 sudo apt-get update 再刷一次, 谢谢!
Reply View the author
295749093
deepin
2013-12-17 00:22
#64
我已经安装完毕了,启动器里启动了深度翻译之后,任务栏没看到常常驻图标?
Reply View the author
kongsoon
deepin
2013-12-17 06:08
#65
必须顶。越来越看好深度了。加油
Reply View the author
Feng Yu
deepin
2013-12-17 06:25
#66
提个建议论坛发帖能否翻译啊,比如上国外论坛把中文写的帖子翻译成英文提交......
机器翻译的东西能拿得出手去给老外看?
你好歹自己组织语言啊,生词倒是可以查一下,整句翻译还是算了吧。
Reply View the author
jhkwei
deepin
2013-12-17 20:32
#67
能不能加一个接口直接调用google.baidu这些搜索
Reply View the author
tyh2020
deepin
2013-12-18 03:16
#68
弱弱地问一下,为什么这软件这么大??
Reply View the author
tyh2020
deepin
2013-12-18 03:23
#69
64位系统安装后无法启动软件
Reply View the author
186******98
deepin
2013-12-18 07:57
#70
64位系统安装后无法启动软件
请用软件中心升级一下系统, 然后删除 ~/.config/deepin-translator/config.init 文件后再启动深度翻译看看, 如果依然不能启动, 请在终端中输入 deepin-translator , 然后粘贴一下终端日志让我看看。

谢谢您的测试, 您的测试让 Linux Deepin 变得更好。
Reply View the author
deartobegod
deepin
2013-12-19 00:44
#71
翻译这一块还是和“有道”之类的公司合作比较好,就像输入法这一块一样,要做一个这样的软件需要的人手还是不少的。至于图片上取词,这个应该是模式识别算法,你们可能需要至少一个硕士团队来研究这个。当然我没有贬低deepin技术实力的意思,只是觉得这个软件貌似没有想象中简单。
Reply View the author
186******98
deepin
2013-12-19 01:42
#72
你可以尝试一下, 已经做出来了, 还有什么没有那么简单?
Reply View the author
木山
deepin
2013-12-19 07:31
#73
果然是碉堡应用
Reply View the author
155******29
deepin
2013-12-19 08:39
#74
1.启动器里面找不到深度翻译,不管是all还是分类标签里面都找不到其图标。但是在启动器里面的搜索框里能搜到;
2.打开之后,只有设置、退出等能点开,其它比如“关于”,“向导”不能点开;
3.在终端启动deepin-translator后,出现如下信息:QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Xlib.protocol.request.QueryExtension
Xlib.protocol.request.QueryExtension
QDBusConnection: name 'com.deepin.menu' had owner '' but we thought it was ':1.56'

如上,不知是否为bug,近几天重复多次仍然如此。另外特别谢谢作者写出如此优秀的软件!谢谢作者的付出!
Reply View the author
186******98
deepin
2013-12-19 17:40
#75
设置和向导还正在开发。
Reply View the author
alextome
deepin
2013-12-20 03:34
#76
LD越来越棒了,真心支持越来越好,造福国人!
Reply View the author
tyh2020
deepin
2013-12-22 03:08
#77
64位系统安装上以后无法启动,卸载后,其他软件都无法安装了。

显示“无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。”

求解决方法?安装源已经更新过了


后来我发现了,是部分软件无法安装。应该是64位系统不支持的关系。
Reply View the author
js2fj5zqh
deepin
2013-12-22 21:07
#78
64位系统安装后,启动器中有图标,但没入任何分类,我将源改回了官方非测试源更新了。但无法启动。按71楼删除config.init后终端启动显示如下:

zhu@zhu-deepin:~$ deepin-translator
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
function get got error: No option 'two_way_translate' in section: 'Language Info'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/deepin_utils/config.py", line 99, in get
    return self.config_parser.get(section, option)
  File "/usr/lib/python2.7/ConfigParser.py", line 340, in get
    raise NoOptionError(option, section)
NoOptionError: No option 'two_way_translate' in section: 'Language Info'
Traceback (most recent call last):
  File "/usr/bin/deepin-translator", line 51, in
    from dict_interface import get_translate_simple, get_translate_long
  File "/usr/share/deepin-translator/src/dict_interface.py", line 30, in
    dict_plugin = DictPlugin()
  File "/usr/share/deepin-translator/src/dict_plugin.py", line 40, in __init__
    self.scan_plugin_info()
  File "/usr/share/deepin-translator/src/dict_plugin.py", line 93, in scan_plugin_info
    two_way_translate = is_true(plugin_config.get("Language Info", "two_way_translate"))
  File "/usr/lib/python2.7/dist-packages/deepin_utils/core.py", line 97, in is_true
    return string_value.lower() == "true"
AttributeError: 'NoneType' object has no attribute 'lower'
段错误
zhu@zhu-deepin:~$
Reply View the author
186******98
deepin
2013-12-23 17:02
#79
您删除错了文件, 应该删除 ~/.config/deepin-translator/config.ini  

config.ini 后面没有 t ,
Reply View the author
js2fj5zqh
deepin
2013-12-24 17:11
#80
请修改71楼,71楼是要删config.init。
但我现在已经删了config.init了,又把config.ini也删了,还是启动不了。
apt-get remove后手工删除了~/.config/下的deepin-translator文件夹,又install了一下。
还没有~/.config/deepin-translator文件夹,执行deeptranslator后,有了该文件夹,但是只有.ini。
删除.ini,还是一样,如下。

zhu@zhu-deepin:~/.config$ ls
autostart             deepin-software-center  gedit          monitors.xml
blender               deepin-system-settings  gnome-session  nautilus
chmsee                deepin-terminal         google-chrome  network.conf
compiz-1              deepin-ui               gtk-2.0        powers.xml
dconf                 deepin-user-manual      gtk-3.0        pulse
deepin-game-center    desktop                 inkscape       pystorm
deepin-individuation  dock                    iptux          QuantiCode
deepin-media-player   enchant                 Kingsoft       Trolltech.conf
deepin-music-player   eog                     launcher       user-dirs.dirs
deepin-notifications  fcitx                   libreoffice    user-dirs.locale
deepin-screenshot     FreeCAD                 lwqq           yelp
zhu@zhu-deepin:~/.config$ deepin-translator
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
function get got error: No option 'two_way_translate' in section: 'Language Info'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/deepin_utils/config.py", line 99, in get
    return self.config_parser.get(section, option)
  File "/usr/lib/python2.7/ConfigParser.py", line 340, in get
    raise NoOptionError(option, section)
NoOptionError: No option 'two_way_translate' in section: 'Language Info'
Traceback (most recent call last):
  File "/usr/bin/deepin-translator", line 51, in
    from dict_interface import get_translate_simple, get_translate_long
  File "/usr/share/deepin-translator/src/dict_interface.py", line 30, in
    dict_plugin = DictPlugin()
  File "/usr/share/deepin-translator/src/dict_plugin.py", line 40, in __init__
    self.scan_plugin_info()
  File "/usr/share/deepin-translator/src/dict_plugin.py", line 93, in scan_plugin_info
    two_way_translate = is_true(plugin_config.get("Language Info", "two_way_translate"))
  File "/usr/lib/python2.7/dist-packages/deepin_utils/core.py", line 97, in is_true
    return string_value.lower() == "true"
AttributeError: 'NoneType' object has no attribute 'lower'
段错误
zhu@zhu-deepin:~/.config$ ls
autostart               deepin-system-settings  gnome-session  network.conf
blender                 deepin-terminal         google-chrome  powers.xml
chmsee                  deepin-translator       gtk-2.0        pulse
compiz-1                deepin-ui               gtk-3.0        pystorm
dconf                   deepin-user-manual      inkscape       QuantiCode
deepin-game-center      desktop                 iptux          Trolltech.conf
deepin-individuation    dock                    Kingsoft       user-dirs.dirs
deepin-media-player     enchant                 launcher       user-dirs.locale
deepin-music-player     eog                     libreoffice    yelp
deepin-notifications    fcitx                   lwqq
deepin-screenshot       FreeCAD                 monitors.xml
deepin-software-center  gedit                   nautilus
zhu@zhu-deepin:~/.config$ cd deepin-translator
zhu@zhu-deepin:~/.config/deepin-translator$ ls
config.ini
zhu@zhu-deepin:~/.config/deepin-translator$ rm config.ini
zhu@zhu-deepin:~/.config/deepin-translator$ cd ~
zhu@zhu-deepin:~$ deepin-translator
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
function get got error: No option 'two_way_translate' in section: 'Language Info'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/deepin_utils/config.py", line 99, in get
    return self.config_parser.get(section, option)
  File "/usr/lib/python2.7/ConfigParser.py", line 340, in get
    raise NoOptionError(option, section)
NoOptionError: No option 'two_way_translate' in section: 'Language Info'
Traceback (most recent call last):
  File "/usr/bin/deepin-translator", line 51, in
    from dict_interface import get_translate_simple, get_translate_long
  File "/usr/share/deepin-translator/src/dict_interface.py", line 30, in
    dict_plugin = DictPlugin()
  File "/usr/share/deepin-translator/src/dict_plugin.py", line 40, in __init__
    self.scan_plugin_info()
  File "/usr/share/deepin-translator/src/dict_plugin.py", line 93, in scan_plugin_info
    two_way_translate = is_true(plugin_config.get("Language Info", "two_way_translate"))
  File "/usr/lib/python2.7/dist-packages/deepin_utils/core.py", line 97, in is_true
    return string_value.lower() == "true"
AttributeError: 'NoneType' object has no attribute 'lower'
段错误
zhu@zhu-deepin:~$
Reply View the author
4 / 7
To page