about summary refs log tree commit diff
path: root/src/locale/bind_textdomain_codeset.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-07-27 04:29:56 -0400
committerRich Felker <dalias@aerifal.cx>2014-07-27 04:29:56 -0400
commit2068b4e8911a3a49cded44b4568f6c943a8c98f8 (patch)
treed662b28c1a9f87674d0bc25be051a8fb69312316 /src/locale/bind_textdomain_codeset.c
parentc5b8f1930512d206a7c1cf1093a4a47e1722a414 (diff)
downloadmusl-2068b4e8911a3a49cded44b4568f6c943a8c98f8.tar.gz
musl-2068b4e8911a3a49cded44b4568f6c943a8c98f8.tar.xz
musl-2068b4e8911a3a49cded44b4568f6c943a8c98f8.zip
implement gettext message translation functions
this commit replaces the stub implementations with working message
translation functions. translation units are factored so as to prevent
pulling in the legacy, non-library-safe functions which use a global
textdomain in modern code which is using the versions with an explicit
domain argument. bind_textdomain_codeset is also placed in its own
file since it should not be needed by most programs.

this implementation is still missing some features: the LANGUAGE
environment variable (for multiple fallback languages) is not honored,
and non-default plural-form rules are not supported. these issues will
be addressed in a later commit.

one notable difference from the GNU implementation is that there is no
default path for loading translation files. in principle one could be
added, but since the documented correct usage is to call the
bindtextdomain function, a default path is probably unnecessary.
Diffstat (limited to 'src/locale/bind_textdomain_codeset.c')
-rw-r--r--src/locale/bind_textdomain_codeset.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/locale/bind_textdomain_codeset.c b/src/locale/bind_textdomain_codeset.c
new file mode 100644
index 00000000..5ebfd5e8
--- /dev/null
+++ b/src/locale/bind_textdomain_codeset.c
@@ -0,0 +1,11 @@
+#include <libintl.h>
+#include <string.h>
+#include <strings.h>
+#include <errno.h>
+
+char *bind_textdomain_codeset(const char *domainname, const char *codeset)
+{
+	if (codeset && strcasecmp(codeset, "UTF-8"))
+		errno = EINVAL;
+	return NULL;
+}