This project is read-only.

Is calendar control localizable?

Apr 28, 2014 at 12:52 PM
I need to display the calendar control in English, French, German, and Italian. I set the language in App constructor, let's say:

Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = "de-de";

The day abbreviations are localized, but the month's names stay in English and the first day of the week is also always Sunday. Will this be changed or is there a way I can do it myself (via styles, etc.)? I know how to do the first day, but not sure how to do the month names.

Ivan
Sep 21, 2014 at 10:57 PM
No idea, sorry. I don't know if this was supported in the original Silverlight Toolkit version and got lost in translation or if it is something you'd need to modify the control to achieve. Feel free to take a stab at the control's code.
Sep 22, 2014 at 8:30 AM
I think the problem is in DateTimeHelper.GetCurrentDateFormat(). It checks if the current culture uses a Gregorian Calendar, but the thing is the comparison CultureInfo.CurrentCulture.Calendar == new CultureInfo("en-US").Calendar fails even when CurrentCulture is en-US (tested with Windows Store App and WPF application) and it always falls back to the end of the method, invariant culture DateTime format and a calendar from en-US culture. So AbbreviatedMonthNames are always in English.
Sep 22, 2014 at 10:37 AM
I found a code in MSDN with a special comparison of calendars:

http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo(v=vs.110).aspx

To compare if the calendars are identical they do the following:
           if (prop.Name == "Calendar") { 
              // The cultures have a different calendar type. 
              if (specificValue.ToString() != neutralValue.ToString()) {
                 Console.WriteLine("   Different calendar types for {0} and {1}", name, ci.Name);
                 match = false;
                 break;
              }

              if (specificValue is GregorianCalendar) {
                 if (((GregorianCalendar) specificValue).CalendarType != ((GregorianCalendar) neutralValue).CalendarType) {
                    Console.WriteLine("   Different Gregorian calendar types for {0} and {1}", name, ci.Name);
                    match = false;
                    break;
                 }
              }
           }
GregorianCalendar is not exported for Windows Store Apps and using reflection throws an exception, so all one can probably do is to check if the Calendar type name is "GregorianCalendar" and leave it at that.