Localization settings are read from configuration now

This commit is contained in:
Simon Rozman 2016-03-12 15:49:17 +01:00
parent b82e4e9b22
commit 690109c5a6
3 changed files with 15 additions and 7 deletions

View File

@ -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[] =

View File

@ -29,6 +29,7 @@
#include <wx/app.h>
#include <wx/cmdline.h>
#include <wx/config.h>
#include <wx/intl.h>
#include <wxex/common.h>

View File

@ -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"