Localization setup modified
This commit is contained in:
parent
3e3e311a62
commit
5edfe17fae
@ -27,13 +27,29 @@
|
||||
wxIMPLEMENT_APP(ZRColaApp);
|
||||
|
||||
|
||||
ZRColaApp::ZRColaApp() :
|
||||
m_config(wxT(ZRCOLA_CFG_APPLICATION), wxT(ZRCOLA_CFG_VENDOR)),
|
||||
wxApp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool ZRColaApp::OnInit()
|
||||
{
|
||||
if (!wxAppEx::OnInit())
|
||||
if (!wxApp::OnInit())
|
||||
return false;
|
||||
|
||||
if (wxLocale::IsAvailable(wxLANGUAGE_SLOVENIAN))
|
||||
// Set desired locale.
|
||||
wxLanguage language = (wxLanguage)m_config.Read(wxT("Language"), wxLANGUAGE_DEFAULT);
|
||||
if (wxLocale::IsAvailable(language)) {
|
||||
wxString sPath;
|
||||
if (m_config.Read(wxT("LocalizationRepositoryPath"), &sPath))
|
||||
m_locale.AddCatalogLookupPathPrefix(sPath);
|
||||
wxVERIFY(m_locale.Init(language));
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("wxExtend")));
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("ZRColaCompile")));
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("ZRCola")));
|
||||
}
|
||||
|
||||
wxZRColaFrame* mainFrame = new wxZRColaFrame();
|
||||
|
||||
|
@ -25,15 +25,19 @@ class ZRColaApp;
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wxex/appex.h>
|
||||
#include <wx/app.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/intl.h>
|
||||
|
||||
|
||||
///
|
||||
/// ZRCola application
|
||||
///
|
||||
class ZRColaApp : public wxAppEx
|
||||
class ZRColaApp : public wxApp
|
||||
{
|
||||
public:
|
||||
ZRColaApp();
|
||||
|
||||
///
|
||||
/// Called when application initializes.
|
||||
///
|
||||
@ -41,6 +45,10 @@ public:
|
||||
/// - true if initialization succeeded
|
||||
/// - false otherwise
|
||||
virtual bool OnInit();
|
||||
|
||||
protected:
|
||||
wxConfig m_config; ///< Application configuration
|
||||
wxLocale m_locale; ///< Current locale
|
||||
};
|
||||
|
||||
|
||||
|
@ -150,13 +150,14 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
|
||||
// Set desired locale.
|
||||
wxLocale locale;
|
||||
{
|
||||
wxLanguage language = (wxLanguage)config.Read(wxT("Language"), wxLANGUAGE_DEFAULT);
|
||||
if (wxLocale::IsAvailable(language)) {
|
||||
wxString sPath;
|
||||
if (config.Read(wxT("LocalizationRepositoryPath"), &sPath))
|
||||
locale.AddCatalogLookupPathPrefix(sPath);
|
||||
wxVERIFY(locale.Init(language));
|
||||
wxVERIFY(locale.AddCatalog(wxT("ZRColaCompile")));
|
||||
}
|
||||
wxVERIFY(locale.Init(config.Read(wxT("Language"), wxLANGUAGE_DEFAULT)));
|
||||
wxVERIFY(locale.AddCatalog(wxT("ZRColaCompile")));
|
||||
|
||||
// Parse command line.
|
||||
static const wxCmdLineEntryDesc cmdLineDesc[] =
|
||||
|
Loading…
x
Reference in New Issue
Block a user