diff options
author | fluxgen <fluxgen> | 2003-04-26 15:46:03 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-04-26 15:46:03 (GMT) |
commit | 2065e654a357c6bf45c5747e25b713415eab8983 (patch) | |
tree | 04cd4df7b046c78aa96eb6160ac181cdd237a1bf /src/i18n.cc | |
parent | 00dc4656ea45071c9d2bbd1545493ea391ac4668 (diff) | |
download | fluxbox-2065e654a357c6bf45c5747e25b713415eab8983.zip fluxbox-2065e654a357c6bf45c5747e25b713415eab8983.tar.bz2 |
removed nl_types_cygnus and did some cleaning
Diffstat (limited to 'src/i18n.cc')
-rw-r--r-- | src/i18n.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/i18n.cc b/src/i18n.cc index 929b3fd..5b3b2ca 100644 --- a/src/i18n.cc +++ b/src/i18n.cc | |||
@@ -1,5 +1,5 @@ | |||
1 | // i18n.hh for Fluxbox Window Manager | 1 | // i18n.hh for Fluxbox Window Manager |
2 | // Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | 2 | // Copyright (c) 2001 - 2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net) |
3 | // | 3 | // |
4 | // i18n.cc for Blackbox - an X11 Window manager | 4 | // i18n.cc for Blackbox - an X11 Window manager |
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
@@ -22,27 +22,21 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: i18n.cc,v 1.8 2002/12/02 22:50:57 fluxgen Exp $ | 25 | // $Id: i18n.cc,v 1.9 2003/04/26 15:46:03 fluxgen Exp $ |
26 | 26 | ||
27 | //usr GNU extensions | 27 | //usr GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
29 | #define _GNU_SOURCE | 29 | #define _GNU_SOURCE |
30 | #endif // _GNU_SOURCE | 30 | #endif // _GNU_SOURCE |
31 | 31 | ||
32 | #ifdef HAVE_CONFIG_H | ||
33 | #include "../config.h" | ||
34 | #endif // HAVE_CONFIG_H | ||
35 | |||
36 | #include "i18n.hh" | 32 | #include "i18n.hh" |
37 | 33 | ||
38 | #include <X11/Xlocale.h> | 34 | #include <X11/Xlocale.h> |
39 | 35 | ||
40 | |||
41 | #include <cstdlib> | 36 | #include <cstdlib> |
42 | #include <cstring> | 37 | #include <cstring> |
43 | #include <cstdio> | 38 | #include <cstdio> |
44 | 39 | ||
45 | |||
46 | #ifdef HAVE_LOCALE_H | 40 | #ifdef HAVE_LOCALE_H |
47 | #include <locale.h> | 41 | #include <locale.h> |
48 | #endif // HAVE_LOCALE_H | 42 | #endif // HAVE_LOCALE_H |
@@ -59,15 +53,18 @@ void NLSInit(const char *catalog) { | |||
59 | 53 | ||
60 | 54 | ||
61 | I18n::I18n():m_multibyte(false), m_catalog_fd((nl_catd)(-1)) { | 55 | I18n::I18n():m_multibyte(false), m_catalog_fd((nl_catd)(-1)) { |
62 | #ifdef HAVE_SETLOCALE | 56 | #ifdef HAVE_SETLOCALE |
63 | //make sure we don't get 0 to m_locale string | 57 | //make sure we don't get 0 to m_locale string |
64 | char *temp = setlocale(LC_ALL, ""); | 58 | char *temp = setlocale(LC_ALL, ""); |
65 | m_locale = ( temp ? temp : ""); | 59 | m_locale = ( temp ? temp : ""); |
66 | if (m_locale.size() == 0) { | 60 | if (m_locale.size() == 0) { |
67 | cerr<<"Warning: Failed to set locale, reverting to \"C\""<<endl; | 61 | cerr<<"Warning: Failed to set locale, reverting to \"C\""<<endl; |
68 | #endif // HAVE_SETLOCALE | 62 | #endif // HAVE_SETLOCALE |
63 | |||
69 | m_locale = "C"; | 64 | m_locale = "C"; |
70 | #ifdef HAVE_SETLOCALE | 65 | |
66 | #ifdef HAVE_SETLOCALE | ||
67 | |||
71 | } else { | 68 | } else { |
72 | // MB_CUR_MAX returns the size of a char in the current locale | 69 | // MB_CUR_MAX returns the size of a char in the current locale |
73 | if (MB_CUR_MAX > 1) | 70 | if (MB_CUR_MAX > 1) |
@@ -109,7 +106,7 @@ void I18n::openCatalog(const char *catalog) { | |||
109 | catalog_filename += '/'; | 106 | catalog_filename += '/'; |
110 | catalog_filename += catalog; | 107 | catalog_filename += catalog; |
111 | 108 | ||
112 | #ifdef MCLoadBySet | 109 | #ifdef MCLoadBySet |
113 | m_catalog_fd = catopen(catalog_filename.c_str(), MCLoadBySet); | 110 | m_catalog_fd = catopen(catalog_filename.c_str(), MCLoadBySet); |
114 | #else // !MCLoadBySet | 111 | #else // !MCLoadBySet |
115 | m_catalog_fd = catopen(catalog_filename.c_str(), NL_CAT_LOCALE); | 112 | m_catalog_fd = catopen(catalog_filename.c_str(), NL_CAT_LOCALE); |
@@ -125,7 +122,8 @@ void I18n::openCatalog(const char *catalog) { | |||
125 | } | 122 | } |
126 | 123 | ||
127 | 124 | ||
128 | const char *I18n::getMessage(int set_number, int message_number, const char *default_message) { | 125 | const char *I18n::getMessage(int set_number, int message_number, |
126 | const char *default_message) { | ||
129 | 127 | ||
130 | #if defined(NLS) && defined(HAVE_CATGETS) | 128 | #if defined(NLS) && defined(HAVE_CATGETS) |
131 | if (m_catalog_fd != (nl_catd)-1) | 129 | if (m_catalog_fd != (nl_catd)-1) |