Skip to content

Commit

Permalink
samples: Add Cloud Code tags for API Explorer pilot (#840)
Browse files Browse the repository at this point in the history
* docs: Add Cloud Code tags for API Explorer pilot

* 馃 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and Shabirmean committed Nov 17, 2022
1 parent ef19780 commit 06d9e10
Showing 1 changed file with 10 additions and 1 deletion.
Expand Up @@ -17,15 +17,21 @@
package com.example.translate;

// [START translate_v3_translate_text]
// [START translate_v3_translate_text_0]
// Imports the Google Cloud Translation library.
import com.google.cloud.translate.v3.LocationName;
import com.google.cloud.translate.v3.TranslateTextRequest;
import com.google.cloud.translate.v3.TranslateTextResponse;
import com.google.cloud.translate.v3.Translation;
import com.google.cloud.translate.v3.TranslationServiceClient;
import java.io.IOException;

// [END translate_v3_translate_text_0]

public class TranslateText {

// [START translate_v3_translate_text_1]
// Set and pass variables to overloaded translateText() method for translation.
public static void translateText() throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "YOUR-PROJECT-ID";
Expand All @@ -34,8 +40,10 @@ public static void translateText() throws IOException {
String text = "your-text";
translateText(projectId, targetLanguage, text);
}
// [END translate_v3_translate_text_1]

// Translating Text
// [START translate_v3_translate_text_2]
// Translate text to target language.
public static void translateText(String projectId, String targetLanguage, String text)
throws IOException {

Expand Down Expand Up @@ -65,5 +73,6 @@ public static void translateText(String projectId, String targetLanguage, String
}
}
}
// [END translate_v3_translate_text_2]
}
// [END translate_v3_translate_text]

0 comments on commit 06d9e10

Please sign in to comment.