Freeciv-3.3
Loading...
Searching...
No Matches
fcintl.h
Go to the documentation of this file.
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
17extern "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
36/* Ugly hacks to make nls-enabled builds work with libintl.h in crosser
37 * The problems came up in some C++ headers where functions by the same
38 * name as these global wrappers were used. As such, the libintl.h
39 * header is semantically wrong everywhere, not just in crosser,
40 * but crosser is the only environment where we know it to cause actual
41 * problems (failing build). As this workaround isn't semantically correct
42 * either, by limiting these adjustments to crosser, and even there only
43 * to C++ compilations, we get both
44 * 1) crosser build to go through
45 * 2) we are not accidentally breaking any other environment
46 */
47#if defined(FREECIV_CROSSER) && defined(__cplusplus)
48#undef vswprintf
49#endif /* FREECIV_CROSSER */
50
51#endif /* FREECIV_HAVE_LIBINTL_H */
52
53/* Core freeciv */
54#define _(String) gettext(String)
55#define DG_(domain, String) dgettext(domain, String)
56#define N_(String) String
57#define Q_(String) skip_intl_qualifier_prefix(gettext(String))
58#define PL_(String1, String2, n) ngettext((String1), (String2), (n))
59
60/* Ruledit */
61#define R__(String) dgettext("freeciv-ruledit", String)
62#define RQ_(String) skip_intl_qualifier_prefix(dgettext("freeciv-ruledit", String))
63
64#else /* FREECIV_ENABLE_NLS */
65
66/* Core freeciv */
67#define _(String) (String)
68#define DG_(domain, String) (String)
69#define N_(String) String
70#define Q_(String) skip_intl_qualifier_prefix(String)
71#define PL_(String1, String2, n) ((n) == 1 ? (String1) : (String2))
72#define C_(String) capitalized_string(String)
73
74/* Ruledit */
75#define R__(String) (String)
76#define RQ_(String) skip_intl_qualifier_prefix(String)
77
78#undef textdomain
79#undef bindtextdomain
80
81#define textdomain(Domain)
82#define bindtextdomain(Package, Directory)
83
84#endif /* FREECIV_ENABLE_NLS */
85
86/* This provides an untranslated version of Q_ that allows the caller to
87 * get access to the original string. This may be needed for comparisons,
88 * for instance. */
89#define Qn_(String) skip_intl_qualifier_prefix(String)
90
91const char *skip_intl_qualifier_prefix(const char *str)
93
94char *capitalized_string(const char *str);
95void free_capitalized(char *str);
98
99const char *get_locale_dir(void);
100
101#ifdef __cplusplus
102}
103#endif /* __cplusplus */
104
105#endif /* FC__FCINTL_H */
#define str
Definition astring.c:76
char * incite_cost
Definition comments.c:76
char * capitalized_string(const char *str)
Definition fcintl.c:66
bool is_capitalization_enabled(void)
Definition fcintl.c:101
const char * get_locale_dir(void)
Definition fcintl.c:111
void free_capitalized(char *str)
Definition fcintl.c:85
void capitalization_opt_in(bool opt_in)
Definition fcintl.c:93
const char * skip_intl_qualifier_prefix(const char *str) fc__attribute((__format_arg__(1)))
Definition fcintl.c:48
#define fc__attribute(x)
Definition support.h:99