Move platform-specific parts of wxLocale::Init() to wxUILocale
This is tidier than using #ifdefs in the same common file and also ensures that initializing wxLocale affects wxUILocale too, which will be important for compatibility when the code elsewhere is modified to use wxUILocale::GetInfo() instead of wxLocale::GetInfo() in the upcoming commits. This commit is best viewed with --color-moved git option.
This commit is contained in:
33
include/wx/unix/private/uilocale.h
Normal file
33
include/wx/unix/private/uilocale.h
Normal file
@@ -0,0 +1,33 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/unix/private/uilocale.h
|
||||
// Purpose: Various locale-related helpers used under Unix systems only
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2021-08-14 (extracted from src/common/intl.cpp)
|
||||
// Copyright: (c) 2021 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIX_PRIVATE_UILOCALE_H_
|
||||
#define _WX_UNIX_PRIVATE_UILOCALE_H_
|
||||
|
||||
#include "wx/string.h"
|
||||
|
||||
// get just the language part ("en" in "en_GB")
|
||||
inline wxString ExtractLang(const wxString& langFull)
|
||||
{
|
||||
return langFull.BeforeFirst('_');
|
||||
}
|
||||
|
||||
// get everything else (including the leading '_')
|
||||
inline wxString ExtractNotLang(const wxString& langFull)
|
||||
{
|
||||
size_t pos = langFull.find('_');
|
||||
if ( pos != wxString::npos )
|
||||
return langFull.substr(pos);
|
||||
else
|
||||
return wxString();
|
||||
}
|
||||
|
||||
const char *wxSetlocaleTryAll(int c, const wxString& lc);
|
||||
|
||||
#endif // _WX_UNIX_PRIVATE_UILOCALE_H_
|
Reference in New Issue
Block a user