I am using the XamDateTimeEditor and running the application on a Simplified Chinese machine. The problem is when the calendar is presented to the user the month at the top of the calendar, i.e. April, and the label "Today" at the bottom of the calendar are in English. I have installed the Language Packs for 3.5 and things such as the WPF ApplicationCommands.Copy and ApplicationCommands.Cut are localized. Is there something I am missing in order to have the month and "Today" label localized?
Thanks for any assistance.
Thank you for pointing me to the right direction.I solved with this row:
editor.FormatProvider = Thread.CurrentThread.CurrentCulture;
since Format property has no effect while you're in edit mode. Thanks for your assistance, bye Maria
Hello Maria,
You set XamDateTimeEditor's Format Property to a static value like this:
xamDateTimeEditor1.Format = "dd/MM/yyyy";
or you can set it to the machine format like this:
xamDateTimeEditor1.Format = Thread.CurrentThread.CurrentUICulture.DateTimeFormat.ShortDatePattern;
Hope this helps you.
Stefan,step by step, we are finally coming to a solution! :)
I've modified my code, in order to apply your last suggestion:
dte.Language = XmlLanguage.GetLanguage(sLangCode); Infragistics.Windows.Editors.Resources.Customizer.SetCustomizedString("TodayButtonCaption", sToday + ": {0:" + Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern+ "}");
Now a little sample with these two lines of code.With a combo, the user can select the language of the application. When a language is selected, the application loads, showing all the strings in the choosen language, and using the current Regional Options to display date and time values.Here you can see, respectively, English, Italian and French selections (the current date is yesterday, 11th december 2012, and Regional Options are Italian):
Everything is ok, except for the date that is being shown on English calendar. This reveals that the field is not using Regional Options that are currently active. Probably, because when I set calendar's Language property, all locale's settings are modified and not only the labels' translation.
Anyway, thanks a lot for your help so far!Bye, Maria
Hello,
You can use the following code in order to use the Regional Options:
CultureInfo ci = (CultureInfo)Thread.CurrentThread.CurrentUICulture.Clone(); ci.DateTimeFormat.SetAllDateTimePatterns(new string[] { "dd/MM/yyyy" }, 'd'); Thread.CurrentThread.CurrentUICulture = ci; Thread.CurrentThread.CurrentCulture = ci; Infragistics.Windows.Editors.Resources.Customizer.SetCustomizedString("TodayButtonCaption", "Oggi: {0:" + Thread.CurrentThread.CurrentUICulture.DateTimeFormat.ShortDatePattern + "}");
If your ShortDateFomat is already set to dd/MM/yyyy you can skip the first 4 lines.
Thank you,but I would like date format to follow Regional Options settings, both in calendar and today fields.For details, see my post above.
Have a nice day!