13#include <winpr/i18n.h>
14#include <winpr/build-config.h>
21int TestI18n(
int argc,
char* argv[])
23 static const char msgid[] =
"WinPR i18n test message";
29 char numericLocale[128] = WINPR_C_ARRAY_INIT;
30 const char* numeric = setlocale(LC_NUMERIC,
"C.UTF-8");
31 if (numeric && (strlen(numeric) <
sizeof(numericLocale)))
32 memcpy(numericLocale, numeric, strlen(numeric) + 1);
34 if (!winpr_i18n_enable_translation(
"C"))
37 if (numericLocale[0] && (strcmp(setlocale(LC_NUMERIC,
nullptr), numericLocale) != 0))
40 if (winpr_i18n_bind_domain(
nullptr,
nullptr))
42 if (!winpr_i18n_bind_domain(
"winpr-test",
nullptr))
45 if (WINPR_INSTALL_LOCALEDIR[0])
47 const char* bound = bindtextdomain(
"winpr-test",
nullptr);
48 if (!bound || (strcmp(bound, WINPR_INSTALL_LOCALEDIR) != 0))
52 const char*
const result = winpr_i18n_dgettext(
"winpr-test", msgid);
53 if (!result || (strcmp(result, msgid) != 0))
55 return strcmp(WINPR_I18N_GETTEXT(
"winpr-test", msgid), msgid) == 0 ? 0 : -1;