blob: 0381491955eed66bc50412a0404dc44ddc5a8c20 (
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
|
#include "config.h"
#include <stdio.h>
#include <locale.h>
#include <string.h>
#include <stdlib.h>
#define gboolean char
#define FALSE 0
#define TRUE 1
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(String) gettext(String)
#else /* !ENABLE_NLS */
#define _(String) (String)
#endif
int
main (int argc, char *argv[])
{
char *string;
gboolean is_utf8 = FALSE;
if (argc == 3 &&
strcmp (argv[1], "--utf8") == 0) {
string = argv[2];
is_utf8 = TRUE;
} else if (argc == 2) {
string = argv[1];
is_utf8 = FALSE;
} else {
fprintf (stderr, "usage: gdmtranslate [--utf8] <string to translate>\n");
return 0;
}
if (getenv ("UNSAFE_TO_TRANSLATE") != NULL &&
strcmp (getenv ("UNSAFE_TO_TRANSLATE"), "yes") == 0) {
printf ("%s\n", string);
return 0;
}
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
if (is_utf8)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
printf ("%s\n", _(string));
return 0;
}
|