aboutsummaryrefslogtreecommitdiffstats
path: root/testing/cpupower/nls.patch
blob: 24f5afd45f497b46435ac69cf65ccab5e551a4f2 (plain)
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
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 <libintl.h>
 #include <locale.h>
 
 #include "helpers/bitmask.h"
 
 /* Internationalization ****************************/
 #ifdef NLS
+#include <libintl.h>
 
 #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);		\
 }