mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
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:
commit
f71bea09b3
@ -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>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user