在这里找到YandexTranslator:https://github.com/prokhor-ozornin/Yandex.NET.Translator
我通过Nuget
安装了YandexTranslator这是我在按钮中的代码翻译:
IYandexTranslator translator = Yandex.Translator(api => api.ApiKey(ConfigurationManager.AppSettings [“ApiKey”])。Format(ApiDataFormat.Json)); IEnumerable translationPairs = translator.TranslationPairs(); //错误远程服务器返回错误:(403)禁止。 string language = translator.Detect(“This is English text”); ITranslation translation = translator.Translate(“ru”,“要翻译成俄语”);
如何转换VB.net
答案 0 :(得分:0)
Dim translator As IYandexTranslator = Yandex.Translator(Function(api)api.ApiKey(ConfigurationManager.AppSettings("ApiKey")).Format(ApiDataFormat.Json))
Dim translationPairs As IEnumerable = translator.TranslationPairs
//error The remote server returned an error: (403) Forbidden.
Dim language As String = translator.Detect("This is English text")
Dim translation As ITranslation = translator.Translate("ru", "To be translated to Russian")