Setting the Language
SetLanguage
API Description
This API is used to set the GUI language. The default language is Chinese.
Precautions
This API is an asynchronous API. The return value only indicates whether the API is successfully called. The actual service processing result is returned in the corresponding callback function.
Method Definition
1
|
HWM_SDK_AGENT_API hwmsdk::HwmErrCode SetLanguage(HwmLanguage language); |
Callback Function
1
|
virtual void OnSetLanguageResult(hwmsdk::HwmErrCode ret, const char* reason) {}; |
Parameter Description
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
language |
Yes |
HwmLanguage |
GUI language. |
Enumerated Value |
Description |
---|---|
HWM_LANGUAGE_ZH_CN |
Chinese. |
HWM_LANGUAGE_EN_GB |
English. |
HWM_LANGUAGE_CUSTOMIZED |
Custom language. |
Return Values
Type |
Description |
---|---|
HwmErrCode |
If 0 is returned, the operation is successful. If other values are returned, the operation fails. For details about values returned upon failures, see Common Error Codes. |
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/** * Change the language. */ void demoSettingDlg::OnBnClickedButtonSetLanCode() { // Set the language to Chinese. hwmsdkagent::HwmLanguage languageCode = hwmsdkagent::HWM_LANGUAGE_ZH_CN; int ret = hwmsdkagent::SetLanguage((hwmsdkagent::HwmLanguage)languageCode); if (hwmsdk::HWM_COMMON_SUCCESS != ret) { AfxMessageBox(_T("SetLanguage error")); } } |
SetLanguageWithCode
API Description
This API is used to customize the SDK language. The default language is Chinese.
Precautions
- To customize a language, create the corresponding internationalization files in \HwmSdk\sdkResources\language\. For example, create \ar\temp.js when you set the SDK language to Arabic. The language set using this API must be the same as the system language.
- This API is an asynchronous API. The return value only indicates whether the API is successfully called. The actual service processing result is returned in the corresponding callback function.
Method Definition
1
|
HWM_SDK_AGENT_API hwmsdk::HwmErrCode SetLanguageWithCode(HwmLanguage language, const char* languageCode); |
Callback Function
1
|
virtual void OnSetLanguageResult(hwmsdk::HwmErrCode ret, const char* reason) {}; |
Parameter Description
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
language |
Yes |
HwmLanguage |
GUI language. |
languageCode |
No |
char[] |
Language code. If the language is Chinese or English, this parameter can be left empty. |
Return Values
Type |
Description |
---|---|
HwmErrCode |
If 0 is returned, the operation is successful. If other values are returned, the operation fails. For details about values returned upon failures, see Common Error Codes. |
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/** * Change the language. */ void demoSettingDlg::OnBnClickedButtonSetLanCode() { // Set the language to a custom language. Arabic is used as an example. hwmsdkagent::HwmLanguage languageCode = hwmsdkagent::HWM_LANGUAGE_CUSTOMIZED; CString code = "ar"; int ret = hwmsdkagent::SetLanguageWithCode((hwmsdkagent::HwmLanguage)languageCode, CTools::UNICODE2UTF(code).c_str()); if (hwmsdk::HWM_COMMON_SUCCESS != ret) { AfxMessageBox(_T("SetLanguageWithCode error")); } } |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot