Fixed issue with calendar in IDE

This commit is contained in:
Rick Falkvinge
2015-03-23 04:03:09 +01:00
parent 6edba9c675
commit 495ae9bb05
+14 -4
View File
@@ -49,13 +49,12 @@ public class CommonV5
}*/
}
GregorianCalendar normalizedCalendar = new GregorianCalendar();
normalizedCalendar.CalendarType = GregorianCalendarTypes.USEnglish; // avoids problems with Arabic, etc, calendars and bookkeeping in localization
try
{
GregorianCalendar normalizedCalendar = new GregorianCalendar();
normalizedCalendar.CalendarType = GregorianCalendarTypes.USEnglish; // avoids problems with Arabic, etc, calendars and bookkeeping in localization
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(preferredCulture);
Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar = normalizedCalendar;
}
catch (Exception) // if we can't set the culture, what do we do? ("We send the Marines.")
{
@@ -64,6 +63,17 @@ public class CommonV5
// Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
}
// Set the calendar to GregorianCalendar.USEnglish. This sometimes fails on Windows but works on Mono. If it fails on Windows, no biggie b/c
// this is supposed to be the default anyway.
try
{
Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar = normalizedCalendar;
}
catch (Exception)
{
// meh
}
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
}