about summary refs log tree commit diff
path: root/src/locale/intl.c
blob: 964f7da19482f43bdda13e02f750a68ce1109363 (plain) (blame)
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
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <errno.h>

char *gettext(const char *msgid)
{
	return (char *) msgid;
}

char *dgettext(const char *domainname, const char *msgid)
{
	return (char *) msgid;
}

char *dcgettext(const char *domainname, const char *msgid, int category)
{
	return (char *) msgid;
}

char *ngettext(const char *msgid1, const char *msgid2, unsigned long int n)
{
	return (char *) ((n == 1) ? msgid1 : msgid2);
}

char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n)
{
	return (char *) ((n == 1) ? msgid1 : msgid2);
}

char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category)
{
	return (char *) ((n == 1) ? msgid1 : msgid2);
}

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;
}

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;
}

char *bind_textdomain_codeset(const char *domainname, const char *codeset)
{
	if (!domainname || !*domainname || (codeset && strcasecmp(codeset, "UTF-8"))) {
		errno = EINVAL;
	}
	return NULL;
}