The question is, how can I translate system validation/binding errors to other languages? The details are as follow: I got this wpf application, which will be multilingual, and, for instance, has a grid bind to a collection of items, and one of the columns, DataLancamentoEdicao
in the example below, is a bound to a DateTime:
<DataGridTextColumn Header="Data" Binding="{Binding SomeDateTime, ValidatesOnDataErrors=True, Mode=TwoWay, StringFormat=d}" />
And the class is
public class SomeClass: INotifyPropertyChanged
{
public DateTime SomeDateTime {get {/*...*/}; set {/*...*/}}
}
If the users enters a valid date all is ok, but if the user enter, by mistake some garbage like "blablabla" the wpf reports, as expected, "Value 'blablabla' could not be converted", in some cases it reports String was not recognized as a valid DateTime. This DateTime is an example since there are others binding with decimals, integers that also suffer the same issue.
These are obviously good for an english person, but I need them to be translated to Portuguese as well as other languages available to the user on the login screen.
I've already set the culture of the thread and the language of the wpf as followed
Thread.CurrentThread.CurrentCulture = UserChoosenCulture;
Thread.CurrentThread.CurrentUICulture = UserChoosenCulture;
FrameworkElement.LanguageProperty.OverrideMetadata(
typeof(FrameworkElement),
new FrameworkPropertyMetadata(System.Windows.Markup.XmlLanguage.GetLanguage(UserChoosenCulture.IetfLanguageTag)));
How can I translate these strings? Are there some resources that I can override to achieve this goal?
Thank you.