Skip to content

Commit fb90add

Browse files
samples: Add Cloud Code tags for API Explorer pilot (#840)
* 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>
1 parent 489c00b commit fb90add

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

translate/snippets/src/main/java/com/example/translate/TranslateText.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,21 @@
1717
package com.example.translate;
1818

1919
// [START translate_v3_translate_text]
20+
// [START translate_v3_translate_text_0]
21+
// Imports the Google Cloud Translation library.
2022
import com.google.cloud.translate.v3.LocationName;
2123
import com.google.cloud.translate.v3.TranslateTextRequest;
2224
import com.google.cloud.translate.v3.TranslateTextResponse;
2325
import com.google.cloud.translate.v3.Translation;
2426
import com.google.cloud.translate.v3.TranslationServiceClient;
2527
import java.io.IOException;
2628

29+
// [END translate_v3_translate_text_0]
30+
2731
public class TranslateText {
2832

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

38-
// Translating Text
45+
// [START translate_v3_translate_text_2]
46+
// Translate text to target language.
3947
public static void translateText(String projectId, String targetLanguage, String text)
4048
throws IOException {
4149

@@ -65,5 +73,6 @@ public static void translateText(String projectId, String targetLanguage, String
6573
}
6674
}
6775
}
76+
// [END translate_v3_translate_text_2]
6877
}
6978
// [END translate_v3_translate_text]

0 commit comments

Comments
 (0)