+ // Create the main frame window
+ MyFrame *frame = new MyFrame(m_locale);
+
+ // Give it an icon
+ frame->SetIcon(wxICON(mondrian));
+
+ // Make a menubar
+ wxMenu *file_menu = new wxMenu;
+ file_menu->Append(INTERNAT_TEST, _("&Test locale availability...\tCtrl-T"));
+ file_menu->AppendSeparator();
+ file_menu->Append(wxID_ABOUT, _("&About..."));
+ file_menu->AppendSeparator();
+ file_menu->Append(wxID_EXIT, _("E&xit"));
+
+ wxMenu *test_menu = new wxMenu;
+ test_menu->Append(wxID_OPEN, _("&Open bogus file"));
+ test_menu->Append(INTERNAT_PLAY, _("&Play a game"));
+ test_menu->AppendSeparator();
+ test_menu->Append(INTERNAT_TEST_1, _("&1 _() (gettext)"));
+ test_menu->Append(INTERNAT_TEST_2, _("&2 _N() (ngettext)"));
+ test_menu->Append(INTERNAT_TEST_3, _("&3 wxTRANSLATE() (gettext_noop)"));
+
+ wxMenuBar *menu_bar = new wxMenuBar;
+ menu_bar->Append(file_menu, _("&File"));
+ menu_bar->Append(test_menu, _("&Test"));
+ frame->SetMenuBar(menu_bar);
+
+ // Show the frame
+ frame->Show(true);
+ SetTopWindow(frame);
+
+ return true;
+}
+
+// ----------------------------------------------------------------------------
+// MyFrame
+// ----------------------------------------------------------------------------
+
+// main frame constructor
+MyFrame::MyFrame(wxLocale& locale)
+ : wxFrame(NULL,
+ wxID_ANY,
+ _("International wxWidgets App")),
+ m_locale(locale)
+{
+ // this demonstrates RTL layout mirroring for Arabic locales
+ wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
+ sizer->Add(new wxStaticText(this, wxID_ANY, _("First")),
+ wxSizerFlags().Border());
+ sizer->Add(new wxStaticText(this, wxID_ANY, _("Second")),
+ wxSizerFlags().Border());
+ SetSizer(sizer);
+}
+
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
+{
+ Close(true);
+}
+
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+ wxString localeInfo;
+ wxString locale = m_locale.GetLocale();
+ wxString sysname = m_locale.GetSysName();
+ wxString canname = m_locale.GetCanonicalName();
+
+ localeInfo.Printf(_("Language: %s\nSystem locale name:\n%s\nCanonical locale name: %s\n"),
+ locale.c_str(), sysname.c_str(), canname.c_str() );
+
+ wxMessageDialog dlg(
+ this,
+ wxString(_("I18n sample\n(c) 1998, 1999 Vadim Zeitlin and Julian Smart"))
+ + wxT("\n\n")
+ + localeInfo,
+ _("About Internat"),
+ wxOK | wxICON_INFORMATION
+ );
+ dlg.ShowModal();
+}
+
+void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
+{
+ wxString str = wxGetTextFromUser
+ (
+ _("Enter your number:"),
+ _("Try to guess my number!"),
+ wxEmptyString,
+ this
+ );