Re: Seeking help with a Perl module for translating languages

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: ProgrammingBlind@xxxxxxxxxxxxx
  • Date: Wed, 15 Oct 2008 15:30:27 -0400 (EDT)

Jim and Octavian, When you get a chance, I'm still interested in more info
on your solutions, including how to get the needed modules.  After
updating to the latest build of Perl 5.8, I did find a module that uses
the Google translation service.  The code below translates the English
"Hello world" into the French "Bonjour le monde."

Jamal


use strict;
use warnings;

use WebService::Google::Language;

my $service = WebService::Google::Language->new(
'referer' => 'http://example.com/',
'src'     => 'en',
'dest'    => 'fr',
);

my $Text = 'Hello world';
my $result = $service->translate($Text);

if ($result->error) {
printf "Error code: %s\n", $result->code;
printf "Message:    %s\n", $result->message;
}
else {
printf "Translation:       %s\n", $result->translation;
}

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: