Is there a language detection being called before translation?

LuLi 40 Reputation points
2024-08-18T07:11:52.52+00:00

Hi dear Microsoft team,

I use Azure Translator with REST API call in Python which works pretty well, and I just find this interesting: The source language doesn't need to be correct? Because I test with a text in Cantonese and assign the source language parameter with 'zh', it turns out that it can translate correctly:

params = { 'api-version': '3.0',     'from': 'zh',     'to': ['fr', 'en'] }

So I have two questions:

  1. Is there a language detection behind automatically being called, before translation?
  2. In this doc(https://learn.microsoft.com/en-us/azure/ai-services/translator/language-support#translation), there is actually no 'zh' language code, there are only 'zh-Hans', 'zh-Hant' and 'yue', but from my above test, it does support source language to be 'zh'. Is this a typo in the doc?

Thank you!

Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
408 questions
0 comments No comments
{count} votes

Accepted answer
  1. navba-MSFT 24,890 Reputation points Microsoft Employee
    2024-08-19T04:05:52.93+00:00

    @LuLi Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    . Please note that the Azure Translator service has Auto Language Detection which Automatically detect the language of the source text while using Text Translation or Document Translation.

    . The language code ‘zh’ is a general code for Chinese, but it is not explicitly listed in the documentation because Azure Translator prefers more specific codes like ‘zh-Hans’ for Simplified Chinese and ‘zh-Hant’ for Traditional Chinese. The service still recognizes ‘zh’ as a valid input for Chinese, which is why your test worked. This isn’t a typo, but rather a preference for more specific language codes in the documentation.

    .

    Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.

    **

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.