Tweaked i18n code to at least handle latin-1 characters, potentially fixed compilation with gettext off
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3966 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -43,6 +43,8 @@ Translations::Translations() {
|
||||
setlocale(LC_MESSAGES, "");
|
||||
#endif
|
||||
bindtextdomain (PACKAGE, file_manager->getTranslationDir().c_str());
|
||||
//bind_textdomain_codeset(PACKAGE, "UTF-8");
|
||||
bind_textdomain_codeset(PACKAGE, "iso-8859-1");
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
@@ -53,9 +55,21 @@ wchar_t out_buffer[BUFFER_SIZE];
|
||||
|
||||
wchar_t* w_gettext(const char* original)
|
||||
{
|
||||
#if ENABLE_NLS
|
||||
const char* original_t = gettext(original);
|
||||
#else
|
||||
const char* original_t = original;
|
||||
#endif
|
||||
|
||||
mbstowcs(out_buffer, original_t, BUFFER_SIZE);
|
||||
|
||||
int index = 0;
|
||||
for (const char* c=original_t; *c != 0; c++)
|
||||
{
|
||||
out_buffer[index] = (wchar_t)(unsigned char)*c;
|
||||
index++;
|
||||
}
|
||||
out_buffer[index] = 0;
|
||||
|
||||
//mbstowcs(out_buffer, original_t, BUFFER_SIZE);
|
||||
|
||||
return out_buffer;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
# undef fprintf
|
||||
# endif
|
||||
#else
|
||||
# define _(String) (L##String)
|
||||
# define _(String) w_gettext(String)
|
||||
# define gettext_noop(String) String
|
||||
# define N_(String) String
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user