]> icculus.org git repositories - mikachu/openbox.git/blob - src/i18n.h
gcc 3 compatibility, converted strstreams to stringstreams
[mikachu/openbox.git] / src / i18n.h
1 // i18n.h for Openbox
2 // Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
3 // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 // DEALINGS IN THE SOFTWARE.
22
23 #ifndef   __i18n_h
24 #define   __i18n_h
25
26 // always include this just for the #defines
27 // this keeps the calls to i18n->getMessage clean, otherwise we have to
28 // add ifdefs to every call to getMessage
29 #include "../nls/openbox-nls.h"
30
31 #ifdef    HAVE_LOCALE_H
32 #  include <locale.h>
33 #endif // HAVE_LOCALE_H
34
35 #ifdef    HAVE_NL_TYPES_H
36 extern "C" {
37 #  include <nl_types.h>
38 }
39 #endif // HAVE_NL_TYPES_H
40
41
42 class I18n {
43 private:
44   char *locale, *catalog_filename;
45   bool mb;
46 #ifdef HAVE_NL_TYPES_H
47   nl_catd catalog_fd;
48 #endif
49
50 public:
51   I18n(void);
52   ~I18n(void);
53
54   inline bool multibyte(void) const { return mb; }
55
56   const char *getMessage(int set, int msg, const char *msgString) const;
57   void openCatalog(const char *catalog);
58 };
59
60
61 extern I18n *i18n;
62 extern void NLSInit(const char *);
63
64
65
66 #endif // __i18n_h