diff -uNr ufoai/src/client/cl_language.c ufoai-new/src/client/cl_language.c --- ufoai/src/client/cl_language.c 2007-09-27 01:15:28 +0400 +++ ufoai-new/src/client/cl_language.c 2007-10-02 12:27:53 +0400 @@ -28,6 +28,10 @@ #include "client.h" +#ifndef LOCALESDIR +# define LOCALESDIR "/usr/share/locale" +#endif + /** * @brief List of all mappings for a locale */ @@ -133,17 +137,17 @@ if (*fs_i18ndir->string) Q_strncpyz(languagePath, fs_i18ndir->string, sizeof(languagePath)); else - Com_sprintf(languagePath, sizeof(languagePath), "%s/base/i18n/", FS_GetCwd()); + Com_sprintf(languagePath, sizeof(languagePath), LOCALESDIR, FS_GetCwd()); Com_DPrintf(DEBUG_CLIENT, "Sys_TestLanguage()... using mo files from %s\n", languagePath); Q_strcat(languagePath, localeID, sizeof(languagePath)); Q_strcat(languagePath, "/LC_MESSAGES/ufoai.mo", sizeof(languagePath)); #ifdef _WIN32 if ((Q_putenv("LANGUAGE", localeID) == 0) && FS_FileExists(languagePath)) { - Com_DPrintf(DEBUG_CLIENT, "CL_LanguageTest()... locale %s found.\n", localeID); + Com_DPrintf(DEBUG_CLIENT, "CL_LanguageTest()... locale %s in %s found.\n", localeID, LOCALE); return qtrue; } else { - Com_DPrintf(DEBUG_CLIENT, "CL_LanguageTest()... locale %s not found.\n", localeID); + Com_DPrintf(DEBUG_CLIENT, "CL_LanguageTest()... locale %s in %s not found.\n", localeID, LOCALESDIR); return qfalse; } #else @@ -152,7 +156,7 @@ break; } if (i == languageCount) { - Com_DPrintf(DEBUG_CLIENT, "Could not find locale with id '%s'\n", localeID); + Com_DPrintf(DEBUG_CLIENT, "Could not find locale with id '%s' in %s \n", localeID, LOCALESDIR); return qfalse; } diff -uNr ufoai/src/client/cl_main.c ufoai-new/src/client/cl_main.c --- ufoai/src/client/cl_main.c 2007-09-29 16:37:52 +0400 +++ ufoai-new/src/client/cl_main.c 2007-10-02 12:53:19 +0400 @@ -30,6 +30,11 @@ #include "cl_global.h" #include "../shared/infostring.h" +#ifndef LOCALESDIR +# define LOCALESDIR "/usr/share/locale" +#endif + + cvar_t *cl_isometric; cvar_t *rcon_client_password; @@ -2430,6 +2435,8 @@ * * @sa CL_Init */ + + static qboolean CL_LocaleSet (void) { char *locale; @@ -2450,11 +2457,11 @@ #endif /* _WIN32 */ /* set to system default */ - setlocale(LC_ALL, "C"); + setlocale(LC_ALL, ""); locale = setlocale(LC_MESSAGES, s_language->string); if (!locale) { Com_DPrintf(DEBUG_CLIENT, "...could not set to language: %s\n", s_language->string); - locale = setlocale(LC_MESSAGES, ""); + locale = setlocale(LC_MESSAGES, "C"); if (!locale) { Com_DPrintf(DEBUG_CLIENT, "...could not set to system language\n"); return qfalse; @@ -2482,18 +2489,18 @@ fs_i18ndir = Cvar_Get("fs_i18ndir", "", 0, "System path to language files"); /* i18n through gettext */ - setlocale(LC_ALL, "C"); - setlocale(LC_MESSAGES, ""); + setlocale(LC_ALL, ""); + setlocale(LC_MESSAGES, ""); /* use system locale dir if we can't find in gamedir */ if (*fs_i18ndir->string) Q_strncpyz(languagePath, fs_i18ndir->string, sizeof(languagePath)); else - Com_sprintf(languagePath, sizeof(languagePath), "%s/base/i18n/", FS_GetCwd()); + Com_sprintf(languagePath, sizeof(languagePath), LOCALESDIR, FS_GetCwd()); Com_DPrintf(DEBUG_CLIENT, "...using mo files from %s\n", languagePath); - bindtextdomain(TEXT_DOMAIN, languagePath); - bind_textdomain_codeset(TEXT_DOMAIN, "UTF-8"); + bindtextdomain(TEXT_DOMAIN, languagePath); + bind_textdomain_codeset(TEXT_DOMAIN, "UTF-8"); /* load language file */ - textdomain(TEXT_DOMAIN); + textdomain(TEXT_DOMAIN); CL_LocaleSet();