Fix dangling references to temporaries in internat sample

In some build variants (e.g. when wxUSE_INTL==0) _() is a macro doing
nothing, in particular not involving a function call, and the temporary
wxString created by it doesn't survive past the end of the statement and
hence a reference to it can't be used.

Just make a copy of the string to fix this.
This commit is contained in:
Vadim Zeitlin
2025-03-09 17:07:49 +01:00
parent b218237ee2
commit 4cba8642e8
+2 -2
View File
@@ -588,7 +588,7 @@ void MyFrame::OnSave(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
{
const wxString& title = _("Testing _() (gettext)");
const wxString title = _("Testing _() (gettext)");
// NOTE: using the wxTRANSLATE() macro here we won't show a localized
// string in the text entry dialog; we'll simply show the un-translated
@@ -611,7 +611,7 @@ void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event))
{
const wxString& title = _("Testing _N() (ngettext)");
const wxString title = _("Testing _N() (ngettext)");
wxTextEntryDialog d(this,
_("Please enter range for plural forms of \"n files deleted\" phrase"),
title, "0-10");