]> git.lyx.org Git - features.git/blob - src/client/gettext.cpp
013daf967f41b3001c4a5257e5f3094d1919e280
[features.git] / src / client / gettext.cpp
1 /**
2  * \file src/gettext.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author Jean-Marc Lasgouttes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "support/gettext.h"
15 #include "Messages.h"
16
17 using namespace std;
18 using namespace lyx::support;
19
20 namespace lyx {
21
22
23 #ifdef HAVE_LOCALE_H
24 #  include <locale.h>
25 #endif
26
27
28 namespace {
29
30 Messages & getLyXMessages()
31 {
32         static Messages lyx_messages;
33
34         return lyx_messages;
35 }
36
37 } // anon namespace
38
39
40 docstring const _(string const & str)
41 {
42         return getLyXMessages().get(str);
43 }
44
45
46 #ifdef ENABLE_NLS
47
48 void locale_init()
49 {
50 #  ifdef HAVE_LC_MESSAGES
51         setlocale(LC_MESSAGES, "");
52 #  endif
53         setlocale(LC_CTYPE, "");
54         setlocale(LC_NUMERIC, "C");
55 }
56
57 #else // ENABLE_NLS
58
59 void locale_init()
60 {
61         setlocale(LC_NUMERIC, "C");
62 }
63
64 #endif
65
66
67 } // namespace lyx