Skip to main content

Voice Translation (TranslateVoice)

AndroidiOSWindows
If you are using Unreal Engine, please see Unreal Engine SDK's TranslateVoice.

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

ParametersTypeExplanation
req_infoINTLTranslatorVoiceReqTranslation 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);