wxInitializeLocale() upgraded to optionally return UI language

This commit is contained in:
Simon Rozman 2016-10-18 11:00:11 +02:00
parent b644d08eac
commit 90a48ae7ce

View File

@ -132,12 +132,13 @@ inline bool wxModifyStyleEx(_In_ WXHWND hWnd, _In_ DWORD dwRemove, _In_ DWORD dw
/// The path to folder containing localization catalogue PO files is read from `LocalizationRepositoryPath` configuration string. /// The path to folder containing localization catalogue PO files is read from `LocalizationRepositoryPath` configuration string.
/// ///
/// \param[inout] locale Locale to initialize /// \param[inout] locale Locale to initialize
/// \param[out ] language Translation language
/// ///
/// \returns /// \returns
/// - \c true when initialization succeeded /// - \c true when initialization succeeded
/// - \c false otherwise /// - \c false otherwise
/// ///
inline bool wxInitializeLocale(wxLocale &locale) inline bool wxInitializeLocale(wxLocale &locale, wxLanguage *language = NULL)
{ {
// Read language from configuration. // Read language from configuration.
wxLanguage lang_code; wxLanguage lang_code;
@ -148,6 +149,9 @@ inline bool wxInitializeLocale(wxLocale &locale)
} else } else
lang_code = wxLANGUAGE_DEFAULT; lang_code = wxLANGUAGE_DEFAULT;
if (language)
*language = lang_code;
if (wxLocale::IsAvailable(lang_code)) { if (wxLocale::IsAvailable(lang_code)) {
// Language is "available". Well... Known actually. // Language is "available". Well... Known actually.
wxString sPath; wxString sPath;