Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cognigy translate: Microsoft Translator: missing Ocp-Apim-Subscription-Region header #124

Open
tgbv opened this issue Aug 25, 2023 · 1 comment

Comments

@tgbv
Copy link
Contributor

tgbv commented Aug 25, 2023

Lately, Microsoft Translator requires the region header as well. The command cognigy translate does not ask for region, making the translation via Microsoft feature impossible.

$ cognigy --version

# 1.4.0

$ cognigy translate --help

# Usage: cognigy translate [options] <resourceType> <resourceName>
# 
# Translate a resource
# 
# Options:
#   -l, --localeName <localeName>           locale to process
#   -fl, --fromLanguage <fromLanguageCode>  language to translate from
#   -tl, --toLanguage <targetLanguageCode>  language to translate to
#   -tr, --translator <translator>          the translation tool, google, microsoft or deepl
#   -ti, --translateIntents                 adds localization to Flow Intents
#   -tn, --translateNodes                   adds localization to Flow Nodes
#   -k, --apiKey <apiKey>                   the translator api key
#   -y, --forceYes                          skips warnings and overwrites all content
#   -h, --help                              display help for command

$ cognigy translate -l Polish -fl en -tl pl -tr microsoft -tn -k MS_TRANSLATOR_API_KEY flow FLOW_NAME

# throws axios error: 403 Unauthorized, but API key is correct.

Reference: https://learn.microsoft.com/en-us/answers/questions/1192881/how-to-get-microsoft-translator-api-key

@tgbv
Copy link
Contributor Author

tgbv commented Aug 25, 2023

After digging deeper into MS Docs, this looks more like a feature request: https://learn.microsoft.com/en-us/azure/ai-services/translator/reference/v3-0-reference#authenticating-with-a-regional-resource as there are multiple ways to authenticate with MS Translator.

Nevertheless, it should be implemented. I made a pull request in which apiRegion is optional & used only for Microsoft Translator requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant