You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -40,12 +42,15 @@ To get started, you'll need an active Azure subscription. If you don't have an A
40
42
:::image type="content" source="media/quickstarts/keys-and-endpoint-portal.png" alt-text="Screenshot: Azure portal keys and endpoint page.":::
41
43
42
44
* Use the free pricing tier (F0) to try the service and upgrade later to a paid tier for production.
45
+
<!-- checked -->
46
+
> [!div class="nextstepaction"]
47
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Csharp&Product=Translator&Page=quickstart-translator&Section=prerequisites)
43
48
44
49
## Headers
45
50
46
51
To call the Translator service via the [REST API](reference/rest-api-guide.md), you'll need to include the following headers with each request. Don't worry, we'll include the headers for you in the sample code for each programming language.
47
52
48
-
For more information on Translator authentication options, *see* the [Translator v3 reference](./reference/v3-0-reference.md#authentication) guide.
53
+
For more information on Translator authentication options, _see_ the [Translator v3 reference](./reference/v3-0-reference.md#authentication) guide.
49
54
50
55
|Header|Value| Condition |
51
56
|--- |:--- |:---|
@@ -56,15 +61,16 @@ For more information on Translator authentication options, *see* the [Translator
56
61
|||
57
62
58
63
> [!IMPORTANT]
59
-
> Remember to remove the key from your code when you're done, and never post it publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../key-vault/general/overview.md). See the Cognitive Services [security](../cognitive-services-security.md) article for more information.
64
+
>
65
+
> Remember to remove the key from your code when you're done, and never post it publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../key-vault/general/overview.md). For more information, _see_ the Cognitive Services [security](../cognitive-services-security.md) article.
60
66
61
67
## Translate text
62
68
63
69
The core operation of the Translator service is translating text. In this quickstart, you'll build a request using a programming language of your choice that takes a single source (`from`) and provides two outputs (`to`). Then we'll review some parameters that can be used to adjust both the request and the response.
64
70
65
71
### [C#: Visual Studio](#tab/csharp)
66
72
67
-
### Set up
73
+
### Set up your Visual Studio project
68
74
69
75
1. Make sure you have the current version of [Visual Studio IDE](https://visualstudio.microsoft.com/vs/).
70
76
@@ -103,15 +109,18 @@ The core operation of the Translator service is translating text. In this quicks
103
109
1. Select install from the right package manager window to add the package to your project.
104
110
105
111
:::image type="content" source="media/quickstarts/install-newtonsoft.png" alt-text="Screenshot of the NuGet package install button.":::
112
+
<!-- checked -->
113
+
> [!div class="nextstepaction"]
114
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Csharp&Product=Translator&Page=quickstart-translator&Section=set-up-your-visual-studio-project)
106
115
107
-
### Build your application
116
+
### Build your C# application
108
117
109
118
> [!NOTE]
110
119
>
111
120
> * Starting with .NET 6, new projects using the `console` template generate a new program style that differs from previous versions.
112
121
> * The new output uses recent C# features that simplify the code you need to write.
113
122
> * When you use the newer version, you only need to write the body of the `Main` method. You don't need to include top-level statements, global using directives, or implicit using directives.
114
-
> * For more information, *see*[**New C# templates generate top-level statements**](/dotnet/core/tutorials/top-level-templates).
123
+
> * For more information, _see_[**New C# templates generate top-level statements**](/dotnet/core/tutorials/top-level-templates).
115
124
116
125
1. Open the **Program.cs** file.
117
126
@@ -153,12 +162,44 @@ class Program
153
162
}
154
163
155
164
```
165
+
<!-- checked -->
166
+
> [!div class="nextstepaction"]
167
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Csharp&Product=Translator&Page=quickstart-translator&Section=build-your-c#-application)
156
168
157
169
### Run your C# application
158
170
159
171
Once you've added a code sample to your application, choose the green **start button** next to formRecognizer_quickstart to build and run your program, or press **F5**.
160
172
161
-
:::image type="content" source="media/quickstarts/run-program-visual-studio.png" alt-text="Screenshot of the rum program button in Visual Studio.":::
173
+
:::image type="content" source="media/quickstarts/run-program-visual-studio.png" alt-text="Screenshot of the run program button in Visual Studio.":::
174
+
175
+
**Translation output:**
176
+
177
+
After a successful call, you should see the following response:
178
+
179
+
```json
180
+
[
181
+
{
182
+
"detectedLanguage": {
183
+
"language": "en",
184
+
"score": 1.0
185
+
},
186
+
"translations": [
187
+
{
188
+
"text": "J'aimerais vraiment conduire votre voiture autour du pâté de maisons plusieurs fois!",
> [My REST API call was successful](#next-steps)[I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Csharp&Product=Translator&Page=quickstart-translator&Section=run-your-c#-application)
162
203
163
204
### [Go](#tab/go)
164
205
@@ -179,6 +220,11 @@ You can use any text editor to write Go applications. We recommend using the lat
179
220
```console
180
221
go version
181
222
```
223
+
<!-- checked -->
224
+
> [!div class="nextstepaction"]
225
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Go&Product=Translator&Page=quickstart-translator&Section=set-up-your-go-environment)
226
+
227
+
### Build your Go application
182
228
183
229
1. In a console window (such as cmd, PowerShell, or Bash), create a new directory for your app called **translator-app**, and navigate to it.
184
230
@@ -246,6 +292,9 @@ func main() {
246
292
fmt.Printf("%s\n", prettyJSON)
247
293
}
248
294
```
295
+
<!-- checked -->
296
+
> [!div class="nextstepaction"]
297
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Go&Product=Translator&Page=quickstart-translator&Section=build-your-go-application)
249
298
250
299
### Run your Go application
251
300
@@ -255,11 +304,40 @@ Once you've added a code sample to your application, your Go program can be exec
255
304
go run translation.go
256
305
```
257
306
258
-
### [Java](#tab/java)
307
+
**Translation output:**
308
+
309
+
After a successful call, you should see the following response:
310
+
311
+
```json
312
+
[
313
+
{
314
+
"detectedLanguage": {
315
+
"language": "en",
316
+
"score": 1.0
317
+
},
318
+
"translations": [
319
+
{
320
+
"text": "J'aimerais vraiment conduire votre voiture autour du pâté de maisons plusieurs fois!",
> [My REST API call was successful](#next-steps)[I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Go&Product=Translator&Page=quickstart-translator&Section=run-your-go-application)
335
+
336
+
### [Java: Gradle](#tab/java)
259
337
260
338
### Set up your Java environment
261
339
262
-
* You should have the latest version of [Visual Studio Code](https://code.visualstudio.com/) or your preferred IDE. *See*[Java in Visual Studio Code](https://code.visualstudio.com/docs/languages/java).
340
+
* You should have the latest version of [Visual Studio Code](https://code.visualstudio.com/) or your preferred IDE. _See_[Java in Visual Studio Code](https://code.visualstudio.com/docs/languages/java).
263
341
264
342
>[!TIP]
265
343
>
@@ -271,6 +349,9 @@ Once you've added a code sample to your application, your Go program can be exec
271
349
* A [**Java Development Kit** (OpenJDK)](/java/openjdk/download#openjdk-17) version 8 or later.
272
350
273
351
*[**Gradle**](https://docs.gradle.org/current/userguide/installation.html), version 6.8 or later.
352
+
<!-- checked -->
353
+
> [!div class="nextstepaction"]
354
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Java&Product=Translator&Page=quickstart-translator&Section=set-up-your-java-environment)
274
355
275
356
### Create a new Gradle project
276
357
@@ -284,7 +365,7 @@ Once you've added a code sample to your application, your Go program can be exec
284
365
mkdir translator-text-app; cd translator-text-app
285
366
```
286
367
287
-
1. Run the `gradle init` command from the translator-text-app directory. This command will create essential build files for Gradle, including *build.gradle.kts*, which is used at runtime to create and configure your application.
368
+
1. Run the `gradle init` command from the translator-text-app directory. This command will create essential build files for Gradle, including _build.gradle.kts_, which is used at runtime to create and configure your application.
288
369
289
370
```console
290
371
gradle init --type basic
@@ -312,8 +393,11 @@ Once you've added a code sample to your application, your Go program can be exec
312
393
implementation("com.google.code.gson:gson:2.9.0")
313
394
}
314
395
```
396
+
<!-- checked -->
397
+
> [!div class="nextstepaction"]
398
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Java&Product=Translator&Page=quickstart-translator&Section=create-a-gradle-project)
315
399
316
-
### Create a Java Application
400
+
### Create your Java Application
317
401
318
402
1. From the translator-text-app directory, run the following command:
319
403
@@ -388,8 +472,11 @@ public class TranslatorText {
388
472
}
389
473
}
390
474
```
475
+
<!-- checked -->
476
+
> [!div class="nextstepaction"]
477
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Java&Product=Translator&Page=quickstart-translator&Section=create-your-java-application)
391
478
392
-
### Build and run your application
479
+
### Build and run your Java application
393
480
394
481
Once you've added a code sample to your application, navigate back to your main project directory—**translator-text-app**, open a console window, and enter the following commands:
395
482
@@ -405,9 +492,38 @@ Once you've added a code sample to your application, navigate back to your main
405
492
gradle run
406
493
```
407
494
408
-
### [Node.js](#tab/nodejs)
495
+
**Translation output:**
496
+
497
+
After a successful call, you should see the following response:
498
+
499
+
```json
500
+
[
501
+
{
502
+
"detectedLanguage": {
503
+
"language": "en",
504
+
"score": 1.0
505
+
},
506
+
"translations": [
507
+
{
508
+
"text": "J'aimerais vraiment conduire votre voiture autour du pâté de maisons plusieurs fois!",
> [My REST API call was successful](#next-steps)[I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Java&Product=Translator&Page=quickstart-translator&Section=build-and-run-your-java-application)
523
+
524
+
### [JavaScript: Node.js](#tab/nodejs)
525
+
526
+
### Set up your Node.js Express project
411
527
412
528
1. If you haven't done so already, install the latest version of [Node.js](https://nodejs.org/en/download/). Node Package Manager (npm) is included with the Node.js installation.
413
529
@@ -453,6 +569,11 @@ Once you've added a code sample to your application, navigate back to your main
453
569
> * Type the following command **New-Item index.js**.
454
570
>
455
571
> * You can also create a new file named `index.js` in your IDE and save it to the `translator-app` directory.
572
+
<!-- checked -->
573
+
> [!div class="nextstepaction"]
574
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Python&Product=Translator&Page=quickstart-translator&Section=set-up-your-nodejs-express-project)
575
+
576
+
### Build your JavaScript application
456
577
457
578
1. Add the following code sample to your `index.js` file. **Make sure you update the key variable with the value from your Azure portal Translator instance**:
458
579
@@ -486,8 +607,11 @@ Once you've added a code sample to your application, navigate back to your main
486
607
})
487
608
488
609
```
610
+
<!-- checked -->
611
+
> [!div class="nextstepaction"]
612
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Python&Product=Translator&Page=quickstart-translator&Section=build-your-javascript-application)
489
613
490
-
### Run your application
614
+
### Run your JavaScript application
491
615
492
616
Once you've added the code sample to your application, run your program:
493
617
@@ -499,9 +623,38 @@ Once you've added the code sample to your application, run your program:
499
623
node index.js
500
624
```
501
625
626
+
**Translation output:**
627
+
628
+
After a successful call, you should see the following response:
629
+
630
+
```json
631
+
[
632
+
{
633
+
"detectedLanguage": {
634
+
"language": "en",
635
+
"score": 1.0
636
+
},
637
+
"translations": [
638
+
{
639
+
"text": "J'aimerais vraiment conduire votre voiture autour du pâté de maisons plusieurs fois!",
> [My REST API call was successful](#next-steps)[I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Java&Product=Translator&Page=quickstart-translator&Section=run-your-javascript-application)
654
+
502
655
### [Python](#tab/python)
503
656
504
-
### Create a Python application
657
+
### Set up your Python project
505
658
506
659
1. If you haven't done so already, install the latest version of [Python 3.x](https://www.python.org/downloads/). The Python installer package (pip) is included with the Python installation.
507
660
@@ -517,6 +670,11 @@ Once you've added the code sample to your application, run your program:
517
670
518
671
> [!NOTE]
519
672
> We will also use a Python built-in package called json. It's used to work with JSON data.
673
+
<!-- checked -->
674
+
> [!div class="nextstepaction"]
675
+
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Python&Product=Translator&Page=quickstart-translator&Section=set-up-your-python-project)
676
+
677
+
### Build your Python application
520
678
521
679
1. Create a new Python file called **translator-app.py** in your preferred editor or IDE.
> [I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Python&Product=Translator&Page=quickstart-translator&Section=build-your-python-application)
562
723
563
-
### Run your python application
724
+
### Run your Python application
564
725
565
726
Once you've added a code sample to your application, build and run your program:
566
727
@@ -572,11 +733,9 @@ Once you've added a code sample to your application, build and run your program:
572
733
python translator-app.py
573
734
```
574
735
575
-
---
576
-
577
-
### Translation output
736
+
**Translation output:**
578
737
579
-
After a successful call, you should see the following response:
738
+
After a successful call, you should see the following response:
580
739
581
740
```json
582
741
[
@@ -599,10 +758,15 @@ After a successful call, you should see the following response:
599
758
]
600
759
601
760
```
761
+
<!-- checked -->
762
+
> [!div class="nextstepaction"]
763
+
> [My REST API call was successful](#next-steps)[I ran into an issue](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=Python&Product=Translator&Page=quickstart-translator&Section=run-your-python-application)
764
+
765
+
---
602
766
603
-
That's it, congratulations! You have learned to use the Translator service to translate text.
767
+
## Next steps
604
768
605
-
## Next step
769
+
That's it, congratulations! You've learned to use the Translator service to translate text.
606
770
607
771
Explore our how-to documentation and take a deeper dive into Translation service capabilities:
608
772
@@ -614,4 +778,4 @@ That's it, congratulations! You have learned to use the Translator service to tr
0 commit comments