Skip to main content

Translate

AndroidiOS

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

Translation. See TranslatorLang for the list of supported languages.

Function definition​

public static void Translate(INTLTranslatorReq req_info);

Parameter Instructions​

ParametersTypeExplanation
req_infoINTLTranslatorReqTranslation request information. For details, see INTLTranslatorReq

Observers​

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

Callback ID is INTL_TRANSLATOR_TRANSLATE.

Code example​

TranslatorLang contains the list of supported voice languages. For details, see TranslatorLang.

INTLTranslatorReq translatorReq = new INTLTranslatorReq();
// SrcLang is not required, default is auto
translatorReq.SrcLang = TranslatorLang.auto_lang;
// TranslatorLang provides the currently supported languages
translatorReq.TargetLang = TranslatorLang.en;
// Content to be translated, supports up to 5 items in the following format
translatorReq.TranslateTexts = "[\"xxx\", \"xxx\"]";
// Business Project Code, please contact your Admin for details, incorrect usage will result in error.
translatorReq.GameCode = "";
// Unique request ID for tracking purposes
translatorReq.TraceId = "";
// Initiate the translation request
INTLAPI.Translate(translatorReq);