This function can be used for all GetInfo() items, so using it is simpler than the code in the Unix version of wxLocale::GetInfo() which uses either it or localeconv(), and there should be no real drawbacks to using it nowadays as it should be available everywhere. No real changes yet.
37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
///////////////////////////////////////////////////////////////////////////////
|
|
// 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);
|
|
|
|
// Extract date format from D_T_FMT value.
|
|
wxString wxGetDateFormatOnly(const wxString& fmt);
|
|
|
|
#endif // _WX_UNIX_PRIVATE_UILOCALE_H_
|