简体   繁体   中英

MVVMCROSS Changing Language in iOS

I'm trying to implement a multilanguage support with mvvmcross in iOS. The "languages" are stored in a .resx file in the core (Portable Library Class).

So on the android side it works great......I have just to call the recreathe() -Method to rebuild the views.

Is there some similiar method I can call in iOS or in the MVVMCROSS-Library? I experimented a lot with several methods, but without any success.

I know how to make it manually:

  • Remove all Subviews
  • Create new instances for each removed subview
  • Do the bindings again
  • Add the views back to subviews

But honestly this just can't be the way it goes. Has anyone a much more sleek suggestion?

if your views use binding (like I described here ) to display the localized version of the string values, the only thing you need to do is to call RaisePropertyChanged(string.empty) or RaiseAllPropertiesChanged() on the view-models

When user changes the language, you could broadcast a message (using MvmCross messenger) which all the language aware view-models listen to, and on handling this message have the view-models can then call RaisePropertyChanged(string.empty) or RaiseAllPropertiesChanged() on the view-models

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM