[kdepim-users] multilanguage e-mails, something I would like to share

Dj YB yehielb at mail.ru
Thu Aug 26 21:25:40 BST 2010


Hello,

some time ago I have been looking for a way to translate messages inside kmail 
as I am not native english speaker and most of the mails I get are in english.

So, using google translate, tw, perl, and kmail filters, here is a solution:

[note]
if you have no need for messages translation you can stop here
[/note]

create a new filter (lets call it "Translate"), set the filter criteria to 
something that will be always true like "subject" not equal "123123123999".

add an action: "Pipe Through" "~/bin/mail_translate.pl"
in the advanced tab un-check all but "Add this filter to the Apply filter menu"

save the attached file in your ~/bin
edit the script and look for "translate.google.com.en-he", change "en-he" to 
translate from whatever language you want to whatever language you want.

chmod a+x mail_translate.pl

to translate a message:
right click on it and select "Apply Filter"->"Filter Translate"

the script will do one of two things (as far as I planned and tested):
if the message is multipart with a text/plain part, a new text/plain part will 
be added containing the translation of the original text/plain part.

if the message is single part then a "--TRANSLATION--" (in the translated 
language) separator  and the translation of the original message body will be 
added to the end of the original message body.

as always you should not trust strangers offering you scripts, and now is no 
different.
check the code and if you can\want please improve it.

Hope someone finds that useful (except for me),
YB.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mail_translate.pl
Type: application/x-perl
Size: 1174 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdepim-users/attachments/20100826/e8225d79/attachment.bin>
-------------- next part --------------
_______________________________________________
KDE PIM users mailing list
kdepim-users at kde.org
https://mail.kde.org/mailman/listinfo/kdepim-users


More information about the kdepim-users mailing list