From: <au...@us...> - 2009-08-30 19:57:57
|
Revision: 3966 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=3966&view=rev Author: auria Date: 2009-08-30 19:57:51 +0000 (Sun, 30 Aug 2009) Log Message: ----------- Tweaked i18n code to at least handle latin-1 characters, potentially fixed compilation with gettext off Modified Paths: -------------- main/branches/irrlicht/src/utils/translation.cpp main/branches/irrlicht/src/utils/translation.hpp Modified: main/branches/irrlicht/src/utils/translation.cpp =================================================================== --- main/branches/irrlicht/src/utils/translation.cpp 2009-08-30 19:19:25 UTC (rev 3965) +++ main/branches/irrlicht/src/utils/translation.cpp 2009-08-30 19:57:51 UTC (rev 3966) @@ -43,6 +43,8 @@ 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* 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; } Modified: main/branches/irrlicht/src/utils/translation.hpp =================================================================== --- main/branches/irrlicht/src/utils/translation.hpp 2009-08-30 19:19:25 UTC (rev 3965) +++ main/branches/irrlicht/src/utils/translation.hpp 2009-08-30 19:57:51 UTC (rev 3966) @@ -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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |