Fixed GetInfo to use the current language.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51135 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2008-01-09 15:54:42 +00:00
parent 51d48f09cf
commit 1b7e34be56
2 changed files with 28 additions and 14 deletions

View File

@@ -93,8 +93,8 @@ Major new features in 2.8 release
All: All:
- Fixed bug with parsing some dates in wxDateTime (Bob Pesner) - Fixed bug with parsing some dates in wxDateTime (Bob Pesner).
- Fixed bug with parsing negative time zones in wxDateTime::ParseRfc822Date() - Fixed bug with parsing negative time zones in wxDateTime::ParseRfc822Date().
All (GUI): All (GUI):
@@ -107,8 +107,9 @@ All (GUI):
- wxNotebook RTTI corrected, so now wxDynamicCast(notebook, wxBookCtrlBase) - wxNotebook RTTI corrected, so now wxDynamicCast(notebook, wxBookCtrlBase)
works. works.
- When focus is set to wxScrolledWindow child, scroll it into view. - When focus is set to wxScrolledWindow child, scroll it into view.
- Improve wximage::ResampleBox() (Mihai Ciocarlie) - Improve wximage::ResampleBox() (Mihai Ciocarlie).
- Implemented ScrollList() in generic wxListCtrl (Tim Kosse) - Implemented ScrollList() in generic wxListCtrl (Tim Kosse).
- SaveAs in docview takes into account path now.
All (Unix): All (Unix):
@@ -117,13 +118,14 @@ All (Unix):
wxMSW: wxMSW:
- Fix rare bug with messages delivered to wrong wxSocket (Tim Kosse) - Fix rare bug with messages delivered to wrong wxSocket (Tim Kosse).
- Fix setting icons when they have non-default (16*16 and 32*32) sizes - Fix setting icons when they have non-default (16*16 and 32*32) sizes.
- Fixed wxLocale::GetInfo to use the C locale.
wxGTK: wxGTK:
- Return false from wxEventLoop::Dispatch() if gtk_main_quit() was called and - Return false from wxEventLoop::Dispatch() if gtk_main_quit() was called and
so the loop should exit (Rodolfo Schulz de Lima) so the loop should exit (Rodolfo Schulz de Lima).
2.8.7 2.8.7

View File

@@ -2739,8 +2739,8 @@ bool wxLocale::IsAvailable(int lang)
return false; return false;
#elif defined(__UNIX__) #elif defined(__UNIX__)
// Test if setting the locale works, then set it back. // Test if setting the locale works, then set it back.
wxMB2WXbuf oldLocale = wxSetlocale(LC_ALL, wxEmptyString); wxMB2WXbuf oldLocale = wxSetlocale(LC_ALL, wxEmptyString);
wxMB2WXbuf tmp = wxSetlocaleTryUTF(LC_ALL, info->CanonicalName); wxMB2WXbuf tmp = wxSetlocaleTryUTF(LC_ALL, info->CanonicalName);
if ( !tmp ) if ( !tmp )
@@ -2751,8 +2751,8 @@ bool wxLocale::IsAvailable(int lang)
return false; return false;
} }
// restore the original locale // restore the original locale
wxSetlocale(LC_ALL, oldLocale); wxSetlocale(LC_ALL, oldLocale);
#endif #endif
return true; return true;
} }
@@ -2818,6 +2818,18 @@ bool wxLocale::AddCatalog(const wxChar *szDomain,
/* static */ /* static */
wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat)) wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
{ {
wxUint32 lcid = LOCALE_USER_DEFAULT;
if (wxGetLocale())
{
const wxLanguageInfo *info = GetLanguageInfo(wxGetLocale()->GetLanguage());
if (info)
{ ;
lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang),
SORT_DEFAULT);
}
}
wxString str; wxString str;
wxChar buffer[256]; wxChar buffer[256];
size_t count; size_t count;
@@ -2825,7 +2837,7 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
switch (index) switch (index)
{ {
case wxLOCALE_DECIMAL_POINT: case wxLOCALE_DECIMAL_POINT:
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buffer, 256); count = ::GetLocaleInfo(lcid, LOCALE_SDECIMAL, buffer, 256);
if (!count) if (!count)
str << wxT("."); str << wxT(".");
else else
@@ -2833,14 +2845,14 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
break; break;
#if 0 #if 0
case wxSYS_LIST_SEPARATOR: case wxSYS_LIST_SEPARATOR:
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, buffer, 256); count = ::GetLocaleInfo(lcid, LOCALE_SLIST, buffer, 256);
if (!count) if (!count)
str << wxT(","); str << wxT(",");
else else
str << buffer; str << buffer;
break; break;
case wxSYS_LEADING_ZERO: // 0 means no leading zero, 1 means leading zero case wxSYS_LEADING_ZERO: // 0 means no leading zero, 1 means leading zero
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, buffer, 256); count = ::GetLocaleInfo(lcid, LOCALE_ILZERO, buffer, 256);
if (!count) if (!count)
str << wxT("0"); str << wxT("0");
else else