void LanguageManager::initFromContext(const ApplicationContext& ctx) { // Initialise these members _languageSettingFile = ctx.getSettingsPath() + LANGUAGE_SETTING_FILE; _curLanguage = loadLanguageSetting(); rMessage() << "Current language setting: " << _curLanguage << std::endl; // No handling of POSIX needed, since we don't use the LanguageManager on // POSIX _i18nPath = os::standardPathWithSlash( ctx.getApplicationPath() + "i18n" ); // Set the LANG environment. As GLIB/GTK+ (in Win32) is using its own C // runtime, we need to call their GLIB setenv function for the environment // variable to take effect. g_setenv("LANG", _curLanguage.c_str(), TRUE); // Tell glib to load stuff from the given i18n path bindtextdomain(GETTEXT_PACKAGE, _i18nPath.c_str()); // set encoding to utf-8 to prevent errors for Windows bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); }
void LanguageManager::initFromContext(const ApplicationContext& ctx) { // Initialise these members _languageSettingFile = ctx.getSettingsPath() + LANGUAGE_SETTING_FILE; _curLanguage = loadLanguageSetting(); rMessage() << "Current language setting: " << _curLanguage << std::endl; // No handling of POSIX needed, since we don't use the LanguageManager on // POSIX _i18nPath = os::standardPathWithSlash( ctx.getApplicationPath() + "i18n" ); wxFileTranslationsLoader::AddCatalogLookupPathPrefix(_i18nPath); // Keep locale set to "C" for faster stricmp in Windows builds _wxLocale.reset(new wxLocale(_curLanguage, _curLanguage, "C")); _wxLocale->AddCatalog(GETTEXT_PACKAGE); }