iOS How to restart app for changing language Swift 4

前端 未结 2 1385
生来不讨喜
生来不讨喜 2021-01-16 07:49

I work with multi language app, i want to change language manually in profile user.

I already have Localization.string

And if i change device language, langu

2条回答
  •  孤街浪徒
    2021-01-16 08:17

    in my recent app I used this localize , its simple and with out closing app we can switch the app based on the language .

    add the localize.swift file to your project and finally call the following func where you need

    if let pre = Bundle.main.preferredLocalizations.first, !pre.isEmpty  {
                if pre == Language.english.rawValue{
                    Language.language = Language.arabic
                }else{
                     Language.language = Language.english
                }
    
            }
    

提交回复
热议问题