forked from termux/termux-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libintl.h
53 lines (42 loc) · 1.57 KB
/
libintl.h
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
#ifndef _LIBINTL_H
#define _LIBINTL_H
#include <errno.h>
#include <string.h>
static __inline__ char* gettext(const char* msgid)
{ return (char*) msgid; }
static __inline__ char* dgettext(const char* domainname, const char* msgid)
{ return (char*) msgid; }
static __inline__ char* dcgettext(const char* domainname, const char* msgid, int category)
{ return (char*) msgid; }
static __inline__ char* ngettext(const char* msgid1, const char* msgid2, unsigned long int n)
{ return (char *) ((n == 1) ? msgid1 : msgid2); }
static __inline__ char* dngettext(const char* domainname, const char* msgid1, const char* msgid2, unsigned long int n)
{ return (char *) ((n == 1) ? msgid1 : msgid2); }
static __inline__ char* dcngettext(const char* domainname, const char* msgid1, const char* msgid2, unsigned long int n, int category)
{ return (char *) ((n == 1) ? msgid1 : msgid2); }
static __inline__ char* textdomain(const char* domainname)
{
static const char default_str[] = "messages";
if (domainname && *domainname && strcmp(domainname, default_str)) {
errno = EINVAL;
return NULL;
}
return (char*) default_str;
}
static __inline__ char* bindtextdomain(const char* domainname, const char* dirname)
{
static const char dir[] = "/";
if (!domainname || !*domainname || (dirname && ((dirname[0] != '/') || dirname[1]))) {
errno = EINVAL;
return NULL;
}
return (char*) dir;
}
static __inline__ char* bind_textdomain_codeset(const char* domainname, const char* codeset)
{
if (!domainname || !*domainname || (codeset && strcasecmp(codeset, "UTF-8"))) {
errno = EINVAL;
}
return NULL;
}
#endif