In my silverlight 4 MVVM application, i can switch languages during runtime :
public void SetLanguage(string language)
{
var culture = new CultureInfo(language);
Thread.CurrentThread.CurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
// ...
}
For the inputs, i just added "ValidatesOnException=true" in case of conversion problems and it does the job. But the default exception message is in the culture of my OS and not in the manually chosen one.
In this thread on exception message localization the idea is to change CurrentCulture and CurrentUICulture, which i did. So i'm kind of stuck.
What can i do ?
Thanks :)
Edit : i tried to use a custom converter with a custom exception in the convertback method in order to validate the user's input. Problem, an exception within a convertback method is NOT caught by the validatesOnException, it breaks the application.
Edit 2 : to clarify -> if i have a decimal property bound to a textbox, and i enter "blabla" in this textbox, i want to see that there is a problem, and i want the message to be in the runtime locale and not the OS locale. I can't raise an exception in my property setter because i never get there, the default converter raises its own exception before that.
I hope it's clear. If i can help you to help me, please don't hesitate :)