Author |
Message |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Thu 17 Jun 2010, 15:52 Post subject:
gxlat - Desktop Google Translator redux Subject description: gui - no browser needed |
|
Dear Puppians,
Here is a little application I banged together today to translate texts using Google's translate engine. It works from the desktop and obviates the need to load a heavy, java-script-supporting browser. It is written in bash and makes use of gtkdialog, gxmessage and bing, a tiny ping substitute I wrote because it quits after a second unlike ping if the DNS cannot be resolved (i.e. if your connection is dead). All relevant source included.
Since this is an alpha, you might have some suggestions for improvement. I have a few in mind already, but wanted to get this thing off my chest.
Have fun.
With kind regards,
vovchik
Description |
|
Filesize |
28.58 KB |
Viewed |
2218 Time(s) |

|
Description |
|

Download |
Filename |
gxlat.pet |
Filesize |
27.04 KB |
Downloaded |
1112 Time(s) |
|
Back to top
|
|
 |
otropogo

Joined: 24 Oct 2009 Posts: 774 Location: Montreal
|
Posted: Thu 17 Jun 2010, 16:18 Post subject:
|
|
Thanks vovchi.
Love your pet. It's especially handy for checking crummy GT translations (which I run into all the time). If you have a nodding acquaintance with several languages, as I do, you can quickly cycle the original through two or three translations and soon decide what the real meaning of the original is.
BTW I get a dailly abridged version by e-mail of all the posts in the Google Translate help forum (it's really a "help!" forum, because it's full of requests, and almost no help), which informs me of an amazing range of Google Translate features I've never experienced with Puppy/Seamonkey.
These include the option of viewing the pinyin phonetics for Chinese script and of listening to the audio rendition of original text submitted.
Unfortunately, the posters almost never specify how exactly they are accessing Google Translate (ie. OS and/or browser). I suspect most are using Google Chrome, but have no evidence. Many complain bitterly that Google Translate runs automatically on their browser and they want to shut it down, but con't know how!
Do you know if either of the two features above (audio or pinyin) can be accessed with Puppy 4.3.1.?
_________________ otropogo@gmail.com facebook.com/otropogo
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Fri 18 Jun 2010, 04:46 Post subject:
|
|
Dear Puppians,
I still have to do something about escaping double quotes and ampersands in the text. Any ideas? Please look at the function translate in the gxlat script.
with kind regards,
vovchik
PS. Ostropogo, thanks. I will look into the audio and other features. Perhaps somebody else on the forum knows and can enlighten us.
|
Back to top
|
|
 |
neurino

Joined: 15 Oct 2009 Posts: 360
|
Posted: Sat 04 Sep 2010, 09:38 Post subject:
|
|
vovchik wrote: |
I still have to do something about escaping double quotes and ampersands in the text. Any ideas? Please look at the function translate in the gxlat script.
|
Why not simply replace ampersands and quotes with html entities?
And also < and > that can come in with copy and paste!
It should work and you can use bash string functions or sed:
Code: |
#bash way
FROM_TEXT=${FROM_TEXT//&/&}
FROM_TEXT=${FROM_TEXT//"/"}
FROM_TEXT=${FROM_TEXT//</<}
FROM_TEXT=${FROM_TEXT//>/>}
#sed way
#(always thanks potong for enlighting me on sed power)
FROM_TEXT=$(sed -r '
s/&/&/
s/"/"/
s/</</
s/>/>/
' <<< $FROM_TEXT)
|
Get entities here, you can try also decimal values `& 68 ;` etc...
Haven't tested it though...
Greetings
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Sat 04 Sep 2010, 13:34 Post subject:
|
|
Dear neurino,
Many thanks. I am now playing with the filters....
I am not great with sed, but I have written some rather complex filters in the past (that, surprisingly, worked!). Gxlat really needs that filtering for oddball chars. I wrote gxlat initially because I saw a similar implementation in java - which meant, to me, heaps of unnecessary overhead and bulk. The java version also loaded very slowly. I think the only real defect now is the lack of proper filtering and, perhaps, a not up-to-date list of languages (easy to fix).
It may also be time to include clear and clipboard copy/paste buttons.
If you want to give it ago, please do.
With kind regards,
vovchik
|
Back to top
|
|
 |
neurino

Joined: 15 Oct 2009 Posts: 360
|
Posted: Sat 04 Sep 2010, 14:40 Post subject:
|
|
vovchik wrote: |
If you want to give it ago, please do.
|
I'm thinking to a tiny trayicon frontend for shell-fm since I'm a Last FM addicted so I think I'll be devoted to this in the near future (and I still don't have idea how to manage a deamon )
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Sat 04 Sep 2010, 15:05 Post subject:
Daemonization |
|
Dear neurino,
I like the idea of a tray front end to Last FM. Please do it. Here is something you might want to use (daemonize). The latest source (1.6) is here: http://github.com/bmc/daemonize/downloads. I have attached 1.5.2.
With kind regards,
vovchik
Description |
|

Download |
Filename |
daemonize-1.5.2.pet |
Filesize |
14.11 KB |
Downloaded |
844 Time(s) |
|
Back to top
|
|
 |
neurino

Joined: 15 Oct 2009 Posts: 360
|
Posted: Sat 04 Sep 2010, 15:29 Post subject:
|
|
Thank you, shell-fm already can run as a deamon (-d option) but maybe it's not enough to have it under full control so this may come in handy.
As I said it's all new stuff to me so your pet and link are a nice point to start!
|
Back to top
|
|
 |
aragon
Joined: 15 Oct 2007 Posts: 1698 Location: Germany
|
Posted: Fri 24 Sep 2010, 09:06 Post subject:
|
|
hi vovchik, very nice app.
3 notes / requests:
1. It would be nice, if you would give the user the opportunity to save his/hers "regular" translation languages and the load this settings on future startups.
2. a button to switch the 'translation-direction' would also be nice.
3. cosmetics: please use the close button and not the cancel button. we don't have to cancel as your app runs fine ...
aragon
_________________ PUPPY SEARCH: http://wellminded.com/puppy/pupsearch.html
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Fri 24 Sep 2010, 16:03 Post subject:
gxlat update |
|
Dear aragon,
Thanks for the suggestions. I will include them in the next release. I have also improved the parsing for special chars, so the next release will be better.
With kind regards,
vovchik
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Thu 07 Apr 2011, 04:47 Post subject:
new version - 0.1b |
|
Dear Puppians,
I finally got around to posting a new pet of gxlat. I implemented Aragon's useful suggestion for remembering languages and have made some attempt (half-hearted, though) at html filtering. The "Swap" function is NOT yet implemented, although the button is there. If anybody has a clever way of doing it, please post.
The reason I posted the revised version of gxlat today is that Geoffrey posted a pet of Goot today, which looks OK but is terribly slow and big. It requires java (let's say 9 MB) and is itself 1.5 MB unpacked. This pet is roughly 45k in its packed state.
With kind regards,
vovchik
Description |
|
Filesize |
76.3 KB |
Viewed |
867 Time(s) |

|
Description |
|

Download |
Filename |
gxlat-0.1b.pet |
Filesize |
44.36 KB |
Downloaded |
892 Time(s) |
|
Back to top
|
|
 |
Geoffrey

Joined: 30 May 2010 Posts: 2346 Location: Queensland
|
Posted: Thu 07 Apr 2011, 05:57 Post subject:
|
|
vovchik,
I've tried this before and this version does the same thing, when first run I get an error that the network connection is down and it closes, but if I run it a second time it works, it looks to me that it times out to quickly before a connection can be made, I'm using quirky 1.2.0 NOP but I don't think that would have much to do with it.
Other than that small problem it's a good app that I would use.
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1447 Location: Ukraine
|
Posted: Thu 07 Apr 2011, 06:27 Post subject:
|
|
Dear Geoffrey,
Thanks for telling me - I think I should adjust the timeout for "bing", which I wrote some time ago. There source is there in the /usr/local/gxlat.src dir, I think. I'll look at it.
Is your inet connection generally slow? I am working on a fast connection at the moment and, even with my usual relatively slow connection, I never get the timeout if the connection is really alive. It is set for 2 second checks in Bing, so I will experiment with a longer value. It could be that your ISP's DNS server is slow at resolving, not the connection itself. If that is the case, you could try adding the following DNS servers to /etc/resolv.conf:
Code: | nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 208.67.222.222
nameserver 208.67.220.220 |
The first two are Google's public DNS servers and the last two OpenDNS.
With kind regards,
vovchik
|
Back to top
|
|
 |
Geoffrey

Joined: 30 May 2010 Posts: 2346 Location: Queensland
|
Posted: Thu 07 Apr 2011, 06:29 Post subject:
Re: new version - 0.1b |
|
Quote: | The reason I posted the revised version of gxlat today is that Geoffrey posted a pet of Goot today, which looks OK but is terribly slow and big. It requires java (let's say 9 MB) and is itself 1.5 MB unpacked. |
I've done a comparison of Goot and gxlat and found that Goot is about twice as fast at getting a translation and the app startup times is about the same, I know it's quite large though I do have a number of other java apps so the size is of no consequence to me, I would say it all l depends on the hardware being used.
|
Back to top
|
|
 |
Geoffrey

Joined: 30 May 2010 Posts: 2346 Location: Queensland
|
Posted: Thu 07 Apr 2011, 07:37 Post subject:
|
|
vovchik,
my internet connection is 2.5Mbps, I never get any time outs, but it can be slow at getting a connection anywhere up 5 seconds depending on the time of day.
|
Back to top
|
|
 |
|