diff options
author | Robert Tari <robert@tari.in> | 2023-06-08 11:16:48 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2023-06-08 11:16:48 +0200 |
commit | c20a21fa5806efb82bdd83d2024b7658a35f2efa (patch) | |
tree | 1dca4fb13032b4b4a93c55f6b124147c28a58e38 /src | |
parent | 22d2a526e72629f0880a2b9d681dcf133f466188 (diff) | |
parent | 80312bd77184017a9caf682ea0cedbc658ca6604 (diff) | |
download | ayatana-indicator-power-c20a21fa5806efb82bdd83d2024b7658a35f2efa.tar.gz ayatana-indicator-power-c20a21fa5806efb82bdd83d2024b7658a35f2efa.tar.bz2 ayatana-indicator-power-c20a21fa5806efb82bdd83d2024b7658a35f2efa.zip |
Merge branch 'sunweaver-pr/no-parentheses-in-lomiri'
Attributes GH PR #79: https://github.com/AyatanaIndicators/ayatana-indicator-power/pull/79
Diffstat (limited to 'src')
-rw-r--r-- | src/device.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/device.c b/src/device.c index 6e79557..af01253 100644 --- a/src/device.c +++ b/src/device.c @@ -27,6 +27,7 @@ License along with this library. If not, see #include "config.h" #endif +#include <ayatana/common/utils.h> #include <glib/gi18n-lib.h> #include <gio/gio.h> @@ -1063,18 +1064,42 @@ indicator_power_device_get_readable_title (const IndicatorPowerDevice * device, if (want_time && want_percent) { - /* TRANSLATORS: after the icon, a time-remaining string + battery %. Example: "(0:59, 33%)" */ - str = g_strdup_printf (_("(%s, %.0lf%%)"), time_str, p->percentage); + /* Don't show parentheses around text values in Lomiri */ + if (ayatana_common_utils_is_lomiri()) + { + /* TRANSLATORS: after the icon, a time-remaining string + battery %. Example: "0:59 33%" */ + str = g_strdup_printf (_("%s %.0lf%%"), time_str, p->percentage); + } + else { + /* TRANSLATORS: after the icon, a time-remaining string + battery %. Example: "(0:59, 33%)" */ + str = g_strdup_printf (_("(%s, %.0lf%%)"), time_str, p->percentage); + } } else if (want_time) { - /* TRANSLATORS: after the icon, a time-remaining string Example: "(0:59)" */ - str = g_strdup_printf (_("(%s)"), time_str); + /* Don't show parentheses around text values in Lomiri */ + if (ayatana_common_utils_is_lomiri()) + { + /* TRANSLATORS: after the icon, a time-remaining string Example: "0:59" */ + str = g_strdup_printf (_("%s"), time_str); + } + else { + /* TRANSLATORS: after the icon, a time-remaining string Example: "(0:59)" */ + str = g_strdup_printf (_("(%s)"), time_str); + } } else if (want_percent) { - /* TRANSLATORS: after the icon, a battery %. Example: "(33%)" */ - str = g_strdup_printf (_("(%.0lf%%)"), p->percentage); + /* Don't show parentheses around text values in Lomiri */ + if (ayatana_common_utils_is_lomiri()) + { + /* TRANSLATORS: after the icon, a battery %. Example: "(33%)" */ + str = g_strdup_printf (_("%.0lf%%"), p->percentage); + } + else { + /* TRANSLATORS: after the icon, a battery %. Example: "(33%)" */ + str = g_strdup_printf (_("(%.0lf%%)"), p->percentage); + } } else { |