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