Azure-Samples / cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
MIT License
2.84k stars 1.83k forks source link

Is it ok to use locale instead of language code in the translate request? #1214

Closed hachandw closed 3 years ago

hachandw commented 3 years ago

Hi,

We want to use Azure Cognitive service's Translator service. However, the requests that we would get will contain the source and target locale instead of language code. We tried a few locales and noticed that Translation service correctly identifies the language code from it. For e.g., Chinese (Cantonese,Traditional) which is locale "zh-HK" is identified as "yue" language code, Chinese(Mandarin,Simplified) which is locale "zh-CN" is identified as "zh-Hans", Chinese(Taiwanese) which is "zh-TW" locale is identified as "zh-Hant" language code.

Sample request:

$"/translate?api-version=3.0&from=en-US&to=zh-CN";

Based on these observations, we wanted to check if it is OK to rely on the Translator service to correctly identify the language code for a given locale in the translate request?

Thanks.

krishna-doss-mohan commented 3 years ago

Hi Harsha, Though the API expects only language code, providing locale works. If you find specific locale isn’t working as expected; please revert back to us. Thanks,

amitkumarshukla commented 3 years ago

@krishna-doss-mohan Thanks a lot @krishna-doss-mohan. @hachandw I am closing this issue now. If you happen to find any problem please revert back to us.