Instant Messaging
Text message translation
Update time: 2023/10/24 11:12:00
Translate a text message. Users can translate text messages by long pressing the message.
Considerations
- Text translation is an add-on feature and must be activated before use. You can contact sales to activate the service. For specific billing rules, see Text translation billing rules.
- Up to 5,000 can be translated by a single API call by default, and 1 million API calls are allowed in one hour.
API rate limit
- Apps can call the API by 100 times per second. If API calls exceeds the rate limit, requests from the app will be blocked for 10 seconds before the API become available again.
Request URI
POST http://api.netease.im/nimserver/translator/textMsg.action HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=utf-8
Request parameters
-
For information about how to set the header in a POST request, see API Call methods.
-
The settings of the body in a POST request:
Parameter | Type | Required | Description |
---|---|---|---|
accid | String | Yes | IM account |
text | String | Yes | Text to be translated, up to 5,000 characters |
to | String | Yes | Target language, auto (automatic recognition) is not supported Example: "en", for more supported language codes, see Supported languages |
from | String | No | Source language, if unspecified, the default value is set to auto. The source language is automatically recognized Example: "zh-CHS", for more supported language codes, please see Supported Languages |
Response fields
Field | Type | Example | Description |
---|---|---|---|
translation | String | Hello | Translation results |
language | String | la2en | The source language and the target language are separated by '2.' The source language is positioned before '2,' while the target language is located after it. |
timestamp | Number | 1658233825185 | Time when the translation was completed |
Example
cURL example request
curl -X POST -H "AppKey: fe416640c8e8a72734219e184*****" -H "Nonce: 12345" -H "CurTime: 1658214270" -H "CheckSum: ******" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=ygy1&text=你好&to=en' 'http://api.netease.im/nimserver/translator/textMsg.action'
Example response
{
"code": 200,
"data": {
"translation": "Hello",
"language": "la2en",
"timestamp": 1658233825185
}
}
Status codes
The status code returned in the response body. For more information, see Status codes.
Supported languages
Chinese
English | Chinese | Code |
---|---|---|
Simplified Chinese | 简体中文 | zh-CHS |
Traditional Chinese | 繁体中文 | zh-CHT |
Common languages
English | Chinese | Code |
---|---|---|
Vietnamese | 越南语 | vi |
English | 英语 | en |
Indonesian | 印度尼西亚语 | id |
Italian | 意大利语 | it |
Spanish | 西班牙语 | es |
Japanese | 日语 | ja |
Portuguese | 葡萄牙语 | pt |
Korean | 韩语 | ko |
French | 法语 | fr |
Russian | 俄语 | ru |
German | 德语 | de |
Arabic | 阿拉伯语 | ar |
Thai | 泰语 | th |
Uncommon languages
English | Chinese | Code |
---|---|---|
Afrikaans | 南非荷兰语 | af |
Bosnian (Latin) | 波斯尼亚语 | bs |
Bulgarian | 保加利亚语 | bg |
Cantonese (Traditional) | 粤语 | yue |
Catalan | 加泰隆语 | ca |
Croatian | 克罗地亚语 | hr |
Czech | 捷克语 | cs |
Danish | 丹麦语 | da |
Dutch | 荷兰语 | nl |
Estonian | 爱沙尼亚语 | et |
Fijian | 斐济语 | fj |
Finnish | 芬兰语 | fi |
Greek | 希腊语 | el |
Haitian | 海地克里奥尔语 | ht |
Hebrew | 希伯来语 | he |
Hindi | 印地语 | hi |
Hmong | 白苗语 | mww |
Hungarian | 匈牙利语 | hu |
Kiswahili | 斯瓦希里语 | sw |
Klingon | 克林贡语 | tlh |
Latvian | 拉脱维亚语 | lv |
Lithuanian | 立陶宛语 | lt |
Malay | 马来语 | ms |
Maltese | 马耳他语 | mt |
Norwegian | 挪威语 | no |
Persian | 波斯语 | fa |
Polish | 波兰语 | pl |
Querétaro Otomi | 克雷塔罗奥托米语 | otq |
Romanian | 罗马尼亚语 | ro |
Serbian (Cyrillic) | 塞尔维亚语(西里尔文) | sr-Cyrl |
Serbian (Latin) | 塞尔维亚语(拉丁文) | sr-Latn |
Slovak | 斯洛伐克语 | sk |
Slovenian | 斯洛文尼亚语 | sl |
Swedish | 瑞典语 | sv |
Tahitian | 塔希提语 | ty |
Tongan | 汤加语 | to |
Turkish | 土耳其语 | tr |
Ukrainian | 乌克兰语 | uk |
Urdu | 乌尔都语 | ur |
Welsh | 威尔士语 | cy |
Yucatec | 尤卡坦玛雅语 | yua |
Albanian | 阿尔巴尼亚语 | sq |
Amharic | 阿姆哈拉语 | am |
Armenian | 亚美尼亚语 | hy |
Azeerbaijani | 阿塞拜疆语 | az |
Bangla | 孟加拉语 | bn |
Basque | 巴斯克语 | eu |
Belarusian | 白俄罗斯语 | be |
Cebuano | 宿务语 | ceb |
Corsican | 科西嘉语 | co |
Esperanto | 世界语 | eo |
Filipino | 菲律宾语 | tl |
Frisian | 弗里西语 | fy |
Galician | 加利西亚语 | gl |
Georgian | 格鲁吉亚语 | ka |
Gujarati | 古吉拉特语 | gu |
Hausa | 豪萨语 | ha |
Hawaiian | 夏威夷语 | haw |
Icelandic | 冰岛语 | is |
Igbo | 伊博语 | ig |
Irish | 爱尔兰语 | ga |
Javanese | 爪哇语 | jw |
Kannada | 卡纳达语 | kn |
Kazakh | 哈萨克语 | kk |
Khmer | 高棉语 | km |
Kurdish | 库尔德语 | ku |
Kyrgyz | 柯尔克孜语 | ky |
Lao | 老挝语 | lo |
Latin | 拉丁语 | la |
Luxembourgish | 卢森堡语 | lb |
Macedonian | 马其顿语 | mk |
Malagasy | 马尔加什语 | mg |
Malayalam | 马拉雅拉姆语 | ml |
Maori | 毛利语 | mi |
Marathi | 马拉地语 | mr |
Mongolian | 蒙古语 | mn |
Myanmar (Burmese) | 缅甸语 | my |
Nepali | 尼泊尔语 | ne |
Nyanja (Chichewa) | 齐切瓦语 | ny |
Pashto | 普什图语 | ps |
Punjabi | 旁遮普语 | pa |
Samoan | 萨摩亚语 | sm |
Scots | 苏格兰盖尔语 | gd |
Sesotho | 塞索托语 | st |
Shona | 修纳语 | sn |
Sindhi | 信德语 | sd |
Sinhala (Sinhalese) | 僧伽罗语 | si |
Somali | 索马里语 | so |
Sundanese | 巽他语 | su |
Tajik | 塔吉克语 | tg |
Tamil | 泰米尔语 | ta |
Telugu | 泰卢固语 | te |
Uzbek | 乌兹别克语 | uz |
Xhosa | 南非科萨语 | xh |
Yiddish | 意第绪语 | yi |
Yoruba | 约鲁巴语 | yo |
Zulu | 南非祖鲁语 | zu |
Text translation billing rules
The text translation service is billed based on the source language and the number of characters translated in the target language.
Billing
- There are no service charges, and each application is allocated a free quota of 500,000 characters. This free quota is calculated from the moment the function is activated.
- If the free quota is exceeded, additional charges will apply as follows:
- Translation between Chinese and common languages: 200 CNY per 5 million characters
- Translation between Chinese and non-common languages: 400 CNY per 5 million characters
- Translation between uncommon languages: 400 CNY per 5 million characters.
No billing scenarios
- API call failure resulting in a 500 status code (indicating an internal server error), no charges will be incurred.
- Repeated translations of the identical text within a 5-minute window will not be billed.
Overdue payment
- Usage volume resets to zero at the start of each month. In case of overdue payments, text translation service will remain active until Instant Messaging is suspended.
Was this page helpful?
Yes
No