]> git.lyx.org Git - lyx.git/blob - src/gettext.C
hopefully fix tex2lyx linking.
[lyx.git] / src / gettext.C
1 /**
2  * \file src/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 "gettext.h"
15 #include "messages.h"
16 #include "support/environment.h"
17
18
19 namespace lyx {
20
21 #ifdef HAVE_LOCALE_H
22 #  include <locale.h>
23 #endif
24
25 using support::setEnv;
26
27 using std::string;
28
29
30 namespace {
31
32 static Messages & getLyXMessages()
33 {
34         static Messages lyx_messages;
35
36         return lyx_messages;
37 }
38
39 } // anon namespace
40
41
42 docstring const _(string const & str)
43 {
44         return getLyXMessages().get(str);
45 }
46
47
48 #ifdef ENABLE_NLS
49
50 void locale_init()
51 {
52         // Disable, as otherwise it overrides everything else incl. the doc language
53         setEnv("LANGUAGE", "");
54 #  ifdef HAVE_LC_MESSAGES
55         setlocale(LC_MESSAGES, "");
56 #  endif
57         setlocale(LC_CTYPE, "");
58         setlocale(LC_NUMERIC, "C");
59 }
60
61 #else // ENABLE_NLS
62
63 void locale_init()
64 {
65         setlocale(LC_NUMERIC, "C");
66 }
67
68 #endif
69
70
71 } // namespace lyx