aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/repeatrule.cpp7
-rw-r--r--src/repeatrule.h8
2 files changed, 10 insertions, 5 deletions
diff --git a/src/repeatrule.cpp b/src/repeatrule.cpp
index b9b9539..95a0ec3 100644
--- a/src/repeatrule.cpp
+++ b/src/repeatrule.cpp
@@ -18,7 +18,6 @@
#include "repeatrule.h"
-#include <QCoreApplication>
#include <QLocale>
#include <QMap>
@@ -58,13 +57,11 @@ const char *const kOrdinals[] = {
QT_TRANSLATE_NOOP("RepeatRule", "fourth"),
};
-QString tr(const char *text) { return QCoreApplication::translate("RepeatRule", text); }
-
QString ordinalWord(int ordinal)
{
if (ordinal == -1)
- return tr("last");
- return (ordinal >= 1 && ordinal <= 4) ? tr(kOrdinals[ordinal - 1]) : QString();
+ return RepeatRule::tr("last");
+ return (ordinal >= 1 && ordinal <= 4) ? RepeatRule::tr(kOrdinals[ordinal - 1]) : QString();
}
} // namespace
diff --git a/src/repeatrule.h b/src/repeatrule.h
index 59dfceb..f686197 100644
--- a/src/repeatrule.h
+++ b/src/repeatrule.h
@@ -18,6 +18,7 @@
#pragma once
+#include <QCoreApplication>
#include <QDate>
#include <QList>
#include <QString>
@@ -29,6 +30,13 @@
/// is what lets every row of the spec's repeat table be tested as a string.
struct RepeatRule
{
+ // describe() formats the rule in words, and lupdate needs the class's own
+ // context to extract them (AGENTS.md: a class needs this macro, an array
+ // needs QT_TRANSLATE_NOOP on the literal). The macro ends in a private:
+ // section, so the explicit public: restores the fields below.
+ Q_DECLARE_TR_FUNCTIONS(RepeatRule)
+public:
+
enum class Freq { None, Daily, Weekly, Monthly, Yearly };
/// Monthly and Yearly only: on a day of the month, or on the Nth weekday.
enum class By { MonthDay, Weekday };