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