#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <libintl.h>

/*
 * http://sourceware.org/git/?p=glibc.git;a=blob;f=string/_strerror.c
 * http://sourceware.org/git/?p=glibc.git;a=blob;f=include/libintl.h
 *
 * man gettext
 *
 * In both cases, the functions also use the LC_CTYPE locale facet in order to
 * convert the translated message from the translator's codeset to the current
 * locale's codeset, unless overridden by a prior call to the
 * bind_textdomain_codeset function.
 *
 */

int main()
{
	printf("LC_MESSAGES: %s\n", setlocale(LC_MESSAGES, "ru_RU.UTF-8"));
	/* postgres do this at starting */
	printf("LC_CTYPE: %s\n", setlocale(LC_CTYPE, ""));
	/* can be fixed like this, but _libc_intl_domainname is private :( */
	//printf("bind_textdomain_codeset: %s\n", bind_textdomain_codeset(/*_libc_intl_domainname*/"libc", "UTF-8"));
	printf("msg: %s\n", strerror(22));
	return 0;
}
