diff options
Diffstat (limited to 'src/i18n.hh')
-rw-r--r-- | src/i18n.hh | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/src/i18n.hh b/src/i18n.hh index a2b97b9..5e6bfa4 100644 --- a/src/i18n.hh +++ b/src/i18n.hh | |||
@@ -1,3 +1,6 @@ | |||
1 | // i18n.hh for Fluxbox Window Manager | ||
2 | // Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
3 | // | ||
1 | // i18n.hh for Blackbox - an X11 Window manager | 4 | // i18n.hh for Blackbox - an X11 Window manager |
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
3 | // | 6 | // |
@@ -19,53 +22,54 @@ | |||
19 | // 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 |
20 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
21 | 24 | ||
22 | #ifndef __i18n_h | 25 | // $Id: i18n.hh,v 1.9 2002/08/15 10:52:16 fluxgen Exp $ |
23 | #define __i18n_h | 26 | |
27 | #ifndef I18N_HH | ||
28 | #define I18N_HH | ||
29 | |||
30 | #include "../nls/blackbox-nls.hh" | ||
24 | 31 | ||
25 | #ifdef NLS | 32 | #ifdef HAVE_CONFIG_H |
26 | # include "../nls/blackbox-nls.hh" | 33 | #include "../config.h" |
27 | #endif // NLS | 34 | #endif // HAVE_CONFIG_H |
28 | 35 | ||
29 | #ifdef HAVE_LOCALE_H | 36 | #ifdef HAVE_LOCALE_H |
30 | # include <locale.h> | 37 | # include <locale.h> |
31 | #endif // HAVE_LOCALE_H | 38 | #endif // HAVE_LOCALE_H |
32 | 39 | ||
33 | #ifdef HAVE_NL_TYPES_H | 40 | #ifdef HAVE_NL_TYPES_H |
34 | // this is needed for linux libc5 systems | 41 | // this is needed for linux libc5 systems |
35 | extern "C" { | 42 | extern "C" { |
36 | # include <nl_types.h> | 43 | # include <nl_types.h> |
37 | } | 44 | } |
45 | #else // HAVE_NL_TYPES_H | ||
46 | #include "nl_types_cygnus.h" | ||
38 | #endif // HAVE_NL_TYPES_H | 47 | #endif // HAVE_NL_TYPES_H |
39 | 48 | ||
49 | #ifdef __CYGWIN32__ | ||
50 | # include "nl_types_cygnus.h" | ||
51 | #endif | ||
40 | 52 | ||
41 | class I18n { | 53 | #include <string> |
42 | private: | ||
43 | char *locale, *catalog_filename; | ||
44 | int mb; | ||
45 | nl_catd catalog_fd; | ||
46 | 54 | ||
47 | 55 | class I18n { | |
48 | protected: | ||
49 | I18n(void); | ||
50 | |||
51 | public: | 56 | public: |
52 | //so old compilators dont complain | ||
53 | ~I18n(void); | ||
54 | |||
55 | static I18n *instance(); | 57 | static I18n *instance(); |
56 | inline const char *getLocale(void) const { return locale; } | 58 | inline const char *getLocale(void) const { return m_locale.c_str(); } |
57 | inline const char *getCatalogFilename(void) const { return catalog_filename; } | 59 | inline bool multibyte(void) const { return m_multibyte; } |
58 | 60 | inline const nl_catd &getCatalogFd(void) const { return m_catalog_fd; } | |
59 | inline const int &multibyte(void) const { return mb; } | ||
60 | 61 | ||
61 | inline const nl_catd &getCatalogFd(void) const { return catalog_fd; } | 62 | const char *getMessage(int set_number, int message_number, const char *default_messsage = 0); |
63 | void openCatalog(const char *); | ||
64 | private: | ||
65 | I18n(); | ||
66 | ~I18n(); | ||
67 | std::string m_locale; | ||
68 | bool m_multibyte; | ||
69 | nl_catd m_catalog_fd; | ||
62 | 70 | ||
63 | const char *getMessage(int, int, const char * = 0); | ||
64 | void openCatalog(const char *); | ||
65 | }; | 71 | }; |
66 | 72 | ||
73 | void NLSInit(const char *); | ||
67 | 74 | ||
68 | //extern I18n *i18n; | 75 | #endif // I18N_HH |
69 | extern void NLSInit(const char *); | ||
70 | |||
71 | #endif // __i18n_h | ||