anovik / YandexTranslateCSharpSdk

C# Wrapper for Yandex Translate API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YandexTranslateCSharpSdk

alt YandexTranslateCSharpSdk icon

alt Appveyor status

YandexTranslateCSharpSdk is a .NET C# library providing access for Yandex Translate API:

https://tech.yandex.com/translate

Project includes C# library with wrapper methods for Yandex Translate API, Visual Studio unit tests for this library and WPF demo application for library. Project also includes .NET Core 3.1 library, tests for it and ASP.NET Core demo application.

Important update

Yandex is shutting up Yandex Translate Service, it is scheduled on August 15, 2020:

https://storage.yandexcloud.net/yc-materials/emails/html/yandex-translate-en.html

Service will be migrated to Yandex Cloud but there will be no free plans there, only introductory grants.

Nuget

You can add .NET Framework library to your project using Nuget:

https://www.nuget.org/packages/YandexTranslateCSharpSdk

You can add .NET core library to your project using Nuget:

https://www.nuget.org/packages/YandexTranslateCoreSdk/

How to use

YandexTranslateSdk wrapper = new YandexTranslateSdk();
wrapper.ApiKey = "theKeyYouGotFromYandexHere";
string englishText = "Hello, World";
string translatedText = await wrapper.TranslateText(englishText, "en-fr");

Prerequisites

Requires .NET Framework 4.0 or higher or .NET Core. The library is based on HttpClient. To use it in .NET 4.0, use Nuget package https://www.nuget.org/packages/Microsoft.Net.Http, versions of .NET Framework 4.5 or higher and .NET Core have HttpClient by default.

To run tests get API key from Yandex:

https://tech.yandex.com/keys/get/?service=trnsl

and put it into the file key.txt in YandexTranslateCSharpSdkTests.

List of languages supported by Yandex.Translate API can be found here:

https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/

Terms of Use

According to the Terms of Use for the Yandex Translate service, the text “Powered by Yandex.Translate” must be shown above or below the translation result, with a clickable link to the page http://translate.yandex.com/.

https://tech.yandex.com/translate/doc/dg/concepts/design-requirements-docpage/

About

C# Wrapper for Yandex Translate API

License:MIT License


Languages

Language:C# 95.3%Language:HTML 4.7%