diff --git a/tools/power/cpupower/utils/cpupower-info.c b/tools/power/cpupower/utils/cpupower-info.c index 10299f2..b26cc08 100644 --- a/tools/power/cpupower/utils/cpupower-info.c +++ b/tools/power/cpupower/utils/cpupower-info.c @@ -41,8 +41,10 @@ int cmd_info(int argc, char **argv) } params = {}; int ret = 0; +#ifdef NLS setlocale(LC_ALL, ""); textdomain(PACKAGE); +#endif /* parameter parsing */ while ((ret = getopt_long(argc, argv, "b", set_opts, NULL)) != -1) { diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c index 3e6f374..a40b50d 100644 --- a/tools/power/cpupower/utils/cpupower-set.c +++ b/tools/power/cpupower/utils/cpupower-set.c @@ -43,8 +43,10 @@ int cmd_set(int argc, char **argv) int perf_bias = 0; int ret = 0; +#ifdef NLS setlocale(LC_ALL, ""); textdomain(PACKAGE); +#endif params.params = 0; /* parameter parsing */ diff --git a/tools/power/cpupower/utils/cpupower.c b/tools/power/cpupower/utils/cpupower.c index 9ea9143..24d19db 100644 --- a/tools/power/cpupower/utils/cpupower.c +++ b/tools/power/cpupower/utils/cpupower.c @@ -189,8 +189,10 @@ int main(int argc, const char *argv[]) return EXIT_FAILURE; } +#ifdef NLS setlocale(LC_ALL, ""); textdomain(PACKAGE); +#endif /* Turn "perf cmd --help" into "perf help cmd" */ if (argc > 1 && !strcmp(argv[1], "--help")) { diff --git a/tools/power/cpupower/utils/helpers/helpers.h b/tools/power/cpupower/utils/helpers/helpers.h index aa9e954..261692a 100644 --- a/tools/power/cpupower/utils/helpers/helpers.h +++ b/tools/power/cpupower/utils/helpers/helpers.h @@ -10,13 +10,13 @@ #ifndef __CPUPOWERUTILS_HELPERS__ #define __CPUPOWERUTILS_HELPERS__ -#include #include #include "helpers/bitmask.h" /* Internationalization ****************************/ #ifdef NLS +#include #define _(String) gettext(String) #ifndef gettext_noop diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c index 05f953f..dec8ff9 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c @@ -268,7 +268,7 @@ void list_monitors(void) * percent, time (granlarity) */ printf("%s\t[%c] -> %s\n", s.name, range_abbr[s.range], - gettext(s.desc)); + _(s.desc)); } } } diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h index 9e43f33..d96d618 100644 --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h @@ -60,7 +60,7 @@ extern long long timespec_diff_us(struct timespec start, struct timespec end); #define print_overflow_err(mes, ov) \ { \ - fprintf(stderr, gettext("Measure took %u seconds, but registers could " \ + fprintf(stderr, _("Measure took %u seconds, but registers could " \ "overflow at %u seconds, results " \ "could be inaccurate\n"), mes, ov); \ }