Merge pull request #966 from MihaelaStoica/CA-208808

CA-208808: The items of “Day of the week” drop-down list are not localized
This commit is contained in:
Stephen Turner 2016-04-27 14:26:21 +01:00
commit f71bea09b3
3 changed files with 20 additions and 2 deletions

View File

@ -502,6 +502,23 @@ namespace XenAdmin.Core
return dt.ToString(format, CultureInfo.InvariantCulture);
}
/// <summary>
/// Returns the full name of the specified DayOfWeek, making sure that the resultant string is localised if and only if necessary.
/// Localised means: in the language of the program (not in the language of the OS).
/// </summary>
public static string DayOfWeekToString(DayOfWeek dayOfWeek, bool localise)
{
if (localise)
{
Program.AssertOnEventThread();
// get the day of the week localized to culture of the current thread
return DateTimeFormatInfo.CurrentInfo.GetDayName(dayOfWeek);
}
else
return dayOfWeek.ToString();
}
/// <summary>
/// The expiry date of a host's license
/// </summary>

View File

@ -201,7 +201,8 @@ namespace XenAdmin.Dialogs.HealthCheck
var time = new DateTime(1900, 1, 1, healthCheckSettings.TimeOfDay, 0, 0);
return healthCheckSettings.Status == HealthCheckStatus.Enabled
? string.Format(Messages.HEALTHCHECK_SCHEDULE_DESCRIPTION, healthCheckSettings.IntervalInWeeks,
healthCheckSettings.DayOfWeek, HelpersGUI.DateTimeToString(time, Messages.DATEFORMAT_HM, true))
HelpersGUI.DayOfWeekToString(healthCheckSettings.DayOfWeek, true),
HelpersGUI.DateTimeToString(time, Messages.DATEFORMAT_HM, true))
: string.Empty;
}
}

View File

@ -94,7 +94,7 @@ namespace XenAdmin.Dialogs.HealthCheck
Dictionary<int, string> days = new Dictionary<int, string>();
foreach (var dayOfWeek in Enum.GetValues(typeof(DayOfWeek)))
{
days.Add((int)dayOfWeek, dayOfWeek.ToString());
days.Add((int)dayOfWeek, HelpersGUI.DayOfWeekToString((DayOfWeek)dayOfWeek, true));
}
return days;
}