Microsoft Translator: Does GetLanguagesForTranslation() translate language names into the browser language?

StackOverflow https://stackoverflow.com/questions/11729361

  •  23-06-2021
  •  | 
  •  

Вопрос

This may be a stupid question, but I have no way of testing this with multiple languages.

I am wondering if the Microsoft Translator translates the list of supported languages into the language detected by the browser? I assume is does, but would appreciate validation.

TIA

Это было полезно?

Решение

GetLanguagesForTranslate() returns the set of supported languages IDs. GetLanguageNames() takes an array of languag IDs and returns the friendly name of the language in the language you specify in the "locale" parameter, where locale is the ISO639 language code.

You may listen to the browser's accept-language setting and pass the first element of it to the locale parameter. That's what the Bing Translator home page does (www.bing.com/translator)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top