diff options
Diffstat (limited to 'src/FbTk/I18n.hh')
-rw-r--r-- | src/FbTk/I18n.hh | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/src/FbTk/I18n.hh b/src/FbTk/I18n.hh index 4ff4b77..6de2b8c 100644 --- a/src/FbTk/I18n.hh +++ b/src/FbTk/I18n.hh | |||
@@ -30,33 +30,10 @@ | |||
30 | 30 | ||
31 | #include "FbString.hh" | 31 | #include "FbString.hh" |
32 | 32 | ||
33 | #ifdef HAVE_LOCALE_H | ||
34 | #include <locale.h> | ||
35 | #endif // HAVE_LOCALE_H | ||
36 | |||
37 | #ifdef HAVE_NL_TYPES_H | ||
38 | // this is needed for linux libc5 systems | ||
39 | extern "C" { | ||
40 | #include <nl_types.h> | ||
41 | } | ||
42 | #elif defined(__CYGWIN__) || defined(__EMX__) || defined(__APPLE__) | ||
43 | #ifdef __cplusplus | ||
44 | extern "C" { | ||
45 | #endif // __cplusplus | ||
46 | typedef int nl_catd; | ||
47 | char *catgets(nl_catd cat, int set_number, int message_number, char *message); | ||
48 | nl_catd catopen(char *name, int flag); | ||
49 | void catclose(nl_catd cat); | ||
50 | #ifdef __cplusplus | ||
51 | } | ||
52 | #endif // __cplusplus | ||
53 | |||
54 | #endif // HAVE_NL_TYPES_H | ||
55 | |||
56 | // Some defines to help out | 33 | // Some defines to help out |
57 | #ifdef NLS | 34 | #ifdef NLS |
58 | #define _FB_USES_NLS \ | 35 | #define _FB_USES_NLS \ |
59 | FbTk::I18n &i18n = *FbTk::I18n::instance() | 36 | FbTk::I18n &i18n = FbTk::I18n::instance() |
60 | 37 | ||
61 | // ignore the description, it's for helping translators | 38 | // ignore the description, it's for helping translators |
62 | 39 | ||
@@ -97,27 +74,23 @@ namespace FbTk { | |||
97 | 74 | ||
98 | class I18n { | 75 | class I18n { |
99 | public: | 76 | public: |
100 | static I18n *instance(); | 77 | |
78 | static void init(const char*); | ||
79 | static I18n& instance(); | ||
80 | |||
101 | const char *getLocale() const { return m_locale.c_str(); } | 81 | const char *getLocale() const { return m_locale.c_str(); } |
102 | bool multibyte() const { return m_multibyte; } | 82 | bool multibyte() const { return m_multibyte; } |
103 | const nl_catd &getCatalogFd() const { return m_catalog_fd; } | ||
104 | |||
105 | FbString getMessage(int set_number, int message_number, | 83 | FbString getMessage(int set_number, int message_number, |
106 | const char *default_messsage = 0, bool translate_fb = false) const; | 84 | const char *default_messsage = 0, bool translate_fb = false) const; |
107 | 85 | ||
108 | void openCatalog(const char *catalog); | ||
109 | private: | 86 | private: |
110 | I18n(); | 87 | I18n(); |
111 | ~I18n(); | 88 | ~I18n(); |
112 | std::string m_locale; | 89 | std::string m_locale; |
113 | bool m_multibyte, m_utf8_translate; | 90 | bool m_multibyte; |
114 | nl_catd m_catalog_fd; | 91 | bool m_utf8_translate; |
115 | |||
116 | |||
117 | }; | 92 | }; |
118 | 93 | ||
119 | void NLSInit(const char *); | ||
120 | |||
121 | } // end namespace FbTk | 94 | } // end namespace FbTk |
122 | 95 | ||
123 | #endif // I18N_HH | 96 | #endif // I18N_HH |