]> git.lyx.org Git - lyx.git/blob - src/client/gettext.cpp
Don't allow newline characters in document settings.
[lyx.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
19 namespace lyx {
20
21
22 #ifdef HAVE_LOCALE_H
23 #  include <locale.h>
24 #endif
25
26
27 namespace {
28
29 Messages const & getLyXMessages()
30 {
31         static Messages lyx_messages;
32
33         return lyx_messages;
34 }
35
36 } // anon namespace
37
38
39 docstring const _(string const & str)
40 {
41         return getLyXMessages().get(str);
42 }
43
44
45 #ifdef ENABLE_NLS
46
47 void locale_init()
48 {
49 #  ifdef HAVE_LC_MESSAGES
50         setlocale(LC_MESSAGES, "");
51 #  endif
52         setlocale(LC_CTYPE, "");
53         setlocale(LC_NUMERIC, "C");
54 }
55
56 #else // ENABLE_NLS
57
58 void locale_init()
59 {
60         setlocale(LC_NUMERIC, "C");
61 }
62
63 #endif
64
65
66 } // namespace lyx