mmg: Get default locale if none has been selected yet

Get the default locale if none has been saved yet so that the preferences
dialog shows the correct one as selected. Do not compile the locale code
if libintl.h is not available. Add debug output for the language selection
logic.
This commit is contained in:
Moritz Bunkus 2009-02-11 00:35:44 +01:00
parent 43cf1e2f54
commit e08435900c
2 changed files with 10 additions and 1 deletions

View File

@ -2170,9 +2170,11 @@ END_EVENT_TABLE();
void
mmg_app::init_ui_locale(wxConfigBase *cfg) {
wxString w_locale;
std::string locale;
#if defined(HAVE_LIBINTL_H)
wxString w_locale;
translation_c::initialize_available_translations();
cfg->SetPath(wxT("/GUI"));
@ -2182,7 +2184,11 @@ mmg_app::init_ui_locale(wxConfigBase *cfg) {
locale = "";
}
if (locale.empty())
locale = translation_c::get_default_ui_locale();
m_ui_locale = locale;
#endif // HAVE_LIBINTL_H
init_locales(locale);
}

View File

@ -154,6 +154,9 @@ options_dialog::options_dialog(wxWindow *parent,
++translation;
}
wxLogMessage(wxT("Locale selection logic: select_locale %s uu_locale_lower %s translation_c::get_default_ui_locale() %s app->m_ui_locale %s"),
select_locale.c_str(), wxCS2WS(ui_locale_lower), wxCS2WS(translation_c::get_default_ui_locale()), wxCS2WS(app->m_ui_locale));
std::sort(sorted_entries.begin(), sorted_entries.end());
std::vector<locale_sorter_t>::iterator locale_entry = sorted_entries.begin();