Choreonoid
1.8
src
Util
GettextUtil.h
Go to the documentation of this file.
1
7
#ifndef CNOID_UTIL_GETTEXT_UTIL_H
8
#define CNOID_UTIL_GETTEXT_UTIL_H
9
10
#include <cnoid/Config>
11
#include "exportdecl.h"
12
13
#ifdef CNOID_ENABLE_GETTEXT
14
# include <libintl.h>
15
16
# ifdef CNOID_USE_GETTEXT_WRAPPER
17
# define _(text) cnoid::getText(CNOID_GETTEXT_DOMAIN_NAME, text)
18
# else
19
# define _(text) dgettext(CNOID_GETTEXT_DOMAIN_NAME, text)
20
# endif
21
22
#else
23
namespace
cnoid
{
24
inline
const
char
*
bindtextdomain
(
const
char
* domainname,
const
char
* dirname) {
25
return
dirname;
26
}
27
inline
const
char
*
dgettext
(
const
char
* domainname,
const
char
* msgid){
28
return
msgid;
29
}
30
}
31
#define _(string) string
32
#endif
33
34
#define N_(string) string
35
36
namespace
cnoid
{
37
38
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
39
CNOID_EXPORT
const
char
*
getText
(
const
char
* domainname,
const
char
* msgid);
40
#else
41
inline
const
char
*
getText
(
const
char
* domainname,
const
char
* msgid) {
42
return
dgettext
(domainname, msgid);
43
}
44
#endif
45
46
CNOID_EXPORT
void
bindGettextDomain
(
const
char
* domainname);
47
48
class
GettextDomainBinder
49
{
50
public
:
51
GettextDomainBinder
(
const
char
* domainname){
52
bindGettextDomain
(domainname);
53
}
54
};
55
56
}
57
62
#define CNOID_BIND_GETTEXT_DOMAN() \
63
namespace { cnoid::GettextDomainBinder cnoidGettextDomainBinder(CNOID_GETTEXT_DOMAIN_NAME); }
64
65
#endif
cnoid::dgettext
const char * dgettext(const char *domainname, const char *msgid)
Definition:
GettextUtil.h:27
cnoid::bindGettextDomain
void bindGettextDomain(const char *domainname)
Definition:
GettextUtil.cpp:29
cnoid::GettextDomainBinder::GettextDomainBinder
GettextDomainBinder(const char *domainname)
Definition:
GettextUtil.h:51
cnoid::getText
const char * getText(const char *domainname, const char *msgid)
Definition:
GettextUtil.h:41
cnoid
Definition:
AbstractSceneLoader.h:11
cnoid::bindtextdomain
const char * bindtextdomain(const char *domainname, const char *dirname)
Definition:
GettextUtil.h:24
cnoid::GettextDomainBinder
Definition:
GettextUtil.h:48
Generated by
1.8.17