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
Copy file name to clipboardExpand all lines: sdk/translation/azure-ai-translation-text/samples/README.md
+83-10Lines changed: 83 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,36 +24,104 @@ Translator Service is a cloud-based neural machine translation service that is p
24
24
25
25
See the [README][README] of the Text Translator client library for more information, including useful links and instructions.
26
26
27
-
## Common scenarios samples
27
+
#Create Client
28
28
29
+
Text Translation service is using two types of endpoints - Global and Custom. You can find more information in the [v3 Translator reference][TranslatorReference].
29
30
30
-
#Create Client
31
+
## Global Endpoint
31
32
32
-
For some of these operations you can create a new `TextTranslationClient` without any authentication. You will only need your endpoint:
33
+
When using Text Translation service with global endpoint, the endpoint doesn't need to be provided when creating `TextTranslationClient`. When `endpoint` is
34
+
not provided, global `api.cognitive.microsofttranslator.com` is used. For [sovereign clouds][SovereignClouds], the endpoint is always required.
The values of the `endpoint` variable can be retrieved from environment variables, configuration settings, or any other secure approach that works for your application.
49
+
### Using the Cognitive Services Token
43
50
44
-
For other samples an overloaded constructor is provided that uses a TextTranslationCredential. In addition to `endpoint`, this function requires configuring an `apikey` and `region` to create the credential. The values of the `endpoint`, `apiKey` and `region` variables can be retrieved from environment variables, configuration settings, or any other secure approach that works for your application.
51
+
For the Cognitive Services Token authentication, there is currently no implementation provided in the SDK. You can implement the solution
52
+
according to the [Token Authentication documentation][TranslatorReference]. For a simple example implementation, you can refer: [StaticAccessTokenCredential][static_access_token_credential].
53
+
When the token is created, you can create the `TextTranslationClient`:
45
54
46
-
The appropriate constructor is invoked in each sample to create a `TextTranslationClient` instance.
The Authentication with Microsoft Entra ID on global endpoint requires bearer token generated by Azure AD, Region of the translator resource
66
+
and Resource ID for your Translator resource instance. For prerequisites and more information refer to [Authentication with Microsoft Entra ID][TranslatorReference].
When using some selected features (for example Virtual Network) you need to use custom endpoints. More information can be found in [Virtual Network support][TranslatorReference].
80
+
81
+
### Using the Subscription Key
82
+
83
+
For Custom endpoint and cognitive services key combination, you don't need to provide the region:
The values of the `endpoint` variable can be retrieved from environment variables, configuration settings, or any other secure approach that works for your application.
124
+
57
125
# Get Languages
58
126
59
127
This sample demonstrates how to get languages that are supported by other operations.
0 commit comments