From 3cab0a45a928b5951a1bfabbf399a83ab87633a2 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Wed, 5 Oct 2016 12:29:40 +0200 Subject: [PATCH] Locale is set using wxExtend's wxInitializeLocale() helper function now --- UpdCheck/main.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/UpdCheck/main.cpp b/UpdCheck/main.cpp index 80a3deb..ab9f4a6 100644 --- a/UpdCheck/main.cpp +++ b/UpdCheck/main.cpp @@ -32,6 +32,18 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In if (!initializer.IsOk()) return -1; + // Initialize configuration. + wxConfigBase *cfgPrev = wxConfigBase::Set(new wxConfig(wxT(UPDATER_CFG_APPLICATION) wxT("\\Updater"), wxT(UPDATER_CFG_VENDOR))); + if (cfgPrev) wxDELETE(cfgPrev); + + // Initialize locale. + wxLocale locale; + if (wxInitializeLocale(locale)) { + // Do not add translation catalog, to keep log messages in English. + // Log files are for help-desk and should remain globally intelligible. + //wxVERIFY(locale.AddCatalog(wxT("Updater") wxT(wxExtendVersion))); + } + // Create output folder. wxString path(wxFileName::GetTempDir()); if (!wxEndsWithPathSeparator(path)) @@ -44,17 +56,6 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In if (log_file.IsOpened()) delete wxLog::SetActiveTarget(new wxLogStderr(log_file.fp())); - // Set desired locale. - wxConfig config(wxT(UPDATER_CFG_APPLICATION) wxT("\\Updater"), wxT(UPDATER_CFG_VENDOR)); - wxLanguage language = (wxLanguage)config.Read(wxT("Language"), wxLANGUAGE_DEFAULT); - wxLocale locale; - if (wxLocale::IsAvailable(language)) { - wxVERIFY(locale.Init(language)); - // Do not add translation catalog, to keep log messages in English. - // Log files are for help-desk and should remain globally intelligible. - //wxVERIFY(locale.AddCatalog(wxT("Updater") wxT(wxExtendVersion))); - } - wxUpdCheckThread worker(locale.GetCanonicalName()); wxUpdCheckThread::wxResult res = worker.CheckForUpdate(); switch (res) {