gettext-free internationalisation works now

This commit is contained in:
darkrose 2015-04-12 15:35:54 +10:00
parent 88309b16df
commit 93e199429e
1 changed files with 2 additions and 6 deletions

View File

@ -692,22 +692,18 @@ wchar_t *mb2wc(const char *src)
memset(&state, '\0', sizeof (state)); memset(&state, '\0', sizeof (state));
wchar_t *buff = new wchar_t[l]; wchar_t *buff = new wchar_t[l];
size_t n = mbsrtowcs(buff, &src, l, &state); size_t n = mbsrtowcs(buff, &src, l, &state);
printf("%ld\n",(int64_t)n);
buff[n] = L'\0'; buff[n] = L'\0';
return buff; return buff;
} }
wchar_t* wgettext(const char *str) wchar_t* wgettext(const char *str)
{ {
char* s = intl_lookup(&intl,(char*)str,NULL); return mb2wc(intl_lookup(&intl,(char*)str,NULL));
printf("%s\n",s);
return mb2wc(s);
} }
wchar_t* wngettext(const char *str1, const char *str2, int n) wchar_t* wngettext(const char *str1, const char *str2, int n)
{ {
char* s = intl_nlookup(&intl,(char*)str1,(char*)str2,n); return mb2wc(intl_nlookup(&intl,(char*)str1,(char*)str2,n));
return mb2wc(s);
} }
void init_gettext() void init_gettext()