UNPKG

@spiralup/auto-translate

Version:

Translate text to different languages using Google or Microsoft translate, for example during JHipster code generation.

46 lines (38 loc) 1.6 kB
# Update google translation lib - Update google translation lib to use the latest version of the google-translate-api library. - Use the google service account file to authenticate with the google translation API. - `.auto-translate-config.json` file is updated to include the `googleServiceAccountKey` field. - this field is used to store the path to the google service account file. ## Config file `.auto-translate-config.json` with the `googleServiceAccountKey` field: ```json { "automaticTranslation": true, "translatorProvider": "google", "azureTranslateKey": "the-azure-key", "googleTranslateKey": "the-google-key", "googleServiceAccountFile": "/home/vrba/.auto-translate/translations-xxxx-aaaa.json" } ``` `translations-xxxx-aaaa.json` looks like this: ```json { "type": "service_account", "project_id": "translations-xxxxx", "private_key_id": "<private-key>", "private_key": "<private-key-content>", "client_email": "applipress-translate@translations-ssss.iam.gserviceaccount.com", "client_id": "<client-id>>", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/applipress-translate%40translations-xxxxx.iam.gserviceaccount.com", "universe_domain": "googleapis.com" } ``` # References aider/01.upgrade_google_translation_lib.md README.md lib/translator/translate.js module/index.js test/translate_test.js