如何将默认语言设置为阿拉伯语iOS Swift? [英] How to set default language to Arabic ios swift?
问题描述
我正在开发一种使用2种语言(即英语和阿拉伯语)的应用程序.我已经用英语编写了该应用程序,然后将其本地化为阿拉伯语.更改语言时,应用程序需要重新启动.我唯一的问题是首次安装该应用程序时如何将默认语言设置为阿拉伯语.我在编辑方案"部分中尝试将语言设置为阿拉伯语,但它仅适用于开发版本,不适用于发行版本. .可能是重复的问题,但我尝试过但没有成功.
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.
推荐答案
For change language "on the fly" you can use L10n-swift pod.
但是要使用rtl,您需要为UIView设置语义内容属性外观
But to rtl you need set semanticContentAttribute appearance for UIView
let isRTL = Locale.characterDirection(forLanguage: yourLanguageIdentifier) == .rightToLeft
UIView.appearance().semanticContentAttribute = isRTL
? .forceRightToLeft
: .forceLeftToRight
这篇关于如何将默认语言设置为阿拉伯语iOS Swift?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!