/** * Of the whole program, this method is probably the trickiest. * * This method creates the natural language description, such as * "At 1:00am, every Sun". * * First, I declare some strings for holding what can be internationalized. * Note the tokens such as "MONTHS". Translators should reuse these * tokens in their translations. See README.translators for more * information. * * Second, I get the descriptions from the component parts such as * days of the month. * * Third, I get hour/minute time combinations. Although a little bit * awkward, I use the tm struct and strftime from <time.h>. This * way this code is portable across all Unixes. * * Fourth, I know that "every day of the week" and "every day of the * month" simply makes "every day". * * Fifth and finally I do tag substitution to create the natural language * description. * */ QString CTTask::describe() const { if (reboot) { return i18n("At system startup"); } QString dateFormat = createDateFormat(); QString timeFormat = createTimeFormat(); return i18nc("1:Time Description, 2:Date Description", "%1, %2", timeFormat, dateFormat); }
/** * Of the whole program, this method is probably the trickiest. * * This method creates the natural language description, such as * "At 1:00am, every Sun". * * First, I declare some strings for holding what can be internationalized. * Note the tokens such as "MONTHS". Translators should reuse these * tokens in their translations. See README.translators for more * information. * * Second, I get the descriptions from the component parts such as * days of the month. * * Third, I get hour/minute time combinations. Although a little bit * awkward, I use the tm struct and strftime from <time.h>. This * way this code is portable across all Unixes. * * Fourth, I know that "every day of the week" and "every day of the * month" simply makes "every day". * * Fifth and finally I do tag substitution to create the natural language * description. * */ QString CTTask::describe() const { if (reboot) { return QObject::tr("At system startup"); } QString dateFormat = createDateFormat(); QString timeFormat = createTimeFormat(); return QObject::tr("%1, %2", "1:Time Description, 2:Date Description").arg(timeFormat).arg(dateFormat); }