Skip to content

Commit 1222635

Browse files
committed
powerprofiles: Add profile names translation support
We have no control over the profile names returned by power-profiles-daemon. We have just added basic profile names as seen being used.
1 parent 67cd0cd commit 1222635

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/PowerProfiles.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
#include "PowerProfiles.h"
3434
#include "DBusPropAsyncGetter.h"
3535

36+
namespace {
37+
using Trans = struct { char const * const s1; char const * const s2; };
38+
[[maybe_unused]] void just_for_translations_dummy_function(const Trans = QT_TRANSLATE_NOOP3("LXQt::PowerProfiles", "power-saver", "power-profiles-daemon")
39+
, const Trans = QT_TRANSLATE_NOOP3("LXQt::PowerProfiles", "balanced", "power-profiles-daemon")
40+
, const Trans = QT_TRANSLATE_NOOP3("LXQt::PowerProfiles", "performance", "power-profiles-daemon")
41+
)
42+
{}
43+
}
44+
3645
namespace LXQt
3746
{
3847
Q_GLOBAL_STATIC(LXQt::PowerProfiles, g_power_profiles)
@@ -130,7 +139,7 @@ namespace LXQt
130139
for (auto const & profile : profiles)
131140
{
132141
const QString p = qdbus_cast<QString>(profile[QStringLiteral("Profile")]);
133-
auto a = new QAction(p, mActions.get());
142+
auto a = new QAction(tr(qUtf8Printable(p), "power-profiles-daemon"), mActions.get());
134143
a->setCheckable(true);
135144
a->setData(p);
136145
a->setChecked(mActiveProfile == p);

0 commit comments

Comments
 (0)