fkirc / attranslate

A command line tool for translating JSON, YAML, CSV, ARB, XML (via a CLI)
https://www.npmjs.com/package/attranslate
Other
336 stars 27 forks source link

cant translate with azure #233

Closed johnfelipe closed 1 year ago

johnfelipe commented 2 years ago

File to translate https://gist.github.com/164b623aadc5c2442005d5342f3c9c6b

root@ubuntu20portatil:~/attranslate# attranslate --srcFile=general.yml --srcLng=en --srcFormat=yaml --targetFile=general-es.yml --targetLng=es --targetFormat=yaml --service=azure --serviceConfig=blablablabla

Bypass 1 strings because they are empty...
Invoke 'azure' from 'en' to 'es' with 727 inputs...
An error occurred:
Azure Translation failed: {"error":{"code":401000,"message":"The request is not authorized because credentials are missing or invalid."}}
Error: Azure Translation failed: {"error":{"code":401000,"message":"The request is not authorized because credentials are missing or invalid."}}
    at AzureTranslator.translateBatch (/usr/local/lib/node_modules/attranslate/dist/services/azure-translator.js:26:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
    at async AzureTranslator.translateStrings (/usr/local/lib/node_modules/attranslate/dist/services/azure-translator.js:40:25)
    at async runTranslationService (/usr/local/lib/node_modules/attranslate/dist/core/invoke-translation-service.js:62:24)
    at async invokeTranslationService (/usr/local/lib/node_modules/attranslate/dist/core/invoke-translation-service.js:29:28)
    at async translateCore (/usr/local/lib/node_modules/attranslate/dist/core/translate-core.js:106:29)
    at async translateCli (/usr/local/lib/node_modules/attranslate/dist/core/translate-cli.js:84:20)

SNAG-0092

may be need to config region with any command?

attranslate set --key blablablabla
attranslate  set --region eastus

greetings

fkirc commented 1 year ago

Hi, I apologize for the late answer. There was a period of underfunding for attranslate, but now attranslate is live again! I am closing this issue for now, but please feel free to re-open it if the issue is still relevant!

olsn commented 1 year ago

I'm having the same issue. Is it anyhow possible to set a region for azure?

fkirc commented 1 year ago

Unfortunately I cannot debug this without having an Azure-key available. Nevertheless, there is a way that you could help me to fix the issue: If you open the file /usr/local/lib/node_modules/attranslate/dist/services/azure-translator.js on your machine, you will see that azure-translator.js only has very few lines of code (the path to azure-translator.js gets printed in the error-message above).

There you could modify the relevant line in azure-translator.js, and once your modified version works I could merge the changed line into this repo.