translation_example.pl
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.
PRE-REQUISITES
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
REQUIRED SCOPES
{
'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'
},
GOOGLE API LINKS
- https://console.developers.google.com/apis/
- https://cloud.google.com/translate/docs/reference/translate
- https://developers.google.com/apis-explorer/