Voice Translation (TranslateVoice)
AndroidiOS
If you are using the Unreal Engine, see TranslateVoice in the Unreal Engine SDK.
For voice translation, refer to TranslatorLang to view the list of supported languages.
Login Requirement
Login is required before calling this API.If you are not logged in, a NEED_LOGIN error will be returned.
Function definition
public static void TranslateVoice(INTLTranslatorVoiceReq req_info);
Parameter Instructions
| Parameters | Type | Explanation |
|---|---|---|
| req_info | INTLTranslatorVoiceReq | Translation request information. For details, see TranslatorVoiceReq |
Observers
The callback handling interface is TranslatorResultObserver.The callback data structure is TranslatorResult.
Callback ID is kMethodIDTranslatorTranslateVoice.
Code example
var translatorReq = new INTLTranslatorVoiceReq();
var NativePath = "";
// Define path based on project Platform
#if UNITY_ANDROID
NativePath = Path.Combine(Application.persistentDataPath, "intl-test/000.wav");
#elif UNITY_IOS
NativePath = Path.Combine(Application.persistentDataPath, "intl-test/000.wav");
#elif UNITY_STANDALONE_WIN
NativePath = Path.Combine(Application.persistentDataPath, "intl-test/000.wav");
#elif UNITY_PS5
NativePath = Path.Combine(Application.persistentDataPath, "intl-test/000.wav");
#elif UNITY_GAMECORE_XBOXSERIES || UNITY_GAMECORE_SCARLETT
NativePath = Path.Combine(Application.persistentDataPath, "intl-test/000.wav");
#else
NativePath = Path.Combine(Application.persistentDataPath, "intl-test/000.wav");
#endif
translatorReq.VoicePath = NativePath;
// Business game code, for details please consult your business Admin. Improper usage will result in errors.
translatorReq.GameCode = "";
// Unique request ID used for tracking
translatorReq.TraceId = "";
INTLAPI.TranslateVoice(translatorReq);