From 690109c5a69b2e5dc89a02f2dfd2da4a218bf87c Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Sat, 12 Mar 2016 15:49:17 +0100 Subject: [PATCH] Localization settings are read from configuration now --- ZRColaCompile/main.cpp | 15 ++++++++------- ZRColaCompile/stdafx.h | 1 + include/zrcola.h | 6 ++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ZRColaCompile/main.cpp b/ZRColaCompile/main.cpp index 3874d76..b64a731 100644 --- a/ZRColaCompile/main.cpp +++ b/ZRColaCompile/main.cpp @@ -146,16 +146,17 @@ int _tmain(int argc, _TCHAR *argv[]) return -1; } + wxConfig config(wxT(ZRCOLA_CFG_APPLICATION), wxT(ZRCOLA_CFG_VENDOR)); + // Set desired locale. - // TODO: Check user language setting and select the language accordingly. wxLocale locale; - if (wxLocale::IsAvailable(wxLANGUAGE_SLOVENIAN)) { - wxString sPath(wxPathOnly(argv[0])); - sPath << wxT("\\..\\locale"); - locale.AddCatalogLookupPathPrefix(sPath); - wxVERIFY(locale.Init(wxLANGUAGE_SLOVENIAN)); - wxVERIFY(locale.AddCatalog(wxT("ZRColaCompile"))); + { + wxString sPath; + if (config.Read(wxT("LocalizationRepositoryPath"), &sPath)) + locale.AddCatalogLookupPathPrefix(sPath); } + wxVERIFY(locale.Init(config.Read(wxT("Language"), wxLANGUAGE_DEFAULT))); + wxVERIFY(locale.AddCatalog(wxT("ZRColaCompile"))); // Parse command line. static const wxCmdLineEntryDesc cmdLineDesc[] = diff --git a/ZRColaCompile/stdafx.h b/ZRColaCompile/stdafx.h index c54b8ce..a970775 100644 --- a/ZRColaCompile/stdafx.h +++ b/ZRColaCompile/stdafx.h @@ -29,6 +29,7 @@ #include #include +#include #include #include diff --git a/include/zrcola.h b/include/zrcola.h index 2168c5a..9ad498c 100644 --- a/include/zrcola.h +++ b/include/zrcola.h @@ -53,3 +53,9 @@ // Replace with new on every version change, regardless how minor it is. // #define ZRCOLA_VERSION_GUID "{F0ECB49B-1EF8-487F-9BE3-B0CC3CADE8AE}" + +// +// The product vendor and application name for configuration keeping. +// +#define ZRCOLA_CFG_VENDOR "Amebis" +#define ZRCOLA_CFG_APPLICATION "ZRCola"