Customize multi-language support for your app
Updated at:
This topic describes how to use the software development kit (SDK) to customize and update languages for your app. This lets you quickly configure multi-language support for different countries.
Background information
IoT Platform supports devices used outside China. The app must adapt to the local language for cloud-to-app management. This helps users interact with devices more smoothly and improves the user experience.
Develop custom multi-language support for Android
Android provides native support for multiple languages. The process involves a few simple steps.
- In the `res` resource folder, right-click the `value` folder and create an XML resource file. The file must have the same name as the XML file in the SDK.
- First, click Locale. Then, open the language selection interface and select your desired country and language.
- Click OK. The system automatically creates an XML file.
- Copy all the string fields from the XML file in the SDK to the file you just created.

- Modify the value of each key that you want to customize.
Important If you customize the file this way, do not delete any strings. Deleting strings causes a compilation error.
Develop custom multi-language support for iOS
Switching Open Account languages
- Simple integration
- Integrate the following dependencies:
pod 'IMSOpenAccountCustom', '1.1.9' pod 'AlicloudALBBOpenAccount', '3.4.0.52'. - Move the XIB files from the IMSOpenAccountCustomResource.bundle file in IMSOpenAccountCustom to your main project.
- Set the language by specifying its prefix. For example, set the prefix for Chinese to
zh. The languages available for the Open Account (OA) module are the same as those in the SDK. For more information, see General-purpose SDKs
Use the default translation resource file
[[IMSiLopOALanguageManage shareInstance] setOpenAccountModuleLanguageWithLanguagePrefix:@"ko"];Use your own translation resource file
- Copy the .lproj files from IMSOpenAccountCustomResource.bundle in IMSOpenAccountCustom. Then, create a multi-language translation file with the same keys.
- In
Language.json, add the configuration for your custom language in the specified format.[[IMSiLopOALanguageManage shareInstance] setOpenAccountModuleLanguageWithLanguagePrefix:@"xxx" ];
- Integrate the following dependencies:
- Advanced customization
- Set the cloud language. For the supported languages, see General-purpose SDKs
[[ALBBOpenAccountSDK sharedInstance] setRpcLocale:locale]; - Modify the display language on the XIB files. The default language is Chinese.
- Copy the content of the .lproj files from ALBBOpenAccount.bundle in ALBBOpenAccountUI. Then, create a multi-language translation file with the same keys.
- Specify the internationalization file to display.
[[ALBBOpenAccountSDK sharedInstance] setLocale:@"zh.lproj"]; - Specify the path of the internationalization file.
NSString *bundlePath = [NSString stringWithFormat:@"%@/%@.bundle/zh.lproj",[NSBundle mainBundle].bundlePath, bundleName]; [[ALBBOpenAccountSDK sharedInstance] setLocaleBundle:[NSBundle bundleWithPath:bundlePath]]; - Set the delegate for each controller in the XIB files. In the delegate methods, retrieve the multi-language text for the controls and assign the text to them.
id<ALBBOpenAccountUIService> uiService = ALBBService(ALBBOpenAccountUIService); [uiService setLoginViewDelegate:self]; - (void)loginViewDidLoad:(ALBBOpenAccountLoginViewController *)viewController { viewController.usernameField.placeholder = @"xxx";// Assign value from resources viewController.usernameLabel.text = @"xxx";// Assign value from resources }
- Set the cloud language. For the supported languages, see General-purpose SDKs
Is this page helpful?