Class TextTranslationClient

java.lang.Object
com.azure.ai.translation.text.TextTranslationClient

public final class TextTranslationClient extends Object
Initializes a new instance of the synchronous TextTranslationClient type.
  • Method Details

    • translateWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> translateWithResponse(List<String> targetLanguages, com.azure.core.util.BinaryData body, com.azure.core.http.rest.RequestOptions requestOptions)
      Translate Text.

      Query Parameters

      Query Parameters
      NameTypeRequiredDescription
      fromStringNoSpecifies the language of the input text. Find which languages are available to translate from by looking up supported languages using the translation scope. If the from parameter isn't specified, automatic language detection is applied to determine the source language. You must use the from parameter rather than autodetection when using the dynamic dictionary feature. Note: the dynamic dictionary feature is case-sensitive.
      textTypeStringNoDefines whether the text being translated is plain text or HTML text. Any HTML needs to be a well-formed, complete element. Possible values are: plain (default) or html. Allowed values: "Plain", "Html".
      categoryStringNoA string specifying the category (domain) of the translation. This parameter is used to get translations from a customized system built with Custom Translator. Add the Category ID from your Custom Translator project details to this parameter to use your deployed customized system. Default value is: general.
      profanityActionStringNoSpecifies how profanities should be treated in translations. Possible values are: NoAction (default), Marked or Deleted. Allowed values: "NoAction", "Marked", "Deleted".
      profanityMarkerStringNoSpecifies how profanities should be marked in translations. Possible values are: Asterisk (default) or Tag. . Allowed values: "Asterisk", "Tag".
      includeAlignmentBooleanNoSpecifies whether to include alignment projection from source text to translated text. Possible values are: true or false (default).
      includeSentenceLengthBooleanNoSpecifies whether to include sentence boundaries for the input text and the translated text. Possible values are: true or false (default).
      suggestedFromStringNoSpecifies a fallback language if the language of the input text can't be identified. Language autodetection is applied when the from parameter is omitted. If detection fails, the suggestedFrom language will be assumed.
      fromScriptStringNoSpecifies the script of the input text.
      toScriptStringNoSpecifies the script of the translated text.
      allowFallbackBooleanNoSpecifies that the service is allowed to fall back to a general system when a custom system doesn't exist. Possible values are: true (default) or false. allowFallback=false specifies that the translation should only use systems trained for the category specified by the request. If a translation for language X to language Y requires chaining through a pivot language E, then all the systems in the chain (X → E and E → Y) will need to be custom and have the same category. If no system is found with the specific category, the request will return a 400 status code. allowFallback=true specifies that the service is allowed to fall back to a general system when a custom system doesn't exist.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Header Parameters

      Header Parameters
      NameTypeRequiredDescription
      X-ClientTraceIdStringNoA client-generated GUID to uniquely identify the request.
      You can add these to a request with RequestOptions.addHeader(java.lang.String, java.lang.String)

      Request Body Schema

      
       [
            (Required){
               text: String (Required)
           }
       ]
       

      Response Body Schema

      
       [
            (Required){
               detectedLanguage (Optional): {
                   language: String (Required)
                   score: double (Required)
               }
               translations (Required): [
                    (Required){
                       to: String (Required)
                       text: String (Required)
                       transliteration (Optional): {
                           text: String (Required)
                           script: String (Required)
                       }
                       alignment (Optional): {
                           proj: String (Required)
                       }
                       sentLen (Optional): {
                           srcSentLen (Required): [
                               int (Required)
                           ]
                           transSentLen (Required): [
                               int (Required)
                           ]
                       }
                   }
               ]
               sourceText (Optional): {
                   text: String (Required)
               }
           }
       ]
       
      Parameters:
      targetLanguages - Specifies the language of the output text. The target language must be one of the supported languages included in the translation scope. For example, use to=de to translate to German. It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. For example, use to=de&to=it to translate to German and Italian.
      body - Defines the content of the request.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the response body along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • transliterateWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> transliterateWithResponse(String language, String sourceLanguageScript, String targetLanguageScript, com.azure.core.util.BinaryData body, com.azure.core.http.rest.RequestOptions requestOptions)
      Transliterate Text.

      Header Parameters

      Header Parameters
      NameTypeRequiredDescription
      X-ClientTraceIdStringNoA client-generated GUID to uniquely identify the request.
      You can add these to a request with RequestOptions.addHeader(java.lang.String, java.lang.String)

      Request Body Schema

      
       [
            (Required){
               text: String (Required)
           }
       ]
       

      Response Body Schema

      
       [
            (Required){
               text: String (Required)
               script: String (Required)
           }
       ]
       
      Parameters:
      language - Specifies the language of the text to convert from one script to another. Possible languages are listed in the transliteration scope obtained by querying the service for its supported languages.
      sourceLanguageScript - Specifies the script used by the input text. Look up supported languages using the transliteration scope, to find input scripts available for the selected language.
      targetLanguageScript - Specifies the output script. Look up supported languages using the transliteration scope, to find output scripts available for the selected combination of input language and input script.
      body - Defines the content of the request.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the response body along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • findSentenceBoundariesWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> findSentenceBoundariesWithResponse(com.azure.core.util.BinaryData body, com.azure.core.http.rest.RequestOptions requestOptions)
      Find Sentence Boundaries.

      Query Parameters

      Query Parameters
      NameTypeRequiredDescription
      languageStringNoLanguage tag identifying the language of the input text. If a code isn't specified, automatic language detection will be applied.
      scriptStringNoScript tag identifying the script used by the input text. If a script isn't specified, the default script of the language will be assumed.
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Header Parameters

      Header Parameters
      NameTypeRequiredDescription
      X-ClientTraceIdStringNoA client-generated GUID to uniquely identify the request.
      You can add these to a request with RequestOptions.addHeader(java.lang.String, java.lang.String)

      Request Body Schema

      
       [
            (Required){
               text: String (Required)
           }
       ]
       

      Response Body Schema

      
       [
            (Required){
               detectedLanguage (Optional): {
                   language: String (Required)
                   score: double (Required)
               }
               sentLen (Required): [
                   int (Required)
               ]
           }
       ]
       
      Parameters:
      body - Defines the content of the request.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the response body along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • lookupDictionaryEntriesWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> lookupDictionaryEntriesWithResponse(String sourceLanguage, String targetLanguage, com.azure.core.util.BinaryData body, com.azure.core.http.rest.RequestOptions requestOptions)
      Lookup Dictionary Entries.

      Header Parameters

      Header Parameters
      NameTypeRequiredDescription
      X-ClientTraceIdStringNoA client-generated GUID to uniquely identify the request.
      You can add these to a request with RequestOptions.addHeader(java.lang.String, java.lang.String)

      Request Body Schema

      
       [
            (Required){
               text: String (Required)
           }
       ]
       

      Response Body Schema

      
       [
            (Required){
               normalizedSource: String (Required)
               displaySource: String (Required)
               translations (Required): [
                    (Required){
                       normalizedTarget: String (Required)
                       displayTarget: String (Required)
                       posTag: String (Required)
                       confidence: double (Required)
                       prefixWord: String (Required)
                       backTranslations (Required): [
                            (Required){
                               normalizedText: String (Required)
                               displayText: String (Required)
                               numExamples: int (Required)
                               frequencyCount: int (Required)
                           }
                       ]
                   }
               ]
           }
       ]
       
      Parameters:
      sourceLanguage - Specifies the language of the input text. The source language must be one of the supported languages included in the dictionary scope.
      targetLanguage - Specifies the language of the output text. The target language must be one of the supported languages included in the dictionary scope.
      body - Defines the content of the request.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the response body along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • lookupDictionaryExamplesWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> lookupDictionaryExamplesWithResponse(String sourceLanguage, String targetLanguage, com.azure.core.util.BinaryData body, com.azure.core.http.rest.RequestOptions requestOptions)
      Lookup Dictionary Examples.

      Header Parameters

      Header Parameters
      NameTypeRequiredDescription
      X-ClientTraceIdStringNoA client-generated GUID to uniquely identify the request.
      You can add these to a request with RequestOptions.addHeader(java.lang.String, java.lang.String)

      Request Body Schema

      
       [
            (Required){
               text: String (Required)
               translation: String (Required)
           }
       ]
       

      Response Body Schema

      
       [
            (Required){
               normalizedSource: String (Required)
               normalizedTarget: String (Required)
               examples (Required): [
                    (Required){
                       sourcePrefix: String (Required)
                       sourceTerm: String (Required)
                       sourceSuffix: String (Required)
                       targetPrefix: String (Required)
                       targetTerm: String (Required)
                       targetSuffix: String (Required)
                   }
               ]
           }
       ]
       
      Parameters:
      sourceLanguage - Specifies the language of the input text. The source language must be one of the supported languages included in the dictionary scope.
      targetLanguage - Specifies the language of the output text. The target language must be one of the supported languages included in the dictionary scope.
      body - Defines the content of the request.
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the response body along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • translate

      public List<TranslatedTextItem> translate(String targetLanguage, List<String> texts)
      Translate Text.

      This method is used when you have single target language and multiple texts to translate.

      Parameters:
      targetLanguage - Specifies the language of the output text. The target language must be one of the supported languages included in the translation scope. For example, use to=de to translate to German. It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. For example, use to=de&to=it to translate to German and Italian.
      texts - Defines the content of the request.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • translate

      public TranslatedTextItem translate(String targetLanguage, String text)
      Translate Text.

      This method is used when you have single target language and single text to translate.

      Parameters:
      targetLanguage - Specifies the language of the output text. The target language must be one of the supported languages included in the translation scope. For example, use to=de to translate to German. It's possible to translate to multiple languages simultaneously by repeating the parameter in the query string. For example, use to=de&to=it to translate to German and Italian.
      text - Defines the content of the request.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • translate

      public TranslatedTextItem translate(String text, TranslateOptions translateOptions)
      Translate Text.

      This method is used when you have one input text and the optional parameters are needed such as specification of a source language, profanity handling etc.

      Parameters:
      text - Text to translate.
      translateOptions - Translate Options.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • translate

      public List<TranslatedTextItem> translate(List<String> texts, TranslateOptions translateOptions)
      Translate Text.

      This method is used when you have multiple texts and the optional parameters are needed such as specification of a source language, profanity handling etc..

      Parameters:
      texts - List of text to translate.
      translateOptions - Translate Options.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • transliterate

      public List<TransliteratedText> transliterate(String language, String sourceLanguageScript, String targetLanguageScript, List<String> body)
      Transliterate Text.

      This method is used when you have multiple texts to transliterate and you want to provide client trace id.

      Parameters:
      language - Specifies the language of the text to convert from one script to another. Possible languages are listed in the transliteration scope obtained by querying the service for its supported languages.
      sourceLanguageScript - Specifies the script used by the input text. Look up supported languages using the transliteration scope, to find input scripts available for the selected language.
      targetLanguageScript - Specifies the output script. Look up supported languages using the transliteration scope, to find output scripts available for the selected combination of input language and input script.
      body - Defines the content of the request.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • transliterate

      public TransliteratedText transliterate(String language, String sourceLanguageScript, String targetLanguageScript, String text)
      Transliterate Text.

      This method is used when you have single text to transliterate and you want to provide client trace id.

      Parameters:
      language - Specifies the language of the text to convert from one script to another. Possible languages are listed in the transliteration scope obtained by querying the service for its supported languages.
      sourceLanguageScript - Specifies the script used by the input text. Look up supported languages using the transliteration scope, to find input scripts available for the selected language.
      targetLanguageScript - Specifies the output script. Look up supported languages using the transliteration scope, to find output scripts available for the selected combination of input language and input script.
      text - Defines the content of the request.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • findSentenceBoundaries

      public List<BreakSentenceItem> findSentenceBoundaries(List<String> texts, String language, String script)
      Find Sentence Boundaries.

      This method is used when you have multiple texts for which you want to find sentence boundaries and you want to provide client trace id.

      Parameters:
      texts - Defines the content of the request.
      language - Language tag identifying the language of the input text. If a code isn't specified, automatic language detection will be applied.
      script - Script tag identifying the script used by the input text. If a script isn't specified, the default script of the language will be assumed.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • findSentenceBoundaries

      public BreakSentenceItem findSentenceBoundaries(String text, String language, String script)
      Find Sentence Boundaries.

      This method is used when you have single text for which you want to find sentence boundaries and you want to provide client trace id.

      Parameters:
      text - Defines the content of the request.
      language - Language tag identifying the language of the input text. If a code isn't specified, automatic language detection will be applied.
      script - Script tag identifying the script used by the input text. If a script isn't specified, the default script of the language will be assumed.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • findSentenceBoundaries

      public List<BreakSentenceItem> findSentenceBoundaries(List<String> texts)
      Find Sentence Boundaries.

      This method is used when you have multiple texts for which you want to find sentence boundaries and you want the source language to be auto-detected by the service.

      Parameters:
      texts - Defines the content of the request.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • findSentenceBoundaries

      public BreakSentenceItem findSentenceBoundaries(String text)
      Find Sentence Boundaries.

      This method is used when you have single text for which you want to find sentence boundaries and you want the source language to be auto-detected by the service.

      Parameters:
      text - Defines the content of the request.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • lookupDictionaryEntries

      public List<DictionaryLookupItem> lookupDictionaryEntries(String sourceLanguage, String targetLanguage, List<String> texts)
      Lookup Dictionary Entries.

      This method is used when you want lookup multiple entries in the dictionary and you want to provide client trace id.

      Parameters:
      sourceLanguage - Specifies the language of the input text. The source language must be one of the supported languages included in the dictionary scope.
      targetLanguage - Specifies the language of the output text. The target language must be one of the supported languages included in the dictionary scope.
      texts - Defines the content of the request.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • lookupDictionaryEntries

      public DictionaryLookupItem lookupDictionaryEntries(String sourceLanguage, String targetLanguage, String text)
      Lookup Dictionary Entries.

      This method is used when you want lookup single entry in the dictionary and you want to provide client trace id.

      Parameters:
      sourceLanguage - Specifies the language of the input text. The source language must be one of the supported languages included in the dictionary scope.
      targetLanguage - Specifies the language of the output text. The target language must be one of the supported languages included in the dictionary scope.
      text - Defines the content of the request.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • lookupDictionaryExamples

      public List<DictionaryExampleItem> lookupDictionaryExamples(String sourceLanguage, String targetLanguage, List<DictionaryExampleTextItem> body)
      Lookup Dictionary Examples.
      Parameters:
      sourceLanguage - Specifies the language of the input text. The source language must be one of the supported languages included in the dictionary scope.
      targetLanguage - Specifies the language of the output text. The target language must be one of the supported languages included in the dictionary scope.
      body - Defines the content of the request.
      Returns:
      the response.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getSupportedLanguagesWithResponse

      public com.azure.core.http.rest.Response<com.azure.core.util.BinaryData> getSupportedLanguagesWithResponse(com.azure.core.http.rest.RequestOptions requestOptions)
      Gets the set of languages currently supported by other operations of the Translator.

      Query Parameters

      Query Parameters
      NameTypeRequiredDescription
      scopeStringNoA comma-separated list of names defining the group of languages to return. Allowed group names are: `translation`, `transliteration` and `dictionary`. If no scope is given, then all groups are returned, which is equivalent to passing `scope=translation,transliteration,dictionary`. To decide which set of supported languages is appropriate for your scenario, see the description of the [response object](#response-body).
      You can add these to a request with RequestOptions.addQueryParam(java.lang.String, java.lang.String)

      Header Parameters

      Header Parameters
      NameTypeRequiredDescription
      X-ClientTraceIdStringNoA client-generated GUID to uniquely identify the request.
      Accept-LanguageStringNoThe language to use for user interface strings. Some of the fields in the response are names of languages or names of regions. Use this parameter to define the language in which these names are returned. The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. Names are provided in the English language when a target language is not specified or when localization is not available.
      If-None-MatchStringNoPassing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. If the resource has not been modified, the service will return status code 304 and an empty response body.
      You can add these to a request with RequestOptions.addHeader(java.lang.String, java.lang.String)

      Response Body Schema

      
       {
           translation (Optional): {
               String (Required): {
                   name: String (Required)
                   nativeName: String (Required)
                   dir: String(ltr/rtl) (Required)
               }
           }
           transliteration (Optional): {
               String (Required): {
                   name: String (Required)
                   nativeName: String (Required)
                   scripts (Required): [
                        (Required){
                           code: String (Required)
                           name: String (Required)
                           nativeName: String (Required)
                           dir: String(ltr/rtl) (Required)
                           toScripts (Required): [
                                (Required){
                                   code: String (Required)
                                   name: String (Required)
                                   nativeName: String (Required)
                                   dir: String(ltr/rtl) (Required)
                               }
                           ]
                       }
                   ]
               }
           }
           dictionary (Optional): {
               String (Required): {
                   name: String (Required)
                   nativeName: String (Required)
                   dir: String(ltr/rtl) (Required)
                   translations (Required): [
                        (Required){
                           name: String (Required)
                           nativeName: String (Required)
                           dir: String(ltr/rtl) (Required)
                           code: String (Required)
                       }
                   ]
               }
           }
       }
       
      Parameters:
      requestOptions - The options to configure the HTTP request before HTTP client sends it.
      Returns:
      the set of languages currently supported by other operations of the Translator along with Response.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
    • getSupportedLanguages

      public GetSupportedLanguagesResult getSupportedLanguages(List<LanguageScope> scopes, String acceptLanguage, String ifNoneMatch)
      Gets the set of languages currently supported by other operations of the Translator.
      Parameters:
      scopes - List of names defining the group of languages to return.
      acceptLanguage - The language to use for user interface strings. Some of the fields in the response are names of languages or names of regions. Use this parameter to define the language in which these names are returned. The language is specified by providing a well-formed BCP 47 language tag. For instance, use the value `fr` to request names in French or use the value `zh-Hant` to request names in Chinese Traditional. Names are provided in the English language when a target language is not specified or when localization is not available.
      ifNoneMatch - Passing the value of the ETag response header in an If-None-Match field will allow the service to optimize the response. If the resource has not been modified, the service will return status code 304 and an empty response body.
      Returns:
      the set of languages currently supported by other operations of the Translator.
      Throws:
      IllegalArgumentException - thrown if parameters fail the validation.
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getSupportedLanguages

      public GetSupportedLanguagesResult getSupportedLanguages()
      Gets the set of languages currently supported by other operations of the Translator.
      Returns:
      the set of languages currently supported by other operations of the Translator.
      Throws:
      com.azure.core.exception.HttpResponseException - thrown if the request is rejected by server.
      com.azure.core.exception.ClientAuthenticationException - thrown if the request is rejected by server on status code 401.
      com.azure.core.exception.ResourceNotFoundException - thrown if the request is rejected by server on status code 404.
      com.azure.core.exception.ResourceModifiedException - thrown if the request is rejected by server on status code 409.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.