Quick Links

Localization best practices

I'm porting my app to Xamarin.Forms.
'Till now I used MVVMCross (i18n) and I would like to use only Xamarin.Forms.

I read about Vernacular, maybe .resx files on the shared project...
I would like to have the ability to write something like: getString("Dog") and get the appropriate string according to current device locale.
Of course the idea is holding the resources strings in one place (maybe in the Shared Project or PCL)

What is the best way to do that?

0

Answers

Not sure if XAML custom markup support is there thus I'd consider using a static class that'd be accessed through {Static} binding if talking XAML. If binding/setting properties in code then use whatever mechanism you wish.
NOTE that you can build such a static file that holds all text as properties using a code generator (T4, CodeSmith, ...)

MihaMarkic, I'm looking for a clear example code, I didn't find any on the net. but Thanks for your response
StephaneDelcroix, first of all thank you.
It's kinda hard to understand how Vernacular works,
can you please provide a small example code which clarify how to use vernacular with Xamarin.Forms?
It'll be very helpful for us (vernacular newbies)