]> git.lyx.org Git - lyx.git/blob - src/gettext.h
use more std::functors add some of my own, some change to fl_display etc. read the...
[lyx.git] / src / gettext.h
1 // -*- C++ -*-
2 #ifndef _GETTEXT_H_
3 #define _GETTEXT_H_
4
5 /*
6  * Native Language Support
7  *
8  * The general idea is that any string that should be translated is handled
9  * as follows:
10  *      _("string")
11  *
12  * Static strings are special, obviously and must be flagged as follows:
13  *      static str = N_("string");
14  *
15  * And wherever they are used:
16  *      _(str)
17  *
18  * Every file where there are strings needs:
19  *      #include "gettext.h"
20  *
21  * Remember to mention each of these files in "po/POFILES.in"
22  *
23  * The main() needs a locale_init() and a gettext_init() in the beginning.
24  */
25
26 /*
27  * General translation notes:
28  *   Commands/options are not translated
29  *   Debug messages are not translated
30  *   Panic/fatal (that should not happen) messages need not be translated
31  */
32
33 #ifdef ENABLE_NLS
34
35 #include "LString.h"
36
37 #  if HAVE_GETTEXT
38 #    include <libintl.h>      // use the header already in the system *EK*
39 #    ifdef HAVE_LOCALE_H
40 #      include <locale.h>        // for LC_MESSAGES
41 #    endif
42 #  else
43 #    include "../intl/libintl.h"
44 #  endif
45
46 char const * _(char const *);
47
48 string const _(string const &);
49
50 //#  define _(str) gettext(str)
51 #  define N_(str) (str)              // for detecting static strings
52
53 #  ifdef HAVE_LC_MESSAGES
54                                 // LC_TIME, LC_CTYPE, even LC_ALL
55 #    define locale_init() { setlocale (LC_MESSAGES, ""); setlocale (LC_CTYPE, "");}
56 #  else
57 #    define locale_init()
58 #  endif
59 #  define gettext_init() { bindtextdomain (PACKAGE, lyx_localedir.c_str()); \
60         textdomain (PACKAGE); }
61 #else
62 ///
63 #  define _(str) (str)
64 ///
65 #  define S_(str) (str)
66 ///
67 #  define N_(str) (str)
68 ///
69 #  define locale_init()
70 ///
71 #  define gettext_init()
72 #endif
73
74 #endif