Updated on 2024-07-30 GMT+08:00

Setting the Language

Function

This API is used to set the language. The default language is Chinese. To customize a language, create the corresponding internationalization files in \HwmSdk\sdkResources\language\ in Windows or /HWMUISDK.framework/Versions/A/Frameworks/WKLanguage.framework/Resources/ in macOS. For example, create \ar\temp.js in Windows or ar.lproj/Localizable.strings in macOS for Arabic. The language set through this API must be the same as the system language.

Function Prototype

setLanguage(languageInfo: LanguageInfo, onSetLanguageResult?: (ret: SDKERR, reason: string) => void): voidsetLanguage(languageInfo: LanguageInfo, onSetLanguageResult?: (ret: SDKERR, reason: string) => void): void

Request Parameters

Table 1 Input parameter description
Parameter Mandatory Type Description
languageInfo Yes LanguageInfo Language type information.
onSetLanguageResult Yes (ret: SDKERR, reason: string) => void Callback of setting the language.
Table 2 LanguageInfo
Parameter Mandatory Type Description
type Yes Language Language type.
languageCode No string Code of the custom language.
Table 3 Enumerated values of Language
Enumeration Name Enumerated Value Description
HWM_LANGUAGE_ZH_CN 0 Chinese.
HWM_LANGUAGE_EN_GB 1 English.
HWM_LANGUAGE_CUSTOMIZED 2 Custom language.

Return Values

void

Callback Method Parameters

(ret: SDKERR, reason: string) => void

Table 4 Input parameter description
Parameter Type Description
ret For details about SDKERR, see Error Code Reference. Error code.
reason string Error description.