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