Add initial locale support
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#include "wxUI.h"
|
||||
|
||||
wxString months[12] = {_("january"), _("february"), _("march"), _("april"), _("may"), _("june"), _("july"), _("august"), _("september"), _("october"), _("november"), _("december")} ;
|
||||
wxString months[12] ;
|
||||
|
||||
wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame(NULL, -1, title, pos, size), _kiss(kiss), _accountPanel(NULL), _preferencesPanel(NULL), _curPanel(NULL),
|
||||
_needReload(false)
|
||||
_locale(NULL), _needReload(false)
|
||||
{
|
||||
_hbox = new wxBoxSizer(wxVERTICAL);
|
||||
ButtonPanel* buttons = new ButtonPanel(_kiss, this);
|
||||
@@ -22,6 +22,19 @@ wxUI::wxUI(KissCount* kiss, const wxString& title, const wxPoint& pos, const wxS
|
||||
// CreateStatusBar();
|
||||
// SetStatusText( wxT("Welcome to wxWidgets!") );
|
||||
|
||||
months[0] = _("january");
|
||||
months[1] = _("february");
|
||||
months[2] = _("march");
|
||||
months[3] = _("april");
|
||||
months[4] = _("may");
|
||||
months[5] = _("june");
|
||||
months[6] = _("july");
|
||||
months[7] = _("august");
|
||||
months[8] = _("september");
|
||||
months[9] = _("october");
|
||||
months[10] = _("november");
|
||||
months[11] = _("december") ;
|
||||
|
||||
SetSizer(_hbox);
|
||||
|
||||
_hbox->Add(buttons);
|
||||
@@ -31,6 +44,35 @@ wxUI::~wxUI()
|
||||
{
|
||||
if (_accountPanel) delete _accountPanel;
|
||||
if (_preferencesPanel) delete _preferencesPanel;
|
||||
if (_locale) delete _locale;
|
||||
}
|
||||
|
||||
bool wxUI::InitLanguage(long language)
|
||||
{
|
||||
if (_locale) delete _locale;
|
||||
|
||||
// load language if possible, fall back to english otherwise
|
||||
if(wxLocale::IsAvailable(language))
|
||||
{
|
||||
_locale = new wxLocale( language, wxLOCALE_CONV_ENCODING );
|
||||
|
||||
#ifdef __WXGTK__
|
||||
_locale->AddCatalogLookupPathPrefix(wxT("./ressources/po"));
|
||||
#endif
|
||||
|
||||
_locale->AddCatalog(wxT("french"));
|
||||
_locale->AddCatalog(wxT("kisscount"));
|
||||
}
|
||||
|
||||
if ((_locale == NULL || !_locale->IsOk()) && wxLocale::IsAvailable(wxLANGUAGE_ENGLISH))
|
||||
{
|
||||
if (_locale) delete _locale;
|
||||
_locale = new wxLocale( wxLANGUAGE_ENGLISH );
|
||||
language = wxLANGUAGE_ENGLISH;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxUI::ShowAccount()
|
||||
|
||||
Reference in New Issue
Block a user