Translate

Translate

Description

The zoho.ai.translate task translates the input text into the specified language.

Note: 
  • The prediction results may not be accurate, which is also the case with any AI prediction. However, we are working on improving this.
  • The prediction results are dynamic. The same script may produce different outcomes at different times based on how much the machine has learned.

Syntax

<response> = zoho.ai.translate(<input_text>, <target_language>, [source_language]);

where:

ParamsData typeDescription

<response>

KEY-VALUE

Holds the translated text.

<input_text>

TEXT

The input text that needs to be translated

<target_language>

TEXT

The two-letter ISO code representing the language to which the input text needs to be translated. 

[source_language]

(optional)

TEXT

The two-letter ISO code representing the language in which the input text is supplied. If no value is supplied to this parameter it assumes "en" representing English.

Note: The following are the supported languages and their language codes:
  1. "en" - English
  2. "de" - German
  3. "zh" - Chinese
  4. "ru" - Russian
  5. "it" - Italian
  6. "pt" - Portuguese
  7. "es" - Spanish
  8. "fr" - French
  9. "ar" - Arabic
  10. "cs" - Czech
  11. "hu" - Hungarian
  12. "nl" - Dutch
  13. "pl" - Polish
  14. "sv" - Swedish
  15. "ja" - Japanese
  16. "ro" - Romanian

Example

The following script translates the given English text into Spanish.

 response = zoho.ai.translate("I will collect the package tomorrow", "es");

where:

response
The KEY-VALUE response that holds the translated text.
"I will collect the package tomorrow"
The TEXT that represents the input that needs to be translated.
"es"
The TEXT that represents language code to which the input text that needs to be translated. "es" represents Spanish.

Example 2

The following script translates the given French text into Chinese.

 response=zoho.ai.translate("Je vous remercie de la session","zh","fr");

where:

"Je vous remercie de la session"
The TEXT that represents the input that needs to be translated.
"zh"
The TEXT that represents language code of the target language. "zh" represents Chinese.
"fr"
The TEXT that represents language code of the source language. "fr" represents French.

Response Format

Success Response

  • The success response will be returned in the following format:.

     {
     "source_language": "fr",
     "status": {
     "code": 200,
     "message": "success"
     },
     "target_language": "zh",
     "translation": [
     {
     "source": "Je vous remercie de la session",
     "translate": "谢谢本届会议。"
     }
     ]
     }


    ​Note: To fetch the translated text from the response, use the following script:

    info response.get("translation").get(0).get("translate");

Related Links

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com