Provides an OAUTH'd client interface to https://cloud.google.com/translate/
perl translation_example.pl "this is english - translate into French for me"
NB: Defaults English to French - modify source code to adjust settings.
Setup a Google Project in the Google Console and add the Translate API Library. You may need to enable billing to access Google Cloud Services. Setup an OAUTH Credential set and feed this into the CLI goauth included in WebService::GoogleAPI::Client and use the tool to authorise your user to access the project which will also create the local gapi.json config.
assumes gapi.json configuration in working directory with scoped project and user authorization
{ 'discoveryRestUrl' => 'https://translation.googleapis.com/$discovery/rest?version=v2', 'description' => 'Integrates text translation into your website or application.', 'preferred' => true, 'kind' => 'discovery#directoryItem', 'id' => 'translate:v2', 'version' => 'v2', 'title' => 'Cloud Translation API', 'icons' => { 'x32' => 'https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png', 'x16' => 'https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png' }, 'name' => 'translate', 'documentationLink' => 'https://code.google.com/apis/language/translate/v2/getting_started.html' },
To install WebService::GoogleAPI::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::GoogleAPI::Client
CPAN shell
perl -MCPAN -e shell install WebService::GoogleAPI::Client
For more information on module installation, please visit the detailed CPAN module installation guide.