Babelfish translation ...

S

Stef Mientki

hello,

I've build a translation tool, to translate all strings in a python
source file.
As a extra gadget I added translation through Babel Fish,
using beautifulsoup.

Although it works functionally,
it can take lots of time waiting for the translation.

What I basically do is, after selecting a new string to be translated:

kwds = { 'trtext' : line_to_be_translated, 'lp' :'en_nl'}
soup = BeautifulSoup (urlopen(url, urlencode ( kwds ) ) )
translation= soup.find ( 'div', style='padding:0.6em;' ).string
self.Editor_Babel.SetLabel ( translation )

I'm using Python 2.5 and wxPython.

Probably I should use a separate thread, but that's above my knowledge.
I could also use a timer to check at regualr intervals when the
translation is ready,
but I've no idea how to implement that with the above code.

thanks,
Stef Mientki
 

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top