summaryrefslogtreecommitdiffstats
path: root/core/string-format.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-01 12:49:50 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2021-01-01 21:10:10 +0100
commite23d103c5d3e54c6609526234f6591c055f78611 (patch)
tree4280e79ff79c819a5f1fcd8bc93845715c622088 /core/string-format.cpp
parentb0b52d51bdb093b7c2200d40ec41e2c3b0f2c830 (diff)
downloadsubsurface-e23d103c5d3e54c6609526234f6591c055f78611.tar.gz
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>
Diffstat (limited to 'core/string-format.cpp')
-rw-r--r--core/string-format.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/string-format.cpp b/core/string-format.cpp
index 5652a15bf..0ae4e6366 100644
--- a/core/string-format.cpp
+++ b/core/string-format.cpp
@@ -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");
+ }
+}