Closed Jan-Jan closed 1 year ago
Hi,
I do not know the exact problem with the JSON-file, but there is one thing that looks suspicious:
Did you generate the whole JSON-file with Google or did you modify it on your own? I think that attranslate only works with Google-generated JSON-files that contain a key for a so-called „service account“.
Am Mo., 10.Okt..2022 um 21:21, Jan-Jan @.***> schrieb:
Describe the bug I get an UNAUTHENTICATED error, despite having registered for Google Cloud Translate API and getting a key. I suspect my json file has the wrong structure.
To Reproduce A description of what the bug is. When I attempt to run the script below
!/bin/bash
set -e # abort on errors
This example translates an english JSON-file into spanish, chinese and german. It uses Google Cloud Translate.
BASE_DIR="static/locales" SERVICE_ACCOUNT_KEY="gcloud_translation_key.json" COMMON_ARGS=( "--srcLng=en" "--srcFormat=nested-json" "--targetFormat=nested-json" "--service=google-translate" "--serviceConfig=$SERVICE_ACCOUNT_KEY" )
install attranslate if it is not installed yet
attranslate --version || npm install -g attranslate
attranslate --srcFile=$BASE_DIR/en/translation.json --targetFile=$BASE_DIR/de/translation.json --targetLng=de "${COMMON_ARGS[@]}"
I get the following error
1.8.1 Invoke 'google-translate' from 'en' to 'de' with 8 inputs... An error occurred: 16 UNAUTHENTICATED: Failed to retrieve auth metadata with error: key must be a string, a buffer or an object Error: 16 UNAUTHENTICATED: Failed to retrieve auth metadata with error: key must be a string, a buffer or an object
I suspect it is because my gcloud_translation_key.json file is malformed
{ "key": "<the key I got from 'Enable APIs and services' on GCloud for translation>", "project_id": "
" } Expected behavior I expect the translated files to be output.
Files I've added the script and config I use inline.
Additional context Nothing else.
Thank you in advance for your help.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
I am closing the issue for now, but please feel free to re-open if the issue is still relevant.
Describe the bug I get an
UNAUTHENTICATED
error, despite having registered for Google Cloud Translate API and getting a key. I suspect my json file has the wrong structure.To Reproduce A description of what the bug is. When I attempt to run the script below
I get the following error
I suspect it is because my
gcloud_translation_key.json
file is malformedExpected behavior I expect the translated files to be output.
Files I've added the script and config I use inline.
Additional context Nothing else.
Thank you in advance for your help.