-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgettext.h.in
71 lines (56 loc) · 1.73 KB
/
gettext.h.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
This header should not be included in other header files,
but included in the most bottom position of the inclusion part in the implementation (.cpp) files
where the message internationalization (texts with _("...") form) is required.
*/
#ifdef CNOID_GETTEXT_DOMAIN_NAME
#undef CNOID_GETTEXT_DOMAIN_NAME
#endif
#define CNOID_GETTEXT_DOMAIN_NAME "@target@-@CNOID_VERSION@"
#ifdef _
#undef _
#endif
#include <boost/format.hpp>
namespace cnoid {
inline boost::format fmt(const char* f_string) {
boost::format f(f_string);
f.exceptions(boost::io::no_error_bits);
return f;
}
inline boost::format fmt(const std::string& f_string) {
boost::format f(f_string);
f.exceptions(boost::io::no_error_bits);
return f;
}
// wrapper
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# ifdef CnoidUtil_EXPORTS
__declspec(dllexport) const char* getText(const char* domainname, const char* msgid);
# else
__declspec(dllimport) const char* getText(const char* domainname, const char* msgid);
# endif
#else
const char* getText(const char* domainname, const char* msgid);
#endif
}
#cmakedefine01 CNOID_ENABLE_GETTEXT
#if CNOID_ENABLE_GETTEXT
#include <libintl.h>
#ifdef CNOID_USE_GETTEXT_WRAPPER
#define _(text) cnoid::getText(CNOID_GETTEXT_DOMAIN_NAME, text)
#else
#define _(text) dgettext(CNOID_GETTEXT_DOMAIN_NAME, text)
#endif
#define N_(string) string
#else
namespace cnoid {
inline const char* bindtextdomain(const char* domainname, const char* dirname) {
return dirname;
}
inline const char* dgettext(const char* domainname, const char* msgid){
return msgid;
}
}
#define _(string) string
#define N_(string) string
#endif