1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 23:59:37 +02:00

Try my hand at using XO()

Did I do it right Paul?
This commit is contained in:
Leland Lucius 2020-05-26 20:51:10 -05:00
parent af26d0438c
commit 49c95973cd
2 changed files with 22 additions and 36 deletions

View File

@ -11,11 +11,10 @@
#include <gtk/gtk.h>
#include "Internat.h"
#include "widgets/AudacityMessageBox.h"
#include "../FileDialog.h"
#include "wx/intl.h"
#include "wx/msgdlg.h"
#ifdef __UNIX__
#include <unistd.h> // chdir
#endif
@ -26,8 +25,6 @@
#include <wx/modalhook.h>
#include <wx/sizer.h>
#include "../../../Internat.h" // For macro _
#define wxGTK_CONV(s) (s).utf8_str()
#define wxGTK_CONV_FN(s) (s).fn_str()
@ -71,16 +68,15 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, FileDialog *dialog)
{
if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
{
wxString msg;
msg.Printf(
_("File '%s' already exists, do you really want to overwrite it?"),
wxString::FromUTF8(filename));
wxMessageDialog dlg(dialog, msg, _("Confirm"),
wxYES_NO | wxICON_QUESTION);
if (dlg.ShowModal() != wxID_YES)
int result = AudacityMessageBox(
XO("File '%s' already exists, do you really want to overwrite it?")
.Format(wxString::FromUTF8(filename)),
XO("Confirm"),
wxYES_NO | wxICON_QUESTION);
if (result != wxID_YES)
{
return;
}
}
}
}
@ -90,9 +86,9 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, FileDialog *dialog)
{
if ( !g_file_test(filename, G_FILE_TEST_EXISTS) )
{
wxMessageDialog dlg( dialog, _("Please choose an existing file."),
_("Error"), wxOK| wxICON_ERROR);
dlg.ShowModal();
AudacityMessageBox(XO("Please choose an existing file."),
XO("Error"),
wxOK | wxICON_ERROR);
return;
}
}

View File

@ -19,35 +19,25 @@
// headers
// ----------------------------------------------------------------------------
#undef WXINTL_NO_GETTEXT_MACRO
// For compilers that support precompilation, includes "wx.h".
#include <wx/wxprec.h>
#include "Internat.h"
#include "../FileDialog.h"
#ifndef WX_PRECOMP
#include <wx/msgdlg.h>
#include <wx/app.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#endif
#include <wx/app.h>
#include <wx/choice.h>
#include <wx/clipbrd.h>
#include <wx/evtloop.h>
#include <wx/filectrl.h>
#include <wx/filename.h>
#include <wx/modalhook.h>
#include <wx/sizer.h>
#include <wx/sysopt.h>
#include <wx/stattext.h>
#include <wx/tokenzr.h>
#include <wx/evtloop.h>
#include <wx/osx/core/private.h>
#include <wx/sysopt.h>
#include <wx/modalhook.h>
#include <AppKit/AppKit.h>
#include "../../../Internat.h" // For macro _
// ============================================================================
// implementation
// ============================================================================
@ -390,7 +380,7 @@ void FileDialog::SetupExtraControls(WXWindow nativeWindow)
{
wxBoxSizer *horizontalSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *stattext = new wxStaticText( m_filterPanel, wxID_ANY, _("File type:") );
wxStaticText *stattext = new wxStaticText( m_filterPanel, wxID_ANY, XO("File type:") .Translation());
horizontalSizer->Add( stattext, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_filterChoice = new wxChoice( m_filterPanel, wxID_ANY );