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-VALUEHolds the translated text.
<input_text>TEXTThe input text that needs to be translated
<target_language>TEXTThe two-letter ISO code representing the language to which the input text needs to be translated. 

[source_language]

(optional)

TEXTThe 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. "af" - Afrikaans
  2. "sq" - Albanian
  3. "ar" - Arabic
  4. "hy" - Armenian
  5. "as" - Assamese
  6. "az" - Azerbaijani
  7. "eu" - Basque
  8. "be" - Belarusian
  9. "bn" - Bengali
  10. "bg" - Bulgarian
  11. "ca" - Catalan
  12. "zh" - Chinese
  13. "zh-CN" - Chinese (Simplified)
  14. "zh-TW" - Chinese (Traditional)
  15. "hr" - Croatian
  16. "cs" - Czech
  17. "da" - Danish
  18. "nl" - Dutch
  19. "en" - English
  20. "eo" - Esperanto
  21. "et" - Estonian
  22. "fil" - Filipino
  23. "fi" - Finnish
  24. "fr" - French
  25. "gl" - Galician
  26. "ka" - Georgian
  27. "de" - German
  28. "el" - Greek
  29. "gu" - Gujarati
  30. "he" - Hebrew
  31. "hi" - Hindi
  32. "hu" - Hungarian
  33. "is" - Icelandic
  34. "id" - Indonesian
  35. "ga" - Irish
  36. "it" - Italian
  37. "ja" - Japanese
  38. "kn" - Kannada
  39. "km" - Khmer
  40. "ko" - Korean
  41. "lo" - Lao
  42. "lv" - Latvian
  43. "lt" - Lithuanian
  44. "mk" - Macedonian
  45. "mg" - Malagasy
  46. "ms" - Malay
  47. "ml" - Malayalam
  48. "mt" - Maltese
  49. "mr" - Marathi
  50. "no" - Norwegian
  51. "or" - Oriya
  52. "fa" - Persian
  53. "pl" - Polish
  54. "pt" - Portuguese
  55. "pa" - Punjabi
  56. "ro" - Romanian
  57. "ru" - Russian
  58. "sr" - Serbian
  59. "si" - Sinhala
  60. "sk" - Slovak
  61. "sl" - Slovenian
  62. "es" - Spanish
  63. "su" - Sundanese
  64. "sw" - Swahili
  65. "sv" - Swedish
  66. "tl" - Tagalog
  67. "ta" - Tamil
  68. "te" - Telugu
  69. "th" - Thai
  70. "tr" - Turkish
  71. "uk" - Ukrainian
  72. "ur" - Urdu
  73. "vi" - Vietnamese
  74. "yi" - Yiddish

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