From 93190d6263ec392bc0be2d978a75eab437e5754b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 6 Aug 2021 00:19:03 +0200 Subject: [PATCH] Interpret empty language as "default" in the internat sample This provides a more convenient way of testing wxLANGUAGE_DEFAULT than selecting it from the dialog shown on startup. This commit is best viewed ignoring whitespace-only changes. --- samples/internat/internat.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/samples/internat/internat.cpp b/samples/internat/internat.cpp index 5502619b53..478d91d391 100644 --- a/samples/internat/internat.cpp +++ b/samples/internat/internat.cpp @@ -215,14 +215,21 @@ bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser) if ( parser.GetParamCount() ) { const wxString loc = parser.GetParam(); - const wxLanguageInfo * const lang = wxLocale::FindLanguageInfo(loc); - if ( !lang ) + if ( loc.empty() ) { - wxLogError(_("Locale \"%s\" is unknown."), loc); - return false; + m_lang = wxLANGUAGE_DEFAULT; } + else + { + const wxLanguageInfo * const lang = wxLocale::FindLanguageInfo(loc); + if ( !lang ) + { + wxLogError(_("Locale \"%s\" is unknown."), loc); + return false; + } - m_lang = static_cast(lang->Language); + m_lang = static_cast(lang->Language); + } } return true;