(mu_locale_set): New variable
(mu_set_locale,mu_restore_locale): New functions (mu_init_nls): Use mu_set_locale. Store its return in mu_locale_set.
Showing
1 changed file
with
28 additions
and
8 deletions
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 2002 Free Software Foundation, Inc. | 2 | Copyright (C) 2002, 2006 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -24,17 +24,37 @@ | ... | @@ -24,17 +24,37 @@ |
24 | 24 | ||
25 | /* Initialize Native Language Support */ | 25 | /* Initialize Native Language Support */ |
26 | 26 | ||
27 | char *mu_locale_set; | ||
28 | |||
29 | #ifndef HAVE_SETLOCALE | ||
30 | # define setlocale(c,s) NULL | ||
31 | #endif | ||
32 | |||
33 | /* Set locale via LC_ALL. */ | ||
34 | char * | ||
35 | mu_set_locale (const char *locale) | ||
36 | { | ||
37 | #ifdef HAVE_SETLOCALE | ||
38 | return setlocale (LC_ALL, locale); | ||
39 | #else | ||
40 | return NULL; | ||
41 | #endif | ||
42 | } | ||
43 | |||
44 | void | ||
45 | mu_restore_locale (void) | ||
46 | { | ||
47 | if (mu_locale_set) | ||
48 | mu_set_locale (mu_locale_set); | ||
49 | } | ||
50 | |||
27 | void | 51 | void |
28 | mu_init_nls (void) | 52 | mu_init_nls (void) |
29 | { | 53 | { |
30 | #ifdef ENABLE_NLS | 54 | #ifdef ENABLE_NLS |
31 | /* Set locale via LC_ALL. */ | 55 | mu_locale_set = mu_set_locale (""); |
32 | #ifdef HAVE_SETLOCALE | 56 | bindtextdomain (PACKAGE, LOCALEDIR); |
33 | setlocale(LC_ALL, ""); | 57 | textdomain (PACKAGE); |
34 | #endif /* HAVE_SETLOCALE */ | ||
35 | bindtextdomain(PACKAGE, LOCALEDIR); | ||
36 | textdomain(PACKAGE); | ||
37 | #endif /* ENABLE_NLS */ | 58 | #endif /* ENABLE_NLS */ |
38 | return; | ||
39 | } | 59 | } |
40 | 60 | ... | ... |
-
Please register or sign in to post a comment