This topic describes how to integrate the mPaaS internationalization feature with an iOS client.
If your app needs to support multiple languages, you must complete the following tasks.
Adapt for multiple languages (English, French, and Russian)
Check integrated components
Check the components that you have integrated. Some components depend on the AutoNavi software development kit (SDK) or the hotpatching component, which may prevent your app from passing the App Store review. You must replace or remove these SDKs or components. Additionally, some third-party SDKs might send data to the Chinese mainland. You can remove these components as needed.
Multi-language adaptation
Language support
English
Starting with baseline 10.2.3.64, the mPaaS iOS SDK fully supports English. To use this feature, you must upgrade your baseline to 10.2.3.64 or a later version. If you use the new mini program container, you must upgrade the baseline to version 10.2.3, cp_change_15200851.55, or a later version.
Baseline 10.2.3 is recommended for the new mini program container.
French and Russian
To support French or Russian, join the DingTalk group (ID: 145930007362) or submit a ticket to contact mPaaS technical support. After you obtain the language packages, check the translations and add the files to the Languages.bundle file in your project.
Language settings
Follow the system language by default
Add the Languages.bundle.zip file to your project to specify the languages that your app supports.
Initialize the multi-language framework on application startup.
//#import <mPaas/APLanguage.h> [APLanguageSetting sharedSetting];
Get the current app language
You can use the following code to retrieve the current language of the app.
NSString *currentLanguage = [APLanguageSetting currentLanguage].name;Change the current app language
The
Languages.bundlefile in your project lists the languages that your app supports. You can use the following code to change the current language of the app.[APLanguageSetting setCurrentLanguageWithName:@"en"];If you have integrated offline packages or mini program components, add the
Language/envalue to theuserAgentwhen you initialize the container.[MPNebulaAdapterInterface shareInstance].nebulaUserAgent = @"mPaaS/Portal Language/en";Enable the default error page for offline packages or mini programs by setting
h5_mpaas_error_pagetotrue.For more information, see Notes on mini program integration.
- (NSDictionary *)nebulaCustomConfig { return @{@"h5_mpaas_error_page":@"YES"}; }
Check integrated components
AutoNavi Location & Map
Some versions of the AutoNavi Location and Map SDK may cause your app to be rejected by the App Store. Check whether your application integrates `mPaaS_AMap`. If it does, you must manually remove the dependency.
Remove the AutoNavi SDK dependency
Install the cocoapods-mPaaS plugin.
sh <(curl -s http://mpaas-ios.oss-cn-hangzhou.aliyuncs.com/cocoapods/installmPaaSCocoaPodsPlugin.sh)Run the following command to update the local baseline:
pod mpaas update 10.2.3.Before you use the
mPaaS_podcommand, addremove_pod "mPaaS_AMap"to your Podfile.After you remove the AutoNavi component, run the
pod installcommand to pull the dependencies again.
Hotpatching
The App Store prohibits apps from dynamically distributing executable code. Integrating the hotpatching component might put your app at risk of rejection. Do not integrate the hotpatching component.
Third-party SDK data transmission
Third-party SDKs included in the mPaaS SDK may send requests to servers in the Chinese mainland. If you do not want your app to send data to the Chinese mainland, make sure that your app does not include the following components:
Share: mPaaS_Share
Youku Player: mPaaS_TinyApp_Player
Delete the corresponding mPaaS component names from your Podfile.