String localization implemented (missing some strings)
This commit is contained in:
@@ -22,19 +22,6 @@ 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);
|
||||
@@ -49,6 +36,8 @@ wxUI::~wxUI()
|
||||
|
||||
bool wxUI::SetLanguage(long language)
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
if (_locale) delete _locale;
|
||||
_locale = NULL;
|
||||
|
||||
@@ -63,16 +52,39 @@ bool wxUI::SetLanguage(long language)
|
||||
|
||||
_locale->AddCatalog(wxT("french"));
|
||||
_locale->AddCatalog(wxT("kisscount"));
|
||||
|
||||
_language = (wxLanguage) language;
|
||||
}
|
||||
|
||||
if ((_locale == NULL || !_locale->IsOk()) && wxLocale::IsAvailable(wxLANGUAGE_ENGLISH))
|
||||
if (_locale == NULL || !_locale->IsOk())
|
||||
{
|
||||
if (_locale) delete _locale;
|
||||
_locale = new wxLocale( wxLANGUAGE_ENGLISH );
|
||||
return false;
|
||||
_locale = new wxLocale();
|
||||
|
||||
#ifdef __WXGTK__
|
||||
_locale->AddCatalogLookupPathPrefix(wxT("./ressources/po"));
|
||||
#endif
|
||||
|
||||
_locale->AddCatalog(wxT("kisscount"));
|
||||
|
||||
_language = wxLANGUAGE_ENGLISH;
|
||||
res = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
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") ;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void wxUI::ShowAccount()
|
||||
@@ -93,6 +105,8 @@ void wxUI::ChangeUser()
|
||||
|
||||
void wxUI::LoadUser()
|
||||
{
|
||||
User* user = _kiss->GetUser();
|
||||
|
||||
if (_curPanel)
|
||||
{
|
||||
_hbox->Detach(_curPanel);
|
||||
@@ -105,6 +119,9 @@ void wxUI::LoadUser()
|
||||
if (_preferencesPanel)
|
||||
delete _preferencesPanel;
|
||||
|
||||
if (user->_preferences[wxT("language")] != wxT(""))
|
||||
SetLanguage(user->GetLanguage());
|
||||
|
||||
_preferencesPanel = new PreferencesPanel(_kiss, this);
|
||||
_accountPanel = new AccountPanel(_kiss, this);
|
||||
|
||||
@@ -113,7 +130,8 @@ void wxUI::LoadUser()
|
||||
|
||||
void wxUI::ShowPanel(wxPanel* panel)
|
||||
{
|
||||
int month, year;
|
||||
int month, year, account=0, preferences=0;
|
||||
wxShowEvent event;
|
||||
|
||||
if (!panel) return;
|
||||
|
||||
@@ -122,14 +140,40 @@ void wxUI::ShowPanel(wxPanel* panel)
|
||||
_hbox->Detach(_curPanel);
|
||||
_curPanel->Hide();
|
||||
}
|
||||
|
||||
if (panel == _accountPanel && _needReload)
|
||||
|
||||
if (_needReload)
|
||||
{
|
||||
month = _accountPanel->_curMonth;
|
||||
year = _accountPanel->_curYear;
|
||||
delete _accountPanel;
|
||||
panel = _accountPanel = new AccountPanel(_kiss, this);
|
||||
_accountPanel->ShowMonth(month, year);
|
||||
if (panel == _accountPanel)
|
||||
{
|
||||
account = 1;
|
||||
month = _accountPanel->_curMonth;
|
||||
year = _accountPanel->_curYear;
|
||||
}
|
||||
|
||||
if (panel == _preferencesPanel)
|
||||
{
|
||||
preferences = 1;
|
||||
}
|
||||
|
||||
delete _accountPanel;
|
||||
delete _preferencesPanel;
|
||||
|
||||
_accountPanel = new AccountPanel(_kiss, this);
|
||||
if (year != -1)
|
||||
_accountPanel->ShowMonth(month, year);
|
||||
_preferencesPanel = new PreferencesPanel(_kiss, this);
|
||||
|
||||
if (account)
|
||||
{
|
||||
_accountPanel->OnShow(event);
|
||||
panel = _accountPanel;
|
||||
}
|
||||
if (preferences)
|
||||
{
|
||||
_preferencesPanel->OnShow(event);
|
||||
panel = _preferencesPanel;
|
||||
}
|
||||
|
||||
_needReload = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user