4

I've downloaded the package but as I'm trying to open it I get this message:

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.
4

Recently I've made a super simple script that opens a new browser tab with the google translator page showing information for the currently highlighted text on any app in Ubuntu.

Can be used as an alternative. One way to use it is to link the command to a keyboard shortcut, than any time you press the key a new tab will open automatically.

I took this approach because frequently I'm looking not only for the translation but also for the pronunciation as well.

  • 1
    Welcome to Ask Ubuntu! ;-) +1 just for getting rid of Java! :D – Fabby Jan 1 '17 at 12:52
3

Google Desktop Translator is a Java application that runs on Ubuntu if Java was installed. The file you downloaded obviously is designed to install and uncompress from Windows or (see Javier Rivera's comment) may be another third party Windows program. Both will not work in Ubuntu.

Download the appropriate .zip file directly from Google with this link:

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

Uncompress the files, open a terminal, cd to your installation directory and run

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

The program window should now open:

google-translate

Unfortunately in version 0.52 this window has no decoration and cannot be moved, but there is full translation functionality. For quitting or for program settings a status icon is generated in the GNOME panel. Windows decoration is present in the beta version only that has a slightly reduced functionality.

If you're not experienced on your Ubuntu or feel uncomfortable to install anything from external sources you may consider to use Google's Web-frontend for translation instead.

  • Just ran run-linux.sh and java -jar google-translate-desktop-0.52.jar and got this msg: Could not open the file /home/agnes/Downloads/go…ranslate-desktop-0.52.jar. gedit has not been able to detect the character coding. Please check that you are not trying to open a binary file. Select a character coding from the menu and try again. – Agnese Jan 20 '11 at 12:16
  • How do I do it? – Agnese Jan 20 '11 at 13:11
  • Is java installed on your system? – Takkat Jan 20 '11 at 13:26
  • yes, I have java – Agnese Jan 20 '11 at 13:59
  • 1
    I was just able to test this on my 10.04 am64 (see screenshots) with no further steps. Java does not find the jar file on your system. Make sure there are no typing errors and the .jar file is really present in the directory from where you run java (e.g. ls lists google-translate-desktop-0.52.jar before you invoke the java command) – Takkat Jan 20 '11 at 17:28
1

You tried to run a Windows program. Try this:

  1. Make sure all the files and subdirectories from the ZIP archive are in a folder.
  2. While in that folder, right-click on google-translate-desktop-x.y.jar, and click Properties, then Permissions.
  3. Make sure "Allow executing file as program" is checked.
  4. Close the dialog, right-click on the file, and under Open With, click your Java Runtime.

EDIT: You may have downloaded windows only freeware. Try downloading this, and following the above instructions after extracting the archive.

1

Setting up and configuring the 'translate highlighted text' script

  1. To be able to use the script, firstly install libnotify-bin (so the script can send desktop notifications), wget (to retrieve the translation from Google) and xsel (which is used to get the currently highlighted text). In Ubuntu, Linux Mint, etc. install them using the following command:

    sudo apt-get install libnotify-bin wget xsel  
    
  2. Next, copy the script code below:

    #!/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}')"  
    

    and paste it in a new file - let's call it notitrans (well, you can call it whatever you want, but that's how I'll refer to it from now on).

    In the script above, replace tl=en with the language into which you want the text to be translated, for instance tl=ru for Russian, tl=fr for French and so on.

    After you're done, save the file in your home directory and make it executable using the following command:

    chmod +x ~/notitrans
    
  3. Place the script in your $PATH - for instance, to copy the script to /usr/local/bin/, use the following command:

    sudo mv ~/notitrans /usr/local/bin/
    
  4. To be able to use the script, you can assign it a custom keyboard shortcut. Doing this depends on your desktop environment.

    On GNOME (and Unity), you can do this by going to System Settings > Keyboard > Shortcuts > Custom Shortcuts, where you'll need to click "+" to add a new keyboard shortcut. Here, enter any name you want for the new custom shortcut and "notitrans" as the command:

enter image description here

And finally, assign a keyboard shortcut to the newly added command by clicking on it and then holding down the keys you want to assign to it. Make sure the keyboard shortcut is not already in use!

Optional: variations of the 'translate highlighted text' script

enter image description here

Display the translation with Zenity (which allows the text to be copied) instead of using desktop notifications:

#!/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 

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

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
0

This answer no longer properly functions, as the link is no longer operational. This post has been left as-is, however, for historical purposes.

you can use Goot(Download). it uses google translator.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.