diff options
Diffstat (limited to 'src/I18n.hh')
-rw-r--r-- | src/I18n.hh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/I18n.hh b/src/I18n.hh new file mode 100644 index 0000000..26292c5 --- /dev/null +++ b/src/I18n.hh | |||
@@ -0,0 +1,70 @@ | |||
1 | // i18n.hh for Fluxbox Window Manager | ||
2 | // Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
3 | // | ||
4 | // i18n.hh for Blackbox - an X11 Window manager | ||
5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | ||
6 | // | ||
7 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
8 | // copy of this software and associated documentation files (the "Software"), | ||
9 | // to deal in the Software without restriction, including without limitation | ||
10 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
11 | // and/or sell copies of the Software, and to permit persons to whom the | ||
12 | // Software is furnished to do so, subject to the following conditions: | ||
13 | // | ||
14 | // The above copyright notice and this permission notice shall be included in | ||
15 | // all copies or substantial portions of the Software. | ||
16 | // | ||
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
20 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
23 | // DEALINGS IN THE SOFTWARE. | ||
24 | |||
25 | // $Id: I18n.hh,v 1.2 2003/12/08 17:29:24 fluxgen Exp $ | ||
26 | |||
27 | #ifndef I18N_HH | ||
28 | #define I18N_HH | ||
29 | |||
30 | #include "../nls/blackbox-nls.hh" | ||
31 | |||
32 | #ifdef HAVE_CONFIG_H | ||
33 | #include "config.h" | ||
34 | #endif // HAVE_CONFIG_H | ||
35 | |||
36 | #ifdef HAVE_LOCALE_H | ||
37 | #include <locale.h> | ||
38 | #endif // HAVE_LOCALE_H | ||
39 | |||
40 | #ifdef HAVE_NL_TYPES_H | ||
41 | // this is needed for linux libc5 systems | ||
42 | extern "C" { | ||
43 | #include <nl_types.h> | ||
44 | } | ||
45 | #endif // HAVE_NL_TYPES_H | ||
46 | |||
47 | #include <string> | ||
48 | |||
49 | class I18n { | ||
50 | public: | ||
51 | static I18n *instance(); | ||
52 | inline const char *getLocale() const { return m_locale.c_str(); } | ||
53 | inline bool multibyte() const { return m_multibyte; } | ||
54 | inline const nl_catd &getCatalogFd() const { return m_catalog_fd; } | ||
55 | |||
56 | const char *getMessage(int set_number, int message_number, | ||
57 | const char *default_messsage = 0) const; | ||
58 | void openCatalog(const char *catalog); | ||
59 | private: | ||
60 | I18n(); | ||
61 | ~I18n(); | ||
62 | std::string m_locale; | ||
63 | bool m_multibyte; | ||
64 | nl_catd m_catalog_fd; | ||
65 | |||
66 | }; | ||
67 | |||
68 | void NLSInit(const char *); | ||
69 | |||
70 | #endif // I18N_HH | ||