0

我正在尝试执行下一个代码,但 de "Import" 语句给了我错误。我已经安装了 Google Cloud SDK,但我现在不知道如何在 Visual Studio 2015 中添加缺少的参考。

这是代码:

Imports Google.Cloud.Translation.V2
Function GoogleTranslateV2Text(sourceText As String, sourceLang As String, targetLang As String) As String
    Try
      Dim TClient As TranslationClient = TranslationClient.Create()
      If sourceLang.ToUpper = targetLang.ToUpper Then
        Return (sourceText)
      End If
      Dim response = TClient.TranslateText(sourceText, targetLang, sourceLang)
      Dim result As String = response.TranslatedText
      Return result
    Catch ex As Exception
      Dim msg As String = "#1#: " & ex.Message
      Return msg
    End Try
  End Function
4

0 回答 0