]> git.lyx.org Git - lyx.git/blob - src/gettext.C
architectural changes to tex2lyx
[lyx.git] / src / gettext.C
1 /**
2  * \file gettext.C
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 "messages.h"
15 #include "LString.h"
16 #include "support/LAssert.h"
17
18 #include <boost/scoped_ptr.hpp>
19
20 #ifdef HAVE_LOCALE_H
21 #  include <locale.h>
22 #endif
23
24 namespace {
25
26 Messages & getLyXMessages()
27 {
28         static Messages lyx_messages;
29
30         return lyx_messages;
31 }
32
33 } // anon namespace
34
35
36 string const _(string const & str)
37 {
38         return getLyXMessages().get(str);
39 }
40
41
42 #ifdef ENABLE_NLS
43
44 void locale_init()
45 {
46 #  ifdef HAVE_LC_MESSAGES
47         setlocale(LC_MESSAGES, "");
48 #  endif
49         setlocale(LC_CTYPE, "");
50         setlocale(LC_NUMERIC, "C");
51 }
52
53 #else // ENABLE_NLS
54
55 void locale_init()
56 {
57         setlocale(LC_NUMERIC, "C");
58 }
59
60 #endif