Setting the Language
setLanguage
API Description
This API is used to set the SDK language. The default language is Chinese.
Precautions
To customize a language, create the corresponding internationalization file under /src/main/res/ of the main project. For example, to add Arabic, you can create /values-ar/string.xml. Refer to the language templates in the languagetemplates folder. The language set through this API must be the same as the system language.
Method Definition
void setLanguage(LanguageType languageType, String language);
Parameter Description
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
languageType |
Yes |
Enumerated values of languages. |
|
language |
Yes |
String |
If LanguageType is set to Chinese or English, this parameter can be left empty or set to any value. If LanguageType is set to other languages, set this parameter to the language code, for example, ar (Arabic). |
Enumerated Value |
Description |
---|---|
LANGUAGE_TYPE_CN_ZH |
Chinese. |
LANGUAGE_TYPE_EN |
English. |
LANGUAGE_TYPE_CUSTOMIZED |
Custom language. |
Return Values
None
Sample Code
// Specify the enumerated value if you set the language to Chinese or English. HWMSdk.getOpenApi(this).setLanguage(LanguageType.LANGUAGE_TYPE_EN, ""); // If you set the language to other languages, add the language code, for example, ar for Arabic, and add the Arabic translation files to the resource folder of the main project. HWMSdk.getOpenApi(this).setLanguage(LanguageType.LANGUAGE_TYPE_CUSTOMIZED, "ar");
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