4
votes

I'm using the MvvmCross Json Localisation plugin. Everything works well for View Model specific resource files using a TextSource property on the View Models.

I've added SharedTextSource and ErrorTextSource properties on the View Models however I can't find an example of how to use the Android MvxLang binding shortcut with these. I think it's something like:

local:MvxLang="Text Buy, Path=SharedTextSource"

However I get told "You cannot specify ConverterParameter more than once". Do I have to use the longhand binding for shared and error text sources?

Incidendally, MvvmCross is one of the best frameworks I've ever used.

1

1 Answers

5
votes

The parser for Lang bindings is in https://github.com/slodge/MvvmCross/blob/v3/Cirrious/Cirrious.MvvmCross.Binding/Parse/Binding/Lang/MvxLanguageBindingParser.cs

It parses 4 things for each Lang binding:

  • Key - the text lookup - used as parameter to the Converter
  • Source - defaults to "TextSource" - essentially this is used as the binding Path
  • Converter - the value converter used (defaults to "Language")
  • FallbackValue - the value to use for missing Source - useful for design time data

So for your binding, you can use

 lang:MvxLang="Text Buy, Source=SharedTextSource"