Connecting to GoogleTranslate
Authentication
Google Cloud Translation API requires OAuth 2.0 authentication to ensure secure access to translation services, datasets, glossaries, and adaptive MT resources. This authentication method allows you to securely connect to your Google Cloud project and manage translation resources with proper authorization.
OAuth 2.0 Setup and Configuration
Step 1: Create Google Cloud Project and Enable API
To set up OAuth authentication:
- Visit the Google Cloud Console
- Create a new project or select an existing project
- Note down your Project ID (required for all API calls)
- Navigate to "APIs & Services" > "Library"
- Search for and enable the "Cloud Translation API"
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" and select "OAuth Client ID"
- Configure the OAuth consent screen if prompted
- Select "Desktop application" or "Web application" as appropriate
- Set the authorized redirect URI (CallbackURL)
- Copy the Client ID and Client Secret for use in your connection
Required Connection Properties
- AuthScheme: Set this to OAuth (required)
- OAuthClientId: Client ID from Google Cloud Console (required)
- OAuthClientSecret: Client secret from Google Cloud Console (required)
- CallbackURL: Redirect URI specified in your OAuth application (required)
- InitiateOAuth: Set to GETANDREFRESH for automatic token management (recommended)
- ProjectId: Your Google Cloud project ID or project number (required for queries)
Required OAuth Scopes
The Google Cloud Translation API Profile requires the following OAuth scope:
- https://www.googleapis.com/auth/cloud-translation - Full access to Cloud Translation API resources including translation, datasets, glossaries, and adaptive MT
Available Tables
The Google Cloud Translation API Profile provides access to comprehensive translation management and configuration capabilities:
Translation Resources
- SupportedLanguages - Lists all supported languages for translation with source and target capabilities
- Locations - Retrieves available Google Cloud regions and endpoints for Translation API
Adaptive Machine Translation (MT)
- AdaptiveMtDatasets - Manage adaptive MT datasets with custom language pairs and training examples
- AdaptiveMtFiles - Access files within adaptive MT datasets containing sentence pairs
- AdaptiveMtSentences - Retrieve individual sentence pairs from adaptive MT files for custom model training
AutoML Translation Datasets
- Datasets - Manage AutoML translation datasets with training, validation, and test data
- DatasetExamples - Access individual sentence pair examples within datasets
- Models - Query custom AutoML translation models with training statistics and language pairs
Glossary Management
- Glossaries - Manage translation glossaries for consistent term handling across translations
- GlossaryEntries - Access and manage individual term pairs or term sets within glossaries
Operations
- Operations - Monitor long-running operations such as model training, glossary creation, and batch translations
Connection Examples
Basic OAuth Connection String
Profile=C:\profiles\GoogleTranslate.apip;AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;CallbackUrl=your_callback_url;
OAuth Connection with Project Configuration
Profile=C:\profiles\GoogleTranslate.apip;AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;CallbackUrl=http://localhost:33333;ProfileSettings='ProjectId=my-project-12345';
Usage Examples
Language Support
Get all supported languages:
SELECT LanguageCode, DisplayName, CanSupportSource, CanSupportTarget FROM SupportedLanguages WHERE ProjectId = 'my-project-12345'
Glossary Management
List all glossaries in a location:
SELECT Name, DisplayName, EntryCount, LanguagePairSourceLanguageCode, LanguagePairTargetLanguageCode FROM Glossaries WHERE ProjectId = 'my-project-12345' AND LocationId = 'us-central1'
Get glossary term pairs:
SELECT TermsPairSourceTermText, TermsPairTargetTermText, Description FROM GlossaryEntries WHERE ProjectId = 'my-project-12345' AND LocationId = 'us-central1' AND Glossary = 'my-glossary'
Adaptive MT Management
List adaptive MT datasets:
SELECT Name, DisplayName, SourceLanguageCode, TargetLanguageCode, ExampleCount FROM AdaptiveMtDatasets WHERE ProjectId = 'my-project-12345' AND LocationId = 'us-central1'
Model Training
Monitor model training operations:
SELECT Name, IsDone, Metadata, Error FROM Operations WHERE ProjectId = 'my-project-12345' AND LocationId = 'us-central1'
Regional Endpoints
The Google Cloud Translation API supports multiple regional endpoints. Use the LocationId parameter in your queries to specify the region (e.g., us-central1, europe-west1, asia-northeast1). Some features like Adaptive MT and AutoML models are only available in specific regions.
API Quotas and Limits
Google Cloud Translation API has usage quotas and rate limits based on your Google Cloud project configuration. The API uses a pagination system with a default page size of 100 items. Monitor your API usage in the Google Cloud Console and consider implementing efficient querying strategies for large datasets.
Data Privacy and Security
When working with Google Cloud Translation API, ensure compliance with privacy regulations and Google's terms of service. Translation data, custom models, and glossaries may contain sensitive information. Implement appropriate data handling, storage, and access controls in your applications. Custom models and adaptive MT datasets are private to your Google Cloud project.
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| AuthScheme | The scheme used for authentication. Accepted entries are None or OAuth. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT |
| CallbackURL | Identifies the URL users return to after authenticating to API via OAuth (Custom OAuth applications only). |
| InitiateOAuth | Specifies the process for obtaining or refreshing the OAuth access token, which maintains user access while an authenticated, authorized user is working. Allowed values are: OFF, REFRESH, GETANDREFRESH |
| OAuthAccessToken | Specifies the OAuth access token used to authenticate requests to the data source. This token is issued by the authorization server after a successful OAuth exchange. |
| OAuthClientId | Specifies the client ID (also known as the consumer key) assigned to your custom OAuth application. This ID is required to identify the application to the OAuth authorization server during authentication. |
| OAuthClientSecret | Specifies the client secret assigned to your custom OAuth application. This confidential value is used to authenticate the application to the OAuth authorization server. (Custom OAuth applications only.). |
| OAuthExpiresIn | Specifies the duration in seconds, of an OAuth Access Token's lifetime. The token can be reissued to keep access alive as long as the user keeps working. |
| OAuthRefreshToken | Specifies the OAuth refresh token used to request a new access token after the original has expired. |
| OAuthSettingsLocation | Specifies the location of the settings file where OAuth values are saved. |
| OAuthTokenTimestamp | Displays a Unix epoch timestamp in milliseconds that shows how long ago the current access token was created. |
| OAuthVerifier | Specifies a verifier code returned from the OAuthAuthorizationURL . Used when authenticating to OAuth on a headless server, where a browser can't be launched. Requires both OAuthSettingsLocation and OAuthVerifier to be set. |
| Scope | Scope(s) to use when authenticating, that control access to specific information. |