avoid duplication in the code by refactoring LCID creation from wxLanguageInfo::WinLang and WinSublang in a member function
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51668 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
800f137903
commit
ea65760d5c
@ -321,12 +321,17 @@ struct WXDLLIMPEXP_BASE wxLanguageInfo
|
||||
{
|
||||
int Language; // wxLanguage id
|
||||
wxString CanonicalName; // Canonical name, e.g. fr_FR
|
||||
#ifdef __WIN32__
|
||||
#ifdef __WXMSW__
|
||||
wxUint32 WinLang, // Win32 language identifiers
|
||||
WinSublang;
|
||||
#endif // __WIN32__
|
||||
#endif // __WXMSW__
|
||||
wxString Description; // human-readable name of the language
|
||||
wxLayoutDirection LayoutDirection;
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// return the LCID corresponding to this language
|
||||
wxUint32 GetLCID() const;
|
||||
#endif // __WXMSW__
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -1012,6 +1012,19 @@ static wxArrayString gs_searchPrefixes;
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxLanguageInfo
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
||||
wxUint32 wxLanguageInfo::GetLCID() const
|
||||
{
|
||||
return MAKELCID(MAKELANGID(WinLang, WinSublang), SORT_DEFAULT);
|
||||
}
|
||||
|
||||
#endif // __WXMSW__
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMsgCatalogFile class
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -1812,8 +1825,8 @@ bool wxLocale::Init(int language, int flags)
|
||||
= -1
|
||||
#endif
|
||||
;
|
||||
wxUint32 lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang),
|
||||
SORT_DEFAULT);
|
||||
const wxUint32 lcid = info->GetLCID();
|
||||
|
||||
// FIXME
|
||||
#ifndef __WXWINCE__
|
||||
SetThreadLocale(lcid);
|
||||
@ -2510,12 +2523,7 @@ bool wxLocale::IsAvailable(int lang)
|
||||
if ( !info->WinLang )
|
||||
return false;
|
||||
|
||||
if ( !::IsValidLocale
|
||||
(
|
||||
MAKELCID(MAKELANGID(info->WinLang, info->WinSublang),
|
||||
SORT_DEFAULT),
|
||||
LCID_INSTALLED
|
||||
) )
|
||||
if ( !::IsValidLocale(info->GetLCID(), LCID_INSTALLED) )
|
||||
return false;
|
||||
|
||||
#elif defined(__UNIX__)
|
||||
@ -2603,11 +2611,8 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
|
||||
if (wxGetLocale())
|
||||
{
|
||||
const wxLanguageInfo *info = GetLanguageInfo(wxGetLocale()->GetLanguage());
|
||||
if (info)
|
||||
{ ;
|
||||
lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang),
|
||||
SORT_DEFAULT);
|
||||
}
|
||||
if ( info )
|
||||
lcid = info->GetLCID();
|
||||
}
|
||||
|
||||
wxString str;
|
||||
|
Loading…
Reference in New Issue
Block a user