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
|
int Language; // wxLanguage id
|
||||||
wxString CanonicalName; // Canonical name, e.g. fr_FR
|
wxString CanonicalName; // Canonical name, e.g. fr_FR
|
||||||
#ifdef __WIN32__
|
#ifdef __WXMSW__
|
||||||
wxUint32 WinLang, // Win32 language identifiers
|
wxUint32 WinLang, // Win32 language identifiers
|
||||||
WinSublang;
|
WinSublang;
|
||||||
#endif // __WIN32__
|
#endif // __WXMSW__
|
||||||
wxString Description; // human-readable name of the language
|
wxString Description; // human-readable name of the language
|
||||||
wxLayoutDirection LayoutDirection;
|
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
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxLanguageInfo
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
|
||||||
|
wxUint32 wxLanguageInfo::GetLCID() const
|
||||||
|
{
|
||||||
|
return MAKELCID(MAKELANGID(WinLang, WinSublang), SORT_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxMsgCatalogFile class
|
// wxMsgCatalogFile class
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -1812,8 +1825,8 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
= -1
|
= -1
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
wxUint32 lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang),
|
const wxUint32 lcid = info->GetLCID();
|
||||||
SORT_DEFAULT);
|
|
||||||
// FIXME
|
// FIXME
|
||||||
#ifndef __WXWINCE__
|
#ifndef __WXWINCE__
|
||||||
SetThreadLocale(lcid);
|
SetThreadLocale(lcid);
|
||||||
@ -2510,12 +2523,7 @@ bool wxLocale::IsAvailable(int lang)
|
|||||||
if ( !info->WinLang )
|
if ( !info->WinLang )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( !::IsValidLocale
|
if ( !::IsValidLocale(info->GetLCID(), LCID_INSTALLED) )
|
||||||
(
|
|
||||||
MAKELCID(MAKELANGID(info->WinLang, info->WinSublang),
|
|
||||||
SORT_DEFAULT),
|
|
||||||
LCID_INSTALLED
|
|
||||||
) )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
@ -2603,11 +2611,8 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
|
|||||||
if (wxGetLocale())
|
if (wxGetLocale())
|
||||||
{
|
{
|
||||||
const wxLanguageInfo *info = GetLanguageInfo(wxGetLocale()->GetLanguage());
|
const wxLanguageInfo *info = GetLanguageInfo(wxGetLocale()->GetLanguage());
|
||||||
if (info)
|
if ( info )
|
||||||
{ ;
|
lcid = info->GetLCID();
|
||||||
lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang),
|
|
||||||
SORT_DEFAULT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString str;
|
wxString str;
|
||||||
|
Loading…
Reference in New Issue
Block a user