diff options
Diffstat (limited to 'src/lib/nls.c')
-rw-r--r-- | src/lib/nls.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/lib/nls.c b/src/lib/nls.c new file mode 100644 index 00000000..96e44a99 --- /dev/null +++ b/src/lib/nls.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2010, 2011 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file src/lib/nls.c | ||
23 | * @brief natural language support | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "gnunet_gtk.h" | ||
27 | |||
28 | #if ENABLE_NLS | ||
29 | #include <locale.h> | ||
30 | #endif | ||
31 | |||
32 | |||
33 | /** | ||
34 | * Initialize GNU gettext for message translation. | ||
35 | */ | ||
36 | void | ||
37 | GNUNET_GTK_setup_nls () | ||
38 | { | ||
39 | #if ENABLE_NLS | ||
40 | char *path; | ||
41 | |||
42 | setlocale (LC_ALL, ""); | ||
43 | GNUNET_asprintf (&path, | ||
44 | "%s/%s/locale/", | ||
45 | GNUNET_GTK_get_data_dir (), | ||
46 | PACKAGE_NAME); | ||
47 | bindtextdomain ("gnunet-gtk", path); | ||
48 | textdomain ("gnunet-gtk"); | ||
49 | bind_textdomain_codeset ("GNUnet", "UTF-8"); | ||
50 | bind_textdomain_codeset ("gnunet-gtk", "UTF-8"); | ||
51 | GNUNET_free (path); | ||
52 | #else | ||
53 | fprintf (stderr, | ||
54 | "WARNING: gnunet-gtk was compiled without i18n support (did CFLAGS contain -Werror?).\n"); | ||
55 | #endif | ||
56 | } | ||
57 | |||
58 | /* end of nls.c */ | ||