Improved RegEx construction to account for empty 13th month name. Excluded testing for Upper Sorbian (hsb) culture on Windows 8 and later.

This commit is contained in:
Daniel Stolt
2014-07-26 01:07:33 +02:00
parent 5bee0705c2
commit a80240b9f1
2 changed files with 6 additions and 2 deletions

View File

@@ -52,6 +52,10 @@ namespace Orchard.Framework.Tests.Localization {
IDateFormatter target = new DefaultDateFormatter();
var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
foreach (CultureInfo cultureInfo in cultures) {
// Due to a bug in .NET 4.5 in combination with updated Upper Sorbian culture in Windows 8.
if (System.Environment.OSVersion.Version.ToString().CompareTo("6.2.0.0") >= 0 && cultureInfo.Name.StartsWith("hsb")) {
continue;
}
DateTime dateTime = new DateTime(2014, 12, 31, 10, 20, 40, 567);
cultureInfo.DateTimeFormat.Calendar = new GregorianCalendar();
var dateString = dateTime.ToString("G", cultureInfo);

View File

@@ -97,8 +97,8 @@ namespace Orchard.Framework.Localization.Services {
{"ddd", String.Format("(?<day>{0})", String.Join("|", culture.DateTimeFormat.AbbreviatedDayNames))},
{"dd", "(?<day>[0-9]{2})"},
{"d", "(?<day>[0-9]{1,2})"},
{"MMMM", String.Format("(?<month>{0})", String.Join("|", culture.DateTimeFormat.MonthNames))},
{"MMM", String.Format("(?<month>{0})", String.Join("|", culture.DateTimeFormat.AbbreviatedMonthNames))},
{"MMMM", String.Format("(?<month>{0})", String.Join("|", culture.DateTimeFormat.MonthNames.Where(x => !String.IsNullOrEmpty(x))))},
{"MMM", String.Format("(?<month>{0})", String.Join("|", culture.DateTimeFormat.AbbreviatedMonthNames.Where(x => !String.IsNullOrEmpty(x))))},
{"MM", "(?<month>[0-9]{2})"},
{"M", "(?<month>[0-9]{1,2})"},
{"yyyyy", "(?<year>[0-9]{5})"},