Skip to content

Adding subscription region in Microsoft text translator api #4002

@Sumit-nainani

Description

@Sumit-nainani

Use this query to search for the most popular feature requests.

Is your feature request related to a problem? Please describe.
I'm always frustrated when I use the Text Translator API sample code provided in the bot-builder-samples repository because the subscriptionRegion is not included in the header section. This omission leads to authentication errors when using a regional translator resource.

Description of the solution
I would like the sample code to be updated to include the subscriptionRegion in the headers. The updated code should look like this:
path of file is :
microsoft/BotBuilder-Samples/samples/python/17.multilingual-bot/translation/microsoft_translator.py
headers = {
"Ocp-Apim-Subscription-Key": self.subscription_key,
"Ocp-Apim-Subscription-Region": self.subscription_region, # Necessary if using a regional translator resource and If you are using a global translator resource, you can omit the 'Ocp-Apim-Subscription-Region' header.
"Content-type": "application/json",
"X-ClientTraceId": str(uuid.uuid4()),

}

Additionally, comments should be added to explain that this header is necessary when using a regional translator resource and can be omitted if using a global translator resource. For example:

alternatives I've considered
As an alternative, I considered manually adding the subscriptionRegion every time I use the sample code. However, this is not an ideal solution as it requires extra effort and increases the likelihood of errors.

Additional context
if not using region.
Screenshot 2024-07-09 at 10 47 02 PM

if using region.
Screenshot 2024-07-09 at 10 48 19 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA request for new functionality or an enhancement to an existing one.needs-triageThe issue has just been created and it has not been reviewed by the team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions