Skip to main content

Voice Translation (TranslateVoice)

WindowsAndroidiOS
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.

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 your 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, please contact your business administrator for details, incorrect usage will result in error.
translatorReq.GameCode = "";
// Unique request ID for tracking purposes
translatorReq.traceId = "";
INTLAPI.TranslateVoice(translatorReq);