Swift : How to change language inside app?

前端 未结 6 1647
忘了有多久
忘了有多久 2020-12-31 19:31

i am using Localize-Swift library (Link) to localize my application and it works fine with .strings files. the problem is that i have to localize to a language

6条回答
  •  清歌不尽
    2020-12-31 20:04

    found my answer :

    NSUserDefaults.standardUserDefaults().setObject(["language identifier"], forKey: "AppleLanguages") 
    NSUserDefaults.standardUserDefaults().synchronize()
    

    unfortunately user must restart the app! if anyone could find a solution to not restart the application please inform me.

提交回复
热议问题