I'm working on a app that is 2 languages namely english and Arabic. I've written the app in english and then localized the app in Arabic. The App needs to restart when changing the Language. My only question is that how can I set the default language to arabic when installing the app for the first time.I've Tried setting the Language to arabic in Edit schemes section, But it only works for the development build not for the Distribution builds. It may be duplicate question but I've tried and not succeeded.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
For change language "on the fly" you can use L10n-swift pod.
But to rtl you need set semanticContentAttribute appearance for UIView
let isRTL = Locale.characterDirection(forLanguage: yourLanguageIdentifier) == .rightToLeft
UIView.appearance().semanticContentAttribute = isRTL
? .forceRightToLeft
: .forceLeftToRight
回答2:
According to the documentation, this is basically what happens:
1) iOS will search your app for the preferred languages it has on the Settings. So if your device is set to Arabic, it should go for Arabic laguage first.
2) If no languages are found, iOS will turn to the language of the app's development region, so you should set it also.
Here you can find more information on how to set your app's development region (CFBundleDevelopmentRegion) on Plist file.