iOS How to restart app for changing language Swift 4

前端 未结 2 1383
生来不讨喜
生来不讨喜 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:13

    You can't restart the app after language selection as the apple doesn't allows this.Instead, one thing you can do is modify the localization solution you have implemented to change app language without restarting it.

    Follow this link for more details: manual language selection in an iOS-App (iPhone and iPad)

    0 讨论(0)
  • 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
                }
    
            }
    
    0 讨论(0)
提交回复
热议问题