Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I am new to Perl. Basically I need a script that could read data in localized language (for eg. chinese, korea, spanish, german) from an excel file and translate it to English and write back to an excel. Could this be done? If so please help me with a script to start with. Thanks nish
  • Comment on Translation using GoogleTranslator / Yahoo Babel Fish

Replies are listed 'Best First'.
Re: Translation using GoogleTranslator / Yahoo Babel Fish
by ww (Archbishop) on Sep 07, 2009 at 18:10 UTC

    Welcome, Annonymous_Monk "new to Perl;" welcome! You've come to a very good place for help.

    Recommended next steps: get a login; become part of the community; and read the FAQs (where, among other valuable information, you'll learn that this is not a script writing service)..

    Question 1: yes, probably.

    How: Spreadsheet::ParseExcel, Spreadsheet-DataFromExcel, Spreadsheet-DataToExcel and/or other Excel modules should help with reading, with judicious application of encoding (See UTF).

    Question 2: "please help me with a script...." Well, someone may, but you'll almost always get better help here by writing code yourself, and presenting it (along with error messages, warnings and a clear, specific explanation of what's not happening that you expect).

Re: Translation using GoogleTranslator / Yahoo Babel Fish
by Sinistral (Monsignor) on Sep 07, 2009 at 18:18 UTC

    PerlMonks is not a code writing service. You cannot simply give a requirement and say "please send teh codez".

    Keeping that in mind, what you will get here are suggestions for what CPAN modules might be relevant to your needs

    If you have an Excel file, you can use Spreadsheet::ParseExcel to read in the data. Once you have it, you can use WWW::Mechanize to send the data in the cell to Babelfish to accomplish the translation. Once you have the data back (retrieved using the WWW::Mechanize API), you can store it in a file using Spreadsheet::WriteExcel.

    So, you have many small pieces you can work on independently:

    1. Reading in data from Excel (although just saving as CSV and using Text::CSV would be easier)
    2. Taking a string in one language and submitting via HTTP using WWW::Mechanize to Babelfish
    3. Getting that result string and saving it back to Excel using Spreadsheet::WriteExcel (although CSV again would be easier)

    The monks here will be happy to help if you have source code that you've tried to get working and can't. Just remember to heed the advice in How do I post a question effectively?

      Hi all, Thanks for your reply and suggetions.Infact I did not ask a code for my requirement. Being new to perl, was just asking for a sample code to start with if someone had worked on similar kind of requirement so that I would get to know the module to be used. Anyways Thanks. This helped a lot. Cheers nish