Change app language in iOS without restarting the app

后端 未结 6 809
时光取名叫无心
时光取名叫无心 2020-12-08 07:33

I have seems some apps can change the language internally within the app without the need of restarting the app, I am wondering how they are implemented.

For example

6条回答
  •  忘掉有多难
    2020-12-08 08:01

    the idea is to write a new macro like NSLocalizedString which should check if to take the translation from another specific bundle or not.

    The method 2 in this article explain exactly how to do it. In this particular case, the author doesn't use a new macro, but directly set a custom class for [NSBundle mainBundle].

    I hope that @holex will understand the problem reading this.

提交回复
热议问题