Skip to main content

Voice Translation V2 (TranslateVoiceV2)

AndroidiOS

If you are using the Unreal Engine, please refer to TranslateVoiceV2 in the Unreal Engine SDK.

For voice translation, refer to TranslatorLang to view the list of supported languages.

Login Requirements

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 TranslateVoiceV2(INTLTranslatorVoiceV2Req req_info);

Parameter Instructions​

ParametersTypeExplanation
req_infoINTLTranslatorVoiceV2ReqTranslation request information. For details, see TranslatorVoiceV2Req

Observers​

The callback handling interface is TranslatorResultObserver.The callback data structure is TranslatorResult.

Callback ID is kMethodIDTranslatorTranslateVoiceV2.

Code example​

var translatorReq = new INTLTranslatorVoiceV2Req();
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;
// Audio format: 1 = WAV, 2 = GVoice Opus
translatorReq.AudioFormat = 1;
// Business Game Code, please consult your Admin for details. Incorrect usage will cause errors.
translatorReq.GameCode = "";
// Unique request ID for tracking purposes
translatorReq.TraceId = "";
INTLAPI.TranslateVoiceV2(translatorReq);