core: move formatting of day-of-week to string-format.cpp

This was only used by the filter, but will also be used
by the statistics module. To avoid duplicate translation
strings, move to a common place.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-01 12:49:50 +01:00 committed by bstoeger
parent b0b52d51bd
commit e23d103c5d
3 changed files with 22 additions and 11 deletions

View file

@ -257,3 +257,19 @@ QString formatDiveDateTime(const dive *d)
return QStringLiteral("%1 %2").arg(localTime.date().toString(prefs.date_format_short),
localTime.time().toString(prefs.time_format));
}
QString formatDayOfWeek(int day)
{
// I can't wrap my head around the fact that Sunday is the
// first day of the week, but that's how it is.
switch (day) {
default:
case 0: return gettextFromC::tr("Sunday");
case 1: return gettextFromC::tr("Monday");
case 2: return gettextFromC::tr("Tuesday");
case 3: return gettextFromC::tr("Wednesday");
case 4: return gettextFromC::tr("Thursday");
case 5: return gettextFromC::tr("Friday");
case 6: return gettextFromC::tr("Saturday");
}
}