NAME
WWW::Google::Translate - Perl interface for the Google Translate API v2
SYNOPSIS
use WWW::Google::Translate;
my $gt = WWW::Google::Translate->new( {
key => '<Your API key here>',
default_source => 'en',
default_target => 'ja',
} );
my $r = $gt->translate( { q => 'My hovercraft is full of eels' } );
for my $trans_rh (@{ $r->{data}->{translations} }) {
print $trans_rh->{translatedText}, "\n";
}
# Or rather ...
my %q = (
q => 'My hovercraft is full of eels',
source => 'en',
target => 'ja',
);
my $r = $gt->translate( \%q );
DESCRIPTION
This module provides a convenient interface for using the Google Translate API v2. For complete information about the Google Translate API please visit:
http://code.google.com/apis/language/translate/v2/getting_started.html
Important: Google Translate API v2 is now available as a paid service.
To use this module you must obtain an API key from Google and configure your Google Wallet account to pay for the service. You are subject to the Google TOS requirements.
NOTE
For v0.03 there is support for queries over 2K. The API still enforces a size limit of 5K. Observations indicate that the UTF-8 encoding needs to be transformed, sometimes. If you're not happy with the automated grooming of UTF-8 you can suppress it by passing the transform_result boolean constructor option.
For example:
my $gt = WWW::Google::Translate->new( {
key => '<Your API key here>',
transform_result => 0,
} );
SEE ALSO
Google Terms of Service: http://code.google.com/apis/language/translate/v2/terms.html
Google APIs Console: https://code.google.com/apis/console/
AUTHOR
Dylan Doxey, <dylan@cpan.org>
The author of this module is not affiliated with Google. The author of this module assumes no responsibility for activities of the users.
COPYRIGHT AND LICENSE
Copyright (C) 2011 by Dylan Doxey
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.