1 /*
2 	This file is part of Warzone 2100.
3 	Copyright (C) 2005-2020  Warzone 2100 Project
4 
5 	Warzone 2100 is free software; you can redistribute it and/or modify
6 	it under the terms of the GNU General Public License as published by
7 	the Free Software Foundation; either version 2 of the License, or
8 	(at your option) any later version.
9 
10 	Warzone 2100 is distributed in the hope that it will be useful,
11 	but WITHOUT ANY WARRANTY; without even the implied warranty of
12 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 	GNU General Public License for more details.
14 
15 	You should have received a copy of the GNU General Public License
16 	along with Warzone 2100; if not, write to the Free Software
17 	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 #ifndef _i18n_h
20 #define _i18n_h
21 
22 /* Check the header files have been included from frame.h if they
23  * are used outside of the framework library.
24  */
25 #if !defined(_frame_h) && !defined(FRAME_LIB_INCLUDE)
26 #  error Framework header files MUST be included from frame.h ONLY.
27 #endif
28 
29 
30 // To avoid `warning: ISO C++ forbids variable length array 'msg_ctxt_id' [-Wvla]`,
31 // explicitly disable variable-sized arrays before including gettext.h
32 #define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
33 #include "gettext.h"
34 
35 // Enable NLS for our parsers when it's enabled for us
36 #define YYENABLE_NLS ENABLE_NLS
37 
38 
39 // MSVC doesn't have it, and gettext's wonderful design needs it.
40 #if !defined(LC_MESSAGES)
41 #  define LC_MESSAGES 0
42 #endif
43 
44 
45 #define _(String) gettext(String)
46 #define N_(String) gettext_noop(String)
47 
48 // Context sensitive strings
49 #define P_(Context, String) pgettext(Context, String)
50 // Non literal context sensitive strings
51 #define PE_(Context, String) pgettext_expr(Context, String)
52 // Make xgettext recognize the context
53 #define NP_(Context, String) gettext_noop(String)
54 
55 WZ_DECL_PURE const char *getLanguage();
56 WZ_DECL_PURE const char *getLanguageName();
57 WZ_DECL_NONNULL(1) bool setLanguage(const char *name);
58 void setNextLanguage(bool prev = false);
59 void initI18n();
60 
61 const char *getCompileDate();
62 
63 #endif // _i18n_h
64