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.
This commit is contained in:
Vadim Zeitlin 2021-08-06 00:19:03 +02:00
parent 33ae58e457
commit 93190d6263

View File

@ -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<wxLanguage>(lang->Language);
m_lang = static_cast<wxLanguage>(lang->Language);
}
}
return true;