Reputation: 85
I have a project that needs to have a toggle localization languages feature so users can change the language on runtime (application running) but I don't know how to implement it.
I can toggle the language in a normal way (after change, refresh by calling ViewDidLoad() again), it works for me but it has a risk because viewDidLoad() has so many task. If I refresh it too much it affects the performance.
ViewController - Action from button for change.
@IBAction func switchLanguages(_ sender: Any) {
LanguagesManager.doSwitch(vc: self)
viewDidLoad()
}
Upvotes: 0
Views: 590
Reputation: 138
Yes it is possible to change localization on runtime. You can use MCLocalization from github : https://github.com/Baglan/MCLocalization Just you need to know how to use objective-c library in Swift !
Upvotes: 1