Home Forums Wiki Doc Install Extras Screenshots Source Code Projects Blog Users Groups Register
Glx-Dock / Cairo-Dock List of forums Applets | Applets Translator (formally doCkranslator)
The latest stable release is the *3.4.0* : How to install it here.
Note: We just switched from BZR to Git on Github! (only to host the code and your future pull requests)
Applets | Applets

Subjects Author Language Messages Last message
Translator (formally doCkranslator)
Page : 1 2 3 4 5
Eduardo Mucelli English 84 Guest [Read]
05 June 2018 à 07:24

Eduardo Mucelli, Thursday 15 July 2010 à 03:09 | Quote


Subscription date : 05 August 2009
Messages : 285
Hello all. I've been coding a applet called doCkranslator. Basically it translates from English to a lot languages. It uses the Google Translator service and shows the translated result, also it set this result to the clipboard (using PyGTK), just Ctrl+v to have it. This time I'm using Python, and since I'm not accustomed as in Ruby maybe there is some issues with the code. The next versions will translate for any to any language. As usual, suggestions, comments, and everything is welcome.

The preview shows a translation I've made with it. The original text was "Cheers to France from Brazil", so I do not know if it is right, would not be nice a preview image with a wrong text, would not be a good presentation of the applet.

http://dl.dropbox.com/u/1433190/doCkranslator/preview

fabounet, Thursday 15 July 2010 à 03:48 | Quote


Subscription date : 30 November 2007
Messages : 17118
translation of sentences often gives weird results, but I'd love to have an applet that can act as wordreference for instance
but then the results is a bit different (not a single sentence, but several words)

Eduardo Mucelli, Thursday 15 July 2010 à 04:39 | Quote


Subscription date : 05 August 2009
Messages : 285
The main problem would be how to enter this values for this specific context. I guess, for instance, you could enter as a text, but each word would be separated by a defined token, for example, ";". Consequently, the translator would understand each peace as a new context to be translated, so each one would be a kind of unique word. As I told you in the chat, the main problem is how to deal with the output, and for this context you want to, the input is not easy to solve by a intuitively way for the user. I will be working on this applet, hope it reaches a nice level.

SQP, Thursday 15 July 2010 à 09:35 | Quote


Subscription date : 03 July 2010
Messages : 1090
@fab : If you think at something that would pull data from wiktionnary, I think that would be really nice too, but maybe as a different plugin.

@Eduardo : I like the babelfish reference :p, and think such applet could get some love in France

as an option maybe, could it get input from the default linux paste, the middle click ? (would allow to fast select text, with left click, move mouse to applet and middle click)

for the fabounet idea, why not use a modifier (like shift) to break the sentence into words list (and a different keyboard shortcut) ?

Eduardo Mucelli, Thursday 15 July 2010 à 19:28 | Quote


Subscription date : 05 August 2009
Messages : 285
@SQP: You mean which one of the following behaviors: (I) The user select the text to be translated, copy, middle-click, (in this moment the applet does the translation of what is in the clipboard) or (II) The user select the text to be translated, copy, middle-click (in this moment the dialog box opens filled with the clipboard text), and user press ok. I, or II ?

By the way, interesting solution to the word list.

SQP, Thursday 15 July 2010 à 20:45 | Quote


Subscription date : 03 July 2010
Messages : 1090
step 1 : user select text, it is copied to the mouse buffer.
step 2 : user middle click on the icon to launch translation using that mouse buffer (like I do when I paste text in most apps). Use main buffer if empty
(at that moment the modifier option may be used)

It would allow very fast translations in 2 clicks without using keyboard

Left click to open the text box, middle click to auto search

matttbe, Thursday 15 July 2010 à 23:49 | Quote


Subscription date : 24 January 2009
Messages : 12573
@ Eduardo: Thank you, I've merged your branch into the trunk .
Also, what's the goal of the languages list (right click on your applet / doCKranslator) ?

@ Fabounet: I've a little bug with the dialogue, can you test this applet: it opens a dialogue where you write your text and just after (quite immediately) it opens another dialogue with the result but I only see a little part of this dialogue (not every time, it depends of the connexion I guess).
http://uppix.net/6/d/a/8f0459d3eb47cc8f915e9c94261b2.png

fabounet, Friday 16 July 2010 à 02:45 | Quote


Subscription date : 30 November 2007
Messages : 17118
I confirm this bug (it appears randomly )

+1 for the fast translation

I think it would be nice to have both behaviors in the same applet : translate a word or a sentence
we can maybe guess which one it is by checking the presence of spaces in the text buffer
or maybe google already gives several choices when one translates a single word ?

Eduardo Mucelli, Friday 16 July 2010 à 17:30 | Quote


Subscription date : 05 August 2009
Messages : 285
@matttbe: The goal is the same as the one in the scroll, the resulting language. Since already there is a way to choose the target language by scroll, this menu could be used to choose the source language. In the second version it is more clear.
@SQP: I coded the "left-click, middle-click (auto-fill the input field) with the clipboard content". I could do also the middle-click to get the primary buffer, anyway I would need to require the user has "xsel" package installed, and I'm trying, in this applet, require the less amount of libraries as possible.
@fabounet: as far as I know, Google does not provide the single word translation, since it is already given when you insert a single word and the result is, most of times, a list of possible meanings.
@fabounet: the google translate a single word with the most frequent meaning of this one. The translator only gives it a contextual meaning when this single word is surrounded by a sentence. If you enter a sentence and want to get the result of each word as a single one, I could split the sentence and query the google for each one of them. I guess Google would block the user fast as hell if the sentence has a lot of words.

Eduardo Mucelli, Friday 16 July 2010 à 22:20 | Quote


Subscription date : 05 August 2009
Messages : 285
Things are better in the fourth version. I'm establishing the plug-in with the basic features first. Now it translates from any-to-any language. I did include the list of languages in the configuration file. Code looks prettier , and more some small things. Cheers.

fabounet, Saturday 17 July 2010 à 03:02 | Quote


Subscription date : 30 November 2007
Messages : 17118
about the middld-click, you can get the primary buffer with gtk
see the Clipper applet for an exemple in C.

for binding an action to a shortcut, I think it's possible with X or gdk in python; if not I can add the necessary function in the Dbus API.

it seems Google can do all what we want, that's a good point

maybe we could consider adding a service backend (google, wordreference, etc), in a distant future.

for the dialog with a text widget, I'm thinking of something more general.
maybe a way to describe some simple widgets ... I can't add a new function each time an applet needs a new dialog.

Eduardo Mucelli, Saturday 17 July 2010 à 06:30 | Quote


Subscription date : 05 August 2009
Messages : 285
@fabounet and SQP: Now there is a nicer way to translate as suggested by both of you. Select, middle-click over the icon. Just it, the translation result will be shown as dialog and will be placed in the clipboard. Just Ctrl+v to have it. So this fits the first use case fabounet suggested me "I read an english text on firefox -> don't understand a word -> select with the mouse -> middle-click on the applet -> result pops-up in a dialog"

I've finally done with menus, so now there is menus for the source, and destination languages to be selected. The configuration also provides it as a way to keep this options even with a possible plugin reload.

@fabounet: For the second use case, as you described in chat, "ALT+F8 (for instance) -> dialog with focus -> type my word in french -> enter -> result placed in the clipboard", I will check how (if it is possible) to do that "binding an action to a shortcut" in Python.

Cheers.

Eduardo Mucelli, Sunday 18 July 2010 à 07:33 | Quote


Subscription date : 05 August 2009
Messages : 285
I found the way to bind an action to a shortcut (with a modifier). Anyway, I can not make it work in the applet because I need to keep polling an event handler to ask "any key press event there?" so it steals the main thread. I tried to use separeted threads but It gets a conflict with glib/dbus. The input dialog opens properly when the shortcut is pressed but the dbus methods stop to work. Well, struggling a lot with that.

Eduardo Mucelli, Sunday 18 July 2010 à 20:06 | Quote


Subscription date : 05 August 2009
Messages : 285
Got it to work! doCkranslator now has another fast-as-hell way to translate. Press Ctrl + F8 to open the input dialog, paste some text, and press Enter. The shortcut capability requires Python-Xlib, but even if the user has not it, the applet works without this capability. Cheers!

fabounet, Monday 19 July 2010 à 14:00 | Quote


Subscription date : 30 November 2007
Messages : 17118
great job ! I'll test it asap !
about Python-Xlib, is it available by default ?
or should we make it available in the Dbus API ?

next step for me : add a full-options dialog method

matttbe, Monday 19 July 2010 à 14:29 | Quote


Subscription date : 24 January 2009
Messages : 12573
Python-Xlib
Not on Ubuntu

fabounet, Monday 19 July 2010 à 15:28 | Quote


Subscription date : 30 November 2007
Messages : 17118
hmm, that's problematic
I'd rather not have to manage dependancies
and showing a list of dependancies to the user may discourage some of them

so after all maybe I should add it inside the Dus API.

PS : may I suggest a more translator-friendly name for this applet ? like "Translator" ?

Eduardo Mucelli, Monday 19 July 2010 à 17:04 | Quote


Subscription date : 05 August 2009
Messages : 285
@fabounet: That is not problematic because I've handled the exception when the user does not have the Python-Xlib. So, the applet must to work even if this lib is not present, without the shortcut capability, of course. In the applet description "Press Ctrl + F8, type the text, and press Enter (requires Python-Xlib)" is the requirement is already being shown. Cheers.

matttbe, Monday 19 July 2010 à 17:38 | Quote


Subscription date : 24 January 2009
Messages : 12573
@Eduardo, about the problem that I have, what's your current distribution and its version?

Eduardo Mucelli, Monday 19 July 2010 à 17:44 | Quote


Subscription date : 05 August 2009
Messages : 285
@matttbe: Mint 6.

Applets | Applets

Subjects Author Language Messages Last message
Translator (formally doCkranslator)
Page : 1 2 3 4 5
Eduardo Mucelli English 84 Guest [Read]
05 June 2018 à 07:24

Post a message

Anti-spam filter 10 (*) times (*) 3 =
            
Did you know ? You can easily create a link to a wikipedia file by using the tag: [[wikipedia:FILE]]


Glx-Dock / Cairo-Dock List of forums Applets | Applets Translator (formally doCkranslator) Top

Online users :

Powered by ElementSpeak © 2007 Adrien Pilleboue, 2009-2013 Matthieu Baerts.
Dock based on CSS Dock Menu (Ndesign) with jQuery. Icons by zgegball
Cairo-Dock is a free software under GNU-GPL3 licence. First stable version created by Fabounet.
Many thanks to TuxFamily for the web Hosting and Mav for the domain name.