startTranslate(params: Object)
Requires:
WearKit≥1.4.0@ray-js/ray≥1.7.82
Platforms:
iOSAndroid
Description
Start translation.
Parameters
| Property | Type | Required | Description |
|---|---|---|---|
originText | string | Yes | Source text |
originLanguage | string | Yes | Source language |
targetLanguage | string | Yes | Target language |
needTts | boolean | Yes | Whether TTS is required |
complete | () => void | No | Completion callback (executed on both success and failure) |
success | (params: Object) => void | No | Callback on successful API call |
fail | (params: Object) => void | No | Failure callback |
success callback parameters
| Property | Type | Description | WearKit Since |
|---|---|---|---|
originText | string | Source text | - |
translateText | string | Translated text | - |
originLanguage | string | Source language | - |
targetLanguage | string | Target language | - |
ttsPath | string | TTS path | - |
errorCode | string | Sensitive content error codes 1001 indicates public sensitive topics, 1002 indicates violence and dangerous acts, 1003 indicates adult and sexual content. | v3.5.9 |
fail callback parameters
| Property | Type | Description |
|---|---|---|
errorMsg | string | Error message |
errorCode | string | number | Error code |
| Error extension |
Return Value
None
Error Code
| Error Code | Error Message |
|---|---|
10001 | Internal error |
10100 | Generic translation error |
10101 | TTS URL error |