1 /**********************************************************************
2  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; either version 2, or (at your option)
6    any later version.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 ***********************************************************************/
13 #ifndef FC__FCINTL_H
14 #define FC__FCINTL_H
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19 
20 #include "freeciv_config.h"
21 
22 #ifdef FREECIV_HAVE_LOCALE_H
23 #include <locale.h>
24 #endif
25 
26 #include "shared.h" /* bool */
27 
28 #ifdef FREECIV_ENABLE_NLS
29 
30 /* Include libintl.h only if nls enabled.
31  * It defines some wrapper macros that
32  * we don't want defined when nls is disabled. */
33 #ifdef FREECIV_HAVE_LIBINTL_H
34 #include <libintl.h>
35 #endif
36 
37 /* Core freeciv */
38 #define _(String) gettext(String)
39 #define DG_(domain, String) dgettext(domain, String)
40 #define N_(String) String
41 #define Q_(String) skip_intl_qualifier_prefix(gettext(String))
42 #define PL_(String1, String2, n) ngettext((String1), (String2), (n))
43 
44 /* Ruledit */
45 #define R__(String) dgettext("freeciv-ruledit", String)
46 #define RQ_(String) skip_intl_qualifier_prefix(dgettext("freeciv-ruledit", String))
47 
48 #else  /* FREECIV_ENABLE_NLS */
49 
50 /* Core freeciv */
51 #define _(String) (String)
52 #define DG_(domain, String) (String)
53 #define N_(String) String
54 #define Q_(String) skip_intl_qualifier_prefix(String)
55 #define PL_(String1, String2, n) ((n) == 1 ? (String1) : (String2))
56 #define C_(String) capitalized_string(String)
57 
58 /* Ruledit */
59 #define R__(String) (String)
60 #define RQ_(String) skip_intl_qualifier_prefix(String)
61 
62 #undef textdomain
63 #undef bindtextdomain
64 
65 #define textdomain(Domain)
66 #define bindtextdomain(Package, Directory)
67 
68 #endif /* FREECIV_ENABLE_NLS */
69 
70 /* This provides an untranslated version of Q_ that allows the caller to
71  * get access to the original string.  This may be needed for comparisons,
72  * for instance. */
73 #define Qn_(String) skip_intl_qualifier_prefix(String)
74 
75 const char *skip_intl_qualifier_prefix(const char *str)
76             fc__attribute((__format_arg__(1)));
77 
78 char *capitalized_string(const char *str);
79 void free_capitalized(char *str);
80 void capitalization_opt_in(void);
81 bool is_capitalization_enabled(void);
82 
83 const char *get_locale_dir(void);
84 
85 #ifdef __cplusplus
86 }
87 #endif /* __cplusplus */
88 
89 #endif  /* FC__FCINTL_H */
90