1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
diff --git a/utils/cpupower-info.c b/utils/cpupower-info.c
index 4c9d342b7..91b43d67c 100644
--- a/utils/cpupower-info.c
+++ b/utils/cpupower-info.c
@@ -39,8 +39,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/utils/cpupower-set.c b/utils/cpupower-set.c
index 3cd95c6cb..7f8698493 100644
--- a/utils/cpupower-set.c
+++ b/utils/cpupower-set.c
@@ -41,8 +41,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/utils/cpupower.c b/utils/cpupower.c
index 8e3d08042..0ab891d3a 100644
--- a/utils/cpupower.c
+++ b/utils/cpupower.c
@@ -191,8 +191,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/utils/helpers/helpers.h b/utils/helpers/helpers.h
index 357b19bb1..cde3a9f6f 100644
--- a/utils/helpers/helpers.h
+++ b/utils/helpers/helpers.h
@@ -9,7 +9,6 @@
#ifndef __CPUPOWERUTILS_HELPERS__
#define __CPUPOWERUTILS_HELPERS__
-#include <libintl.h>
#include <locale.h>
#include "helpers/bitmask.h"
@@ -18,6 +17,8 @@
/* Internationalization ****************************/
#ifdef NLS
+#include <libintl.h>
+
#define _(String) gettext(String)
#ifndef gettext_noop
#define gettext_noop(String) String
diff --git a/utils/idle_monitor/cpupower-monitor.c b/utils/idle_monitor/cpupower-monitor.c
index 3d54fd433..7026e3367 100644
--- a/utils/idle_monitor/cpupower-monitor.c
+++ b/utils/idle_monitor/cpupower-monitor.c
@@ -273,7 +273,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/utils/idle_monitor/cpupower-monitor.h b/utils/idle_monitor/cpupower-monitor.h
index eafef38f1..f3e44f063 100644
--- a/utils/idle_monitor/cpupower-monitor.h
+++ b/utils/idle_monitor/cpupower-monitor.h
@@ -67,7 +67,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); \
}
|