+void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
+{
+ wxString str = wxGetTextFromUser(_("Enter your number:"),
+ _("Try to guess my number!"),
+ "", this);
+ if ( str.IsEmpty() )
+ return;
+
+ int num;
+ wxSscanf(str, wxT("%d"), &num);
+ if ( num == 0 )
+ str = _("You've probably entered an invalid number.");
+ else if ( num == 9 ) // this message is not translated (not in catalog)
+ str = "You've found a bug in this program!";
+ else if ( num != 17 ) // a more implicit way to write _()
+ str = wxGetTranslation(wxT("Bad luck! try again..."));
+ else {
+ str.Empty();
+ // string must be split in two -- otherwise the translation won't be found
+ str << _("Congratulations! you've won. Here is the magic phrase:")
+ << _("cannot create fifo `%s'");
+ }
+
+ wxMessageBox(str, _("Result"), wxOK | wxICON_INFORMATION);
+}