Setting “AppleLanguages” doesn't change app language

前端 未结 7 1869
无人及你
无人及你 2020-12-01 19:29

I am trying to implement a function that can change app language.
I tried to set it like this:

let defaults = NSUserDefaults.standardUserDefaults()
defa         


        
7条回答
  •  星月不相逢
    2020-12-01 19:54

    If mean for test purpose, just change the language in simulator settings app.
    If you are trying to make a sort of language selector in your app, it' pretty painful and in my opinion you should not.
    Your app reads language and locale settings from the device and change the UI accordingly.
    Override this behavior is tough and you will never accomplish a full change in language, for instance if you try to display a map in you app and your device language is Spanish, but the app language is english, you will see the map indications written in Spanish.
    Here a project that could help.

提交回复
热议问题