# WeChat Translation
Interface should be called on the server side, not in the front end (Weixin Mini Program, web pages, APP, etc.) directly called, specific reference interface call guide
Interface name: translateContent
This interface is used for text content translation
# 1. How to call
# HTTPS calls
POST https://api.weixin.qq.com/cgi-bin/media/voice/translatecontent?access_token=ACCESS_TOKEN&lfrom=LFROM<o=LTO
# Cloud Calls
- This interface does not support cloud calls
# Third party invocation
- Third Party Platform calls are not supported by this interface.
# 2. Request parameters
# Query parametersQuery String parameters
Parameter Name | type | Required to fill in | Example | Introductions |
---|---|---|---|---|
access_token | string | yes | ACCESS_TOKEN | Interface invoke credentials, using access_token |
lfrom | string | yes | zh_CN | Source language, zh_CN or en_US |
lto | string | yes | en_US | Target language, zh_CN or en_US |
# Request BodyRequest Payload
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
content | string | yes | Source content (utf8 format, up to 600 bytes) |
# 3. Return Parameters
# Response Payload
Parameter Name | type | Introductions |
---|---|---|
from_content | string | Original content |
to_content | string | Translation content |
# 4. Note
There are no special considerations for this interface
# 5. Code examples
Example Requests
https://api.weixin.qq.com/cgi-bin/media/voice/translatecontent?access_token=ACCESS_TOKEN&lfrom=xxx<o=xxx
Return an example
{
"from_content": "你好",
"to_content": "Hello"
}
# 6. Error code
The following is a list of error codes for this interface, other error codes can refer to General error codes
Error code | Error Description | Solutions |
---|---|---|
40001 | invalid credential access_token isinvalid or not latest | AppSecret error while getting access_token, or access_token is invalid.Developers should check that AppSecret is correct, or that they are calling interfaces for the appropriate Official Account |
40035 | invalid args size | Illegal parameters |
# 7. Scope of application
How this interface can be invoked under different account types:
Weixin Mini Program | Official Account | Service Account | MiniGame | Mobile App |
---|---|---|---|---|
✔ | ✔ | ✔ | ✔ | ✔ |
- ✔: The account can call this interface
- Other account types that are not expressly stated may not be called on this interface without special instructions;