全部產品
Search
文件中心

SuperApp:多語言使用配置說明

更新時間:Apr 03, 2026

本文介紹了如何配置自訂語言

1.1. 背景介紹

SuperApp SDK 預設提供 英文/中文簡體/中文繁體 三種文字,同時可以支援客戶自訂其他語言文字。

1.2. 自訂配置方法

SuperApp SDK用到的文字表如下:

 /*
  Localizable.strings
*/
// Basic
"WV_OK" = "OK";
"WV_Cancel" = "Cancel";

// Refresh
"WV_PageLoading" = "Loading";
"WV_PullToRefresh" = "pull to refresh";
"WV_ReleaseToRefresh" = "release to refresh";
"WV_PullToRefresh_Loading" = "Loading...";

// Save pickture
"WV_AskSaveImage" = "Save picture?";
"WV_SaveImage" = "Save";
"WV_SaveImageSuccess" = "Success to save picture";
"WV_SaveImageFailed" = "Failed to save picture";

// Take pictures
"WV_ChoosePhotoSource" = "Please select picture source";
"WV_ChooseCamera" = "Take pictures";
"WV_ChooseVideoCamera" = "Take video";
"WV_ChoosePhotoLibrary" = "Select from album";
"WV_ChoosePhotoFromLibrary" = "Select picture";
"WV_ChoosePhotoLimit" = "Select %lu photos at most";
"WV_ChoosePhotoLimit_Confirm" = "Confirm";
"WV_ChooseVideoSource" = "Please select video source";
"WV_AddMorePhotos" = "Add more accessible photos";
"WV_AccessAllPhotos" = "Allow %@ to access your all photos";
"WV_PermissionSetting" = "Enable the following permissions for the app in your system settings";
"WV_LeavePage" = "Leave this page?";
"WV_PromptDefaultContent" = "Please enter a value";
"WV_AlertTitleTips" = "Tips";

// Error Message
"WV_ErrorNoNetwork" = "Unable to connect to the network";
"WV_ErrorSSLError" = "SSL connection error";
"WV_ErrorDownloadFailed" = "Download failed";
"WV_ErrorLoadFailed" = "Load failed";

//accessibility
"mini_app_ok" = "OK";
"mini_app_no" = "NO";
"mini_app_about_us" = "About Us";
"mini_app_cancel" = "Cancel";
"mini_app_name" = "App Name";
"mini_app_slogan" = "Slogan";
"mini_app_desc" = "Description";
"mini_app_add_favorite" = "Add to My Favorites";
"mini_app_remove_favorite" = "Remove from My Favorites";
"mini_app_favorite_desc" = "Do you want to add this mini app to my favorites?";
"mini_app_generate_qr_code" = "Generate QR code";
"mini_app_authorize_user_desc" = "Apply to obtain your following information to provide services.";
"mini_app_permission_tip" = "Please authorize location access for us in mobile settings and try again.";

//accessibility
"mini_app_accessibility_back_btn" = "Back Button";
"mini_app_accessibility_more_btn" = "More Button";
"mini_app_accessibility_close_btn" = "Close Button";
"mini_app_accessibility_favorite_add_btn" = "Add Favorites Button";
"mini_app_accessibility_favorite_remove_btn" = "Remove Favorites Button";
"mini_app_accessibility_generate_qr_code_btn" = "Generate QR code Button";
"mini_app_accessibility_about_btn" = "About Button";
"mini_app_accessibility_cancel_btn" = "Cancel Button";
"mini_app_accessibility_ok_btn" = "OK Button";
"mini_app_accessibility_no_btn" = "NO Button";

//date picker
"select_date"="Select Date";
"select_year" = "";
"select_day" = "";
"JAN"="Jan";
"FEB"="Feb";
"MAR"="Mar";
"APR"="Apr";
"MAY"="May";
"JUN"="Jun";
"JUL"="Jul";
"AUG"="Aug";
"SEP"="Sep";
"OCT"="Oct";
"NOV"="Nov";
"DEC"="Dec";

//error page information
"miniapp_loading_error_title" = "Loading failed";
"miniapp_loading_error_info" = "Miniapp failed to load";
"miniapp_loading_error_noNetwork_info" = "Network error";
"miniapp_toke_offline_info" = "Miniapp not found";
"miniapp_unable_open_info" = "Unable to open this page";
"miniapp_page_not_found_info" = "Page not found";
"miniapp_error_code_tip" = "Error Code";

"miniapp_error_exit_btn_title" = "Exit";
"miniapp_error_refresh_btn_title" = "Refresh";

"miniapp_add_favorite_title" = "Add to \"My Favorites\"";
"miniapp_add_favorite_info" = "Would you like to add this miniapp to \"My Favorites\" for quick access?";

// auth
"miniapp_auth_apply_tip" = "Apply To";
"miniapp_auth_reject" = "Reject";
"miniapp_auth_allow" = "Allow";
"miniapp_location_tip" = "Access your location information";
"miniapp_camera_tip" = "Access your camera information";
"miniapp_album_tip" = "Access your photo album information";
"miniapp_bluetooth_tip" = "Access your bluetooth information";
"miniapp_microphone_tip" = "Access your microphone information";
"miniapp_contacts_tip" = "Access your contact list information";
"miniapp_file_tip" = "Access your file information";
"miniapp_call_tip" = "Access your call information";
"miniapp_vibrate_tip" = "Access your device vibration information";
"miniapp_screen_tip" = "Access your screen information";

"miniapp_location" = "Location";
"miniapp_camera" = "Camera";
"miniapp_album" = "Album";
"miniapp_bluetooth" = "Bluetooth";
"miniapp_microphone" = "Microphone";
"miniapp_contacts" = "Contacts";
"miniapp_file" = "Files";
"miniapp_call" = "Calls";
"miniapp_vibrate" = "Vibration";
"miniapp_screen" = "Screen";

"miniapp_auth_tip" = "Access the following information";

"miniapp_location_desc" = "This miniapp will access your location to provide address recommendations and localized services";
"miniapp_camera_desc" = "This miniapp will access your camera for taking photos or scanning QR codes";
"miniapp_album_desc" = "This miniapp will access your photo album to select and upload images for sharing or editing";
"miniapp_bluetooth_desc" = "This miniapp will access bluetooth to connect to smart devices and enable data interaction";
"miniapp_microphone_desc" = "This miniapp will access your microphone for voice input and voice-based features";
"miniapp_contacts_desc" = "This miniapp will access your contacts to quickly find contacts or invite friends";
"miniapp_file_desc" = "This miniapp will access files to read and manage documents or resource files required by the application";
"miniapp_call_desc" = "This miniapp will access call logs to identify incoming calls or enhance communication-related features";
"miniapp_vibrate_desc" = "This miniapp will access device vibration controls to provide tactile feedback and enhance operational experience";
"miniapp_screen_desc" = "This miniapp will access screen information to adapt interface display, support screenshot and screen recording features, and improve user interaction";



//more page show information
"miniapp_more_add_favorite_info" = "Add to my favorites";
"miniapp_more_remove_favorite_info" = "Remove from my favorites";
"miniapp_more_settings_info" = "Settings";
"miniapp_more_copy_link_info" = "Copy link";
"miniapp_more_share_url_info" = "Share";
"miniapp_more_refresh_info" = "Refresh";
"miniapp_more_about_us_info" = "About Us";
"miniapp_more_copy_success" = "Copied";
"miniapp_more_share_success" = "Share Successful";


"miniapp_more_favorite_success" = "Added to my favorites";
"miniapp_more_remove_favorite_success" = "Removed from my favorites";

"miniapp_about_us_miniapp_name_descrip"= "Miniapp name";
"miniapp_about_us_slogan_descrip" = "Slogan";
"miniapp_about_us_miniapp_version_descrip"= "Version number";
"miniapp_about_us_miniapp_descrip"= "Description";

//setting page
"miniapp_settings_title" = "Settings";
"miniapp_settings_allow_tip" = "Allow \"%@\" to access the following information";

以越南語為例:

  1. 在宿主app下添加語言bundle

  2. 將上述Localizable.strings中字串譯為越南語

  3. 注意不能有缺失

  4. 手機切換語言為越南語

  5. 在容器初始化後調用語言bundle的配置方法

image

注意事項

  • 語言需要跟隨手機切換語言展示,在專案中配置:選擇PROJECT->Localizations中添加對應語言

image.png

image

image

配置樣本

let miniAppInitConfig = EMASMiniAppInitConfig()
miniAppInitConfig.uiConfig = uiConfig
miniAppInitConfig.useUniApp = true
miniAppInitConfig.useWindVane = true
miniAppInitConfig.accessKey = "your access key"
miniAppInitConfig.secretKey = "your secret key"
miniAppInitConfig.host = "your Host"
miniAppInitConfig.appCode = "your App Code"
miniAppInitConfig.openLog = true
miniAppInitConfig.needAuthFromApp = true
let miniAppService = EMASMiniAppServiceImpl();
miniAppService.initialize(miniAppInitConfig)
EMASServiceManager.sharedInstance().registerServiceProtocol("EMASMiniAppService", impClass: "EMASMiniAppServiceImpl", target: miniAppService)
//配置多語言bundle
if let bundlePath = Bundle.main.path(forResource: "SALanguage", ofType: "bundle"),let bundle = Bundle(path: bundlePath) {
    SAMiniAppUserConfig.localized(with: bundle)
}
//支援app內語言切換
EMASMiniAppPortal.share().setAppLanguage("vi")