private static string GetWeekdayHumanText(IList <DayOfWeek> daysOfWeek, string separator = ", ", string lastSeparator = " and ", WeekdayHumanTextOptions options = WeekdayHumanTextOptions.None) { if (options.HasFlag(WeekdayHumanTextOptions.AbbrWeekdays) && IsWeekday(daysOfWeek)) { if (options.HasFlag(WeekdayHumanTextOptions.Plural)) { return("weekdays"); } return("weekday"); } if (options.HasFlag(WeekdayHumanTextOptions.AbbrDays) && IsFullWeek(daysOfWeek)) { if (options.HasFlag(WeekdayHumanTextOptions.Plural)) { return("days"); } return("day"); } if (options.HasFlag(WeekdayHumanTextOptions.AbbrWeekendDays) && IsWeekendDay(daysOfWeek)) { if (options.HasFlag(WeekdayHumanTextOptions.Plural)) { return("weekend days"); } return("weekend day"); } return(ListToHumanText(EnglishCultureInfo, daysOfWeek, separator, lastSeparator)); }
private static string GetWeekdayHumanText(ICollection <DayOfWeek> daysOfWeek, string separator = ", ", string lastSeparator = " et ", WeekdayHumanTextOptions options = WeekdayHumanTextOptions.None) { if (options.HasFlag(WeekdayHumanTextOptions.AbbrWeekdays) && IsWeekday(daysOfWeek)) { if (options.HasFlag(WeekdayHumanTextOptions.Plural)) { return("jours de semaine"); } return("jour de semaine"); } if (options.HasFlag(WeekdayHumanTextOptions.AbbrDays) && IsFullWeek(daysOfWeek)) { if (options.HasFlag(WeekdayHumanTextOptions.Plural)) { return("jours"); } return("jour"); } if (options.HasFlag(WeekdayHumanTextOptions.AbbrWeekendDays) && IsWeekendDay(daysOfWeek)) { if (options.HasFlag(WeekdayHumanTextOptions.Plural)) { return("jours de weekend"); } return("jour de weekend"); } return(ListToHumanText(FrenchCultureInfo, daysOfWeek.Select(DayOfWeekToString).ToList(), separator, lastSeparator)); }