I22r::Translate::Google - Google backend for I22r::Translate framework
I22r::Translate->config( 'I22r::Translate::Google' => { ENABLED => 1, API_KEY => "your_required_API_key_goes_here", REFERER => "http://mywebsite.com/" } ); $translation = I22r::Translate->translate_string( src => 'en', dest => 'es', text => 'hello world', quality => { 'I22r::Translate::Google' => 2.0 } );
Invokes Google's translation webservice to translate content from one language to another.
You instruct the I22r::Translate package to use the Google backend by passing a key-value pair to the I22r::Translate::config method where the key is the string "I22r::Translate::Google" and the value is a hash reference with at least the following key-value pairs:
I22r::Translate::Google
Must be set to a true value for the Google backend to be enabled.
An API key is required to use the Google Translate web service. You can get an API key from https://code.google.com/apis/console (note: this is not a free service). (other note: if you can't get an API key from the above URL, but then you do figure out where to get one, let me know or file a bug report and I'll update these instructions).
Configuration for the Google backend also recognizes these options:
Sets a URL that will passed to the Google Translate service as your application's referer. If not set, this package will set the referer to http://just.doing.some.testing/.
http://just.doing.some.testing/
Stops a translation job after a certain number of seconds have passed.
A function to be invoked when the Google backend obtains a translation result. The function will be called with a single hash reference argument, containing the available data about the translation input and output.
List of filters to use (see I22r::Translate::Filter) when sending text to the Google Translate webservice.
When you use the "translate_string" in I22r::Translate, "translate_list" in I22r::Translate, or "translate_hash" in I22r::Translate function, the I22r::Translate module will decide when to use the Google backend for translation. Most users do not need to know anything else about the methods in this package.
can_translate
Marty O'Brien, <mob@cpan.org>
<mob@cpan.org>
WWW::Google::Translate, Lingua::Translate::Google, REST::Google::Translate, REST::Google::Translate2
Copyright 2012-2013 Marty O'Brien.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install I22r::Translate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm I22r::Translate
CPAN shell
perl -MCPAN -e shell install I22r::Translate
For more information on module installation, please visit the detailed CPAN module installation guide.