To get supported languages you can use the TranslateClient.GetSupportedLanguages(displayLanguageCode = "en") method: var supportedLanguagesData = await client.GetSupportedLanguages() įoreach(var language in supportedLanguagesData. When detecting language, hint language will be preferred ( IEnumerable). Text which is used as reference for language detection ( string).var detectedLanguage = await client.DetectLanguageAsync("Hello World!") Ĭonsole.WriteLine(detectedLanguage) // Output: "en"ĭetectLanguageAsync accepts the following parameters: To detect language you can use TranslateClient.DetectLanguageAsync(text, hintLanguages) method Translate format, which specifies whether text to be translated is a plain text or HTML ( TextFormat enum).TranslateClient.TranslateAsync Accepts the following arguments: var translation = await client.TranslateAsync("Hellow World!", "en", "ru") Ĭonsole.WriteLine(translation.First()!) // Output: "Привет, мир!" Like source string, source and target language codes and format. Which returns Translation object that contains possible translations and some additional metadata To translate text you can use TranslateClient.TranslateAsync(text, sourceLang, targetLang, format = text) method Simply enter the word you need, and Yandex Translate will provide you with the correct translation in seconds. Var client = new TranslateClient(config) Looking for the english translation from English into Russian Yandex Translate has got you covered Our free and reliable tool provides accurate translations for over 90 languages. Var config = new TranslateClientConfiguration("YOUR_API_KEY") Then simply create TranslateClient instance.At first, create configuration object (for now it contains API key property only).To start using it simply create a new instance of the class: Core FeaturesĪll core features share the same client class TranslateClient. This is a simple client for the Yandex.Translate service.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |