// Localise a comma-separated days string. I don't think this is the right way to do it. Really
        // the data structures should keep the days as an array of bools or list of ints or something and
        // only translate on input and output, but that would require too much rewriting now. (CA-51612)
        public static string L10NDays(string days, DaysMode mode)
        {
            DaysWeekCheckboxes dwc = new DaysWeekCheckboxes();

            dwc.Days = days;
            return(dwc.DaysToString(mode));
        }
Exemple #2
0
 private string DaysToString(DaysMode mode)
 {
     var sb = new StringBuilder();
     if (checkBoxMonday.Checked)
         sb.Append((mode == DaysMode.ENGLISH ? "Monday" : mode == DaysMode.L10N_LONG ? Messages.MONDAY_LONG : Messages.MONDAY_SHORT) + ",");
     if (checkBoxTuesday.Checked)
         sb.Append((mode == DaysMode.ENGLISH ? "Tuesday" : mode == DaysMode.L10N_LONG ? Messages.TUESDAY_LONG : Messages.TUESDAY_SHORT) + ",");
     if (checkBoxWednesday.Checked)
         sb.Append((mode == DaysMode.ENGLISH ? "Wednesday" : mode == DaysMode.L10N_LONG ? Messages.WEDNESDAY_LONG : Messages.WEDNESDAY_SHORT) + ",");
     if (checkBoxThursday.Checked)
         sb.Append((mode == DaysMode.ENGLISH ? "Thursday" : mode == DaysMode.L10N_LONG ? Messages.THURSDAY_LONG : Messages.THURSDAY_SHORT) + ",");
     if (checkBoxFriday.Checked)
         sb.Append((mode == DaysMode.ENGLISH ? "Friday" : mode == DaysMode.L10N_LONG ? Messages.FRIDAY_LONG : Messages.FRIDAY_SHORT) + ",");
     if (checkBoxSaturday.Checked)
         sb.Append((mode == DaysMode.ENGLISH ? "Saturday" : mode == DaysMode.L10N_LONG ? Messages.SATURDAY_LONG : Messages.SATURDAY_SHORT) + ",");
     if (checkBoxSunday.Checked)
         sb.Append((mode == DaysMode.ENGLISH ? "Sunday" : mode == DaysMode.L10N_LONG ? Messages.SUNDAY_LONG : Messages.SUNDAY_SHORT) + ",");
     if (sb.Length > 0)
         sb.Remove(sb.Length - 1, 1);
     return sb.ToString();
 }
        private string DaysToString(DaysMode mode)
        {
            var sb = new StringBuilder();

            if (checkBoxMonday.Checked)
            {
                sb.Append((mode == DaysMode.ENGLISH ? "Monday" : mode == DaysMode.L10N_LONG ? Messages.MONDAY_LONG : Messages.MONDAY_SHORT) + ",");
            }
            if (checkBoxTuesday.Checked)
            {
                sb.Append((mode == DaysMode.ENGLISH ? "Tuesday" : mode == DaysMode.L10N_LONG ? Messages.TUESDAY_LONG : Messages.TUESDAY_SHORT) + ",");
            }
            if (checkBoxWednesday.Checked)
            {
                sb.Append((mode == DaysMode.ENGLISH ? "Wednesday" : mode == DaysMode.L10N_LONG ? Messages.WEDNESDAY_LONG : Messages.WEDNESDAY_SHORT) + ",");
            }
            if (checkBoxThursday.Checked)
            {
                sb.Append((mode == DaysMode.ENGLISH ? "Thursday" : mode == DaysMode.L10N_LONG ? Messages.THURSDAY_LONG : Messages.THURSDAY_SHORT) + ",");
            }
            if (checkBoxFriday.Checked)
            {
                sb.Append((mode == DaysMode.ENGLISH ? "Friday" : mode == DaysMode.L10N_LONG ? Messages.FRIDAY_LONG : Messages.FRIDAY_SHORT) + ",");
            }
            if (checkBoxSaturday.Checked)
            {
                sb.Append((mode == DaysMode.ENGLISH ? "Saturday" : mode == DaysMode.L10N_LONG ? Messages.SATURDAY_LONG : Messages.SATURDAY_SHORT) + ",");
            }
            if (checkBoxSunday.Checked)
            {
                sb.Append((mode == DaysMode.ENGLISH ? "Sunday" : mode == DaysMode.L10N_LONG ? Messages.SUNDAY_LONG : Messages.SUNDAY_SHORT) + ",");
            }
            if (sb.Length > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            return(sb.ToString());
        }
Exemple #4
0
 // Localise a comma-separated days string. I don't think this is the right way to do it. Really
 // the data structures should keep the days as an array of bools or list of ints or something and
 // only translate on input and output, but that would require too much rewriting now. (CA-51612)
 public static string L10NDays(string days, DaysMode mode)
 {
     DaysWeekCheckboxes dwc = new DaysWeekCheckboxes();
     dwc.Days = days;
     return dwc.DaysToString(mode);
 }