AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 22392
In Process
Agnese
Agnese
Asked: 2011-01-21 01:58:11 +0800 CST2011-01-21 01:58:11 +0800 CST 2011-01-21 01:58:11 +0800 CST

如何安装 Google 翻译桌面?

  • 772

我已经下载了这个包,但是当我试图打开它时,我收到了这条消息:

Archive:  /home/agnes/Downloads/ggtranslate.exe
[/home/agnes/Downloads/ggtranslate.exe]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
zipinfo:  cannot find zipfile directory in one of /home/agnes/Downloads/ggtranslate.exe or
          /home/agnes/Downloads/ggtranslate.exe.zip, and cannot find /home/agnes/Downloads/ggtranslate.exe.ZIP, period.
translation
  • 6 6 个回答
  • 30729 Views

6 个回答

  • Voted
  1. Arthur Colombini Gusmão
    2017-01-02T04:27:24+08:002017-01-02T04:27:24+08:00

    最近我制作了一个超级简单的脚本,它打开一个新的浏览器选项卡,其中包含谷歌翻译页面,显示 Ubuntu 中任何应用程序上当前突出显示的文本的信息。

    它可以用作替代品。使用它的一种方法是将命令链接到键盘快捷键;然后,每当您按下该键时,都会自动打开一个新选项卡。

    我采用这种方法是因为我经常不仅要寻找翻译,还要寻找发音。

    此外,您可能想查看translate-shell一下,它是一个与许多翻译引擎交互的命令行实用程序。

    • 5
  2. Swapnil
    2017-06-13T01:38:02+08:002017-06-13T01:38:02+08:00

    设置和配置“翻译突出显示的文本”脚本

    1. 为了能够使用该脚本,首先安装 libnotify-bin(以便该脚本可以发送桌面通知)、wget(从 Google 检索翻译)和 xsel(用于获取当前突出显示的文本)。在 Ubuntu、Linux Mint 等中,使用以下命令安装它们:

      sudo apt-get install libnotify-bin wget xsel  
      
    2. 接下来,复制下面的脚本代码:

      #!/usr/bin/env bash  
      notify-send --icon=info "$(xsel -o)" "$(wget -U "Mozilla/5.0" -qO - "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&**tl=en**&dt=t&q=$(xsel -o | sed "s/[\"'<>]//g")" | sed "s/,,,0]],,.*//g" | awk -F'"' '{print $2, $6}')"  
      

      并将其粘贴到一个新文件中 - 让我们调用它notitrans(好吧,你可以随意调用它,但这就是我从现在开始引用它的方式)。

      在上面的脚本中,替换tl=en为您希望将文本翻译成的语言,例如tl=ru俄语、tl=fr法语等。

      完成后,将文件保存在主目录中并使用以下命令使其可执行:

      chmod +x ~/notitrans
      
    3. 将脚本放在 $PATH 中 - 例如,要将脚本复制到 /usr/local/bin/,请使用以下命令:

      sudo mv ~/notitrans /usr/local/bin/
      
    4. 为了能够使用该脚本,您可以为其分配一个自定义键盘快捷键。这样做取决于您的桌面环境。

      在 GNOME(和 Unity)上,您可以通过转到System Settings > Keyboard > Shortcuts > Custom Shortcuts来执行此操作,您需要在其中单击“+”以添加新的键盘快捷键。在这里,为新的自定义快捷方式和“notitrans”输入您想要的任何名称作为命令:

    enter image description here

    最后,为新添加的命令分配一个键盘快捷键,方法是单击它,然后按住要分配给它的键。确保键盘快捷键未被使用!

    可选:“翻译突出显示的文本”脚本的变体

    enter image description here

    使用 Zenity 显示翻译(允许复制文本)而不是使用桌面通知:

    #!/usr/bin/env bash  
    text="$(xsel -o)"  
    translate="$(wget -U "Mozilla/5.0" -qO - "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&**tl=en**&dt=t&q=$(echo $text | sed "s/[\"'<>]//g")" | sed "s/,,,0]],,.*//g" | awk -F'"' '{print $2, $6}')"   
    echo -e "Original text:" "$text"'\n' > /tmp/notitrans  
    echo "Translation:" "$translate" >> /tmp/notitrans  
    zenity --text-info --title="Translation" --filename=/tmp/notitrans 
    

    为此,请确保 Zenity 已安装在您的系统上。在 Ubuntu 上,使用以下命令安装它:

    sudo apt-get install zenity
    

    Display the translation in a desktop notification AND automatically copy the translation to the clipboard:

    #!/usr/bin/env bash
    text="$(xsel -o)"
    translate="$(wget -U "Mozilla/5.0" -qO - "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&**tl=en**&dt=t&q=$(echo $text | sed "s/[\"'<>]//g")" | sed "s/,,,0]],,.*//g" | awk -F'"' '{print $2, $6}')"  
    echo "$translate" | xclip -selection clipboard  
    notify-send --icon=info "$text" "$translate"  
    

    For this to work, make sure xclip is installed on your system. On Ubuntu, install it using the following command:

    sudo apt-get install xclip
    
    • 3
  3. Takkat
    2011-01-21T03:21:20+08:002011-01-21T03:21:20+08:00

    如果安装了 Java,Google 桌面翻译器是一个在 Ubuntu 上运行的 Java 应用程序。您下载的文件显然是为从 Windows 安装和解压缩而设计的,或者(请参阅 Javier Rivera 的评论)可能是另一个第三方 Windows 程序。两者都不能在 Ubuntu 中工作。

    使用此链接直接从 Google 下载相应的 .zip 文件:

    http://code.google.com/p/google-translate-desktop/downloads/list

    解压文件,打开终端,cd到你的安装目录并运行

    java -jar google-translate-desktop-0.52.jar

    程序窗口现在应该打开:

    google-translate

    不幸的是,在 0.52 版中,这个窗口没有任何装饰,也不能移动,但是有完整的翻译功能。对于退出或程序设置,在 GNOME 面板中会生成一个状态图标。Windows 装饰仅存在于测试版中,其功能略有减少。

    如果您对 Ubuntu 没有经验,或者对从外部来源安装任何东西感到不舒服,您可以考虑使用Google 的 Web 前端进行翻译。

    • 2
  4. Glen
    2012-05-30T18:15:27+08:002012-05-30T18:15:27+08:00

    您试图运行 Windows 程序。尝试这个:

    1. 确保 ZIP 存档中的所有文件和子目录都在一个文件夹中。
    2. 在该文件夹中,右键单击google-translate-desktop-x.y.jar,然后单击属性,然后单击权限。
    3. 确保选中“允许将文件作为程序执行”。
    4. 关闭对话框,右键单击该文件,然后在 Open With 下单击您的 Java Runtime。

    编辑:您可能已经下载了仅限 Windows 的免费软件。尝试下载此文件,并在解压缩存档后按照上述说明进行操作。

    • 1
  5. Lincity
    2011-01-21T03:22:15+08:002011-01-21T03:22:15+08:00

    此答案不再正常运行,因为该链接不再可操作。然而,出于历史目的,这篇文章保持原样。

    您可以使用 Goot(下载)。它使用谷歌翻译。

    • 0
  6. Archisman Panigrahi
    2021-05-13T04:06:39+08:002021-05-13T04:06:39+08:00

    Dialect is a translator app that uses Google translate as the backend.

    image It is available on Flathub

    flatpak install flathub com.github.gi_lom.dialect
    

    Source: https://github.com/dialect-app/dialect

    • 0

相关问题

  • 我应该如何继续通过启动板接受翻译?

  • 是否有 help.ubuntu.com 的本地化版本?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    我需要什么命令来解压缩/提取 .tar.gz 文件?

    • 8 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Marko Smith

    如何使用命令行将用户添加为新的 sudoer?

    • 7 个回答
  • Marko Smith

    更改文件夹权限和所有权

    • 9 个回答
  • Martin Hope
    EmmyS 我需要什么命令来解压缩/提取 .tar.gz 文件? 2011-02-09 14:50:41 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve