From 70b5076b0b2909e90b66e4de45e4bc924148779d Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 8 Sep 2017 17:31:45 -0400 Subject: [PATCH 1/6] Fix some untranslated prompts and messages... ... Even if some commented out. Such don't enlarge the .pot file, but make them right in case they are ever un-commented. --- src/BatchCommands.cpp | 8 ++++---- src/Theme.cpp | 16 +++++++++++----- src/TimerRecordDialog.cpp | 16 ++++++++-------- src/VoiceKey.cpp | 2 +- src/effects/lv2/LV2Effect.cpp | 2 +- src/export/ExportFFmpeg.cpp | 2 +- src/import/ImportGStreamer.cpp | 18 +++++++++--------- 7 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/BatchCommands.cpp b/src/BatchCommands.cpp index b509e014c..c12882cbb 100644 --- a/src/BatchCommands.cpp +++ b/src/BatchCommands.cpp @@ -366,13 +366,13 @@ double BatchCommands::GetEndTime() AudacityProject *project = GetActiveProject(); if( project == NULL ) { - //wxMessageBox( wxT("No project to process!") ); + //wxMessageBox( _("No project to process!") ); return -1.0; } TrackList * tracks = project->GetTracks(); if( tracks == NULL ) { - //wxMessageBox( wxT("No tracks to process!") ); + //wxMessageBox( _("No tracks to process!") ); return -1.0; } @@ -385,14 +385,14 @@ bool BatchCommands::IsMono() AudacityProject *project = GetActiveProject(); if( project == NULL ) { - //wxMessageBox( wxT("No project and no Audio to process!") ); + //wxMessageBox( _("No project and no Audio to process!") ); return false; } TrackList * tracks = project->GetTracks(); if( tracks == NULL ) { - //wxMessageBox( wxT("No tracks to process!") ); + //wxMessageBox( _("No tracks to process!") ); return false; } diff --git a/src/Theme.cpp b/src/Theme.cpp index eca38ef86..c6e01b6b5 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -752,8 +752,9 @@ void ThemeBase::CreateImageCache( bool bBinarySave ) { wxMessageBox( wxString::Format( - wxT("Theme cache file:\n %s\nalready exists.\nAre you sure you want to replace it?"), - FileName.c_str() )); +// _("Theme cache file:\n %s\nalready exists.\nAre you sure you want to replace it?"), + FileName.c_str() ) + ); return; } #endif @@ -775,7 +776,11 @@ void ThemeBase::CreateImageCache( bool bBinarySave ) } wxMessageBox( wxString::Format( - wxT("Theme written to:\n %s."), +/* i18n-hint: A theme is a consistent visual style across an application's + graphical user interface, including choices of colors, and similarity of images + such as those on button controls. Audacity can load and save alternative + themes. */ + _("Theme written to:\n %s."), FileName.c_str() )); } // ELSE saving to a C code textual version. @@ -801,7 +806,8 @@ void ThemeBase::CreateImageCache( bool bBinarySave ) } wxMessageBox( wxString::Format( - wxT("Theme as Cee code written to:\n %s."), + /* i18n-hint "Cee" means the C computer programming language */ + _("Theme as Cee code written to:\n %s."), FileName.c_str() )); } } @@ -1181,7 +1187,7 @@ void ThemeBase::SaveComponents() } wxMessageBox( wxString::Format( - wxT("Theme written to:\n %s."), + _("Theme written to:\n %s."), FileNames::ThemeComponentsDir().c_str() )); } diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index 54f1e3279..3aec1a875 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -412,7 +412,7 @@ void TimerRecordDialog::OnOK(wxCommandEvent& WXUNUSED(event)) // Create the message string wxString sMessage = ""; - sMessage.Printf("You may not have enough free disk space to complete this Timer Recording, based on your current settings.\n\nDo you wish to continue?\n\nPlanned recording duration: %s\nRecording time remaining on disk: %s", + sMessage.Printf(_("You may not have enough free disk space to complete this Timer Recording, based on your current settings.\n\nDo you wish to continue?\n\nPlanned recording duration: %s\nRecording time remaining on disk: %s"), sPlannedTime, sRemainingTime); @@ -492,7 +492,7 @@ bool TimerRecordDialog::RemoveAllAutoSaveFiles() { // I don't think this error message is actually useful. // -dmazzoni - //wxMessageBox(wxT("Could not remove auto save file: " + files[i]), + //wxMessageBox(_("Could not remove auto save file: " + files[i]), // _("Error"), wxICON_STOP); return false; } @@ -622,18 +622,18 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) { if (m_bAutoSaveEnabled) { if (bSaveOK) { - sMessage.Printf("%s\n\nRecording saved: %s", + sMessage.Printf(_("%s\n\nRecording saved: %s"), sMessage, m_fnAutoSaveFile.GetFullPath()); } else { - sMessage.Printf("%s\n\nError saving recording.", sMessage); + sMessage.Printf(_("%s\n\nError saving recording."), sMessage); } } if (m_bAutoExportEnabled) { if (bExportOK) { - sMessage.Printf("%s\n\nRecording exported: %s", + sMessage.Printf(_("%s\n\nRecording exported: %s"), sMessage, m_fnAutoExportFile.GetFullPath()); } else { - sMessage.Printf("%s\n\nError exporting recording.", sMessage); + sMessage.Printf(_("%s\n\nError exporting recording."), sMessage); } } @@ -642,7 +642,7 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) { if ((iOverriddenAction != iPostRecordAction) && (iOverriddenAction != POST_TIMER_RECORD_NOTHING)) { // Inform the user that we have overridden the selected action - sMessage.Printf("%s\n\n'%s' has been canceled due to the error(s) noted above.", + sMessage.Printf(_("%s\n\n'%s' has been canceled due to the error(s) noted above."), sMessage, m_pTimerAfterCompleteChoiceCtrl->GetString(iOverriddenAction)); } @@ -652,7 +652,7 @@ int TimerRecordDialog::ExecutePostRecordActions(bool bWasStopped) { } else { if (bWasStopped && (iOverriddenAction != POST_TIMER_RECORD_NOTHING)) { - sMessage.Printf("%s\n\n'%s' has been canceled as the recording was stopped.", + sMessage.Printf(_("%s\n\n'%s' has been canceled as the recording was stopped."), sMessage, m_pTimerAfterCompleteChoiceCtrl->GetString(iOverriddenAction)); } diff --git a/src/VoiceKey.cpp b/src/VoiceKey.cpp index 96b6acc7d..8c486ee5a 100644 --- a/src/VoiceKey.cpp +++ b/src/VoiceKey.cpp @@ -818,7 +818,7 @@ void VoiceKey::CalibrateNoise(const WaveTrack & t, sampleCount start, sampleCoun text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD); text += wxString::Format(_("Direction Changes -- mean: %1.4f sd: (%1.4f)\n"), mDirectionChangesMean, mDirectionChangesSD); wxMessageDialog{ NULL, text, - wxT("Calibration Complete"), + _("Calibration Complete"), wxOK | wxICON_INFORMATION, wxPoint(-1, -1) } .ShowModal(); diff --git a/src/effects/lv2/LV2Effect.cpp b/src/effects/lv2/LV2Effect.cpp index 837f6dd84..b5f020de9 100644 --- a/src/effects/lv2/LV2Effect.cpp +++ b/src/effects/lv2/LV2Effect.cpp @@ -1034,7 +1034,7 @@ bool LV2Effect::PopulateUI(wxWindow *parent) mMaster = InitInstance(mSampleRate); if (mMaster == NULL) { - wxMessageBox(wxT("Couldn't instantiate effect")); + wxMessageBox(_("Couldn't instantiate effect")); return false; } diff --git a/src/export/ExportFFmpeg.cpp b/src/export/ExportFFmpeg.cpp index a69dcd191..fd57fdff7 100644 --- a/src/export/ExportFFmpeg.cpp +++ b/src/export/ExportFFmpeg.cpp @@ -326,7 +326,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, const T { if ((err = ufile_fopen(&mEncFormatCtx->pb, mName, AVIO_FLAG_WRITE)) < 0) { - wxMessageBox(wxString::Format(wxT("FFmpeg : ERROR - Can't open output file \"%s\" to write. Error code is %d."), mName.c_str(), err), + wxMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't open output file \"%s\" to write. Error code is %d."), mName.c_str(), err), _("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION); return false; } diff --git a/src/import/ImportGStreamer.cpp b/src/import/ImportGStreamer.cpp index 0a339481f..5f16a965d 100644 --- a/src/import/ImportGStreamer.cpp +++ b/src/import/ImportGStreamer.cpp @@ -955,8 +955,8 @@ GStreamerImportFileHandle::Init() // Add the decoder to the pipeline if (!gst_bin_add(GST_BIN(mPipeline.get()), mDec)) { - wxMessageBox(wxT("Unable to add decoder to pipeline"), - wxT("GStreamer Importer")); + wxMessageBox(_("Unable to add decoder to pipeline"), + _("GStreamer Importer")); // Cleanup expected to occur in destructor return false; @@ -966,8 +966,8 @@ GStreamerImportFileHandle::Init() GstStateChangeReturn state = gst_element_set_state(mPipeline.get(), GST_STATE_PAUSED); if (state == GST_STATE_CHANGE_FAILURE) { - wxMessageBox(wxT("Unable to set stream state to paused."), - wxT("GStreamer Importer")); + wxMessageBox(_("Unable to set stream state to paused."), + _("GStreamer Importer")); return false; } @@ -1095,8 +1095,8 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory, // Can't do much if we don't have any streams to process if (!haveStreams) { - wxMessageBox(wxT("File doesn't contain any audio streams."), - wxT("GStreamer Importer")); + wxMessageBox(_("File doesn't contain any audio streams."), + _("GStreamer Importer")); return ProgressResult::Failed; } @@ -1104,8 +1104,8 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory, GstStateChangeReturn state = gst_element_set_state(mPipeline.get(), GST_STATE_PLAYING); if (state == GST_STATE_CHANGE_FAILURE) { - wxMessageBox(wxT("Unable to import file, state change failed."), - wxT("GStreamer Importer")); + wxMessageBox(_("Unable to import file, state change failed."), + _("GStreamer Importer")); return ProgressResult::Failed; } @@ -1235,7 +1235,7 @@ GStreamerImportFileHandle::ProcessBusMessage(bool & success) debug ? wxT("\n") : wxT(""), debug ? wxString::FromUTF8(debug.get()).c_str() : wxT("")); #if defined(_DEBUG) - wxMessageBox(m, wxT("GStreamer Error:")); + wxMessageBox(wxString::Format(_("GStreamer Error: %s"), m)); #else wxLogMessage(wxT("GStreamer Error: %s"), m.c_str()); #endif From b2382eab2a6a1495730f1c89f068b2cc2b867a1d Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 6 Sep 2017 16:35:08 -0400 Subject: [PATCH 2/6] Translation of Quality preference choices --- src/Resample.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Resample.cpp b/src/Resample.cpp index 5abde49b7..e8d914fa5 100644 --- a/src/Resample.cpp +++ b/src/Resample.cpp @@ -24,6 +24,7 @@ #include "Resample.h" #include "Prefs.h" +#include "TranslatableStringArray.h" #include @@ -52,11 +53,28 @@ int Resample::GetNumMethods() { return 4; } wxString Resample::GetMethodName(int index) { - static char const * const soxr_method_names[] = { - "Low Quality (Fastest)", "Medium Quality", "High Quality", "Best Quality (Slowest)" + static const wxString soxr_method_names[] = { + XO("Low Quality (Fastest)"), + XO("Medium Quality"), + XO("High Quality"), + XO("Best Quality (Slowest)") }; - return wxString(wxString::FromAscii(soxr_method_names[index])); + wxASSERT( GetNumMethods() == + sizeof(soxr_method_names) / sizeof(*soxr_method_names) ); + + class MethodNamesArray final : public TranslatableStringArray + { + void Populate() override + { + for (auto &name : soxr_method_names) + mContents.push_back( wxGetTranslation( name ) ); + } + }; + + static MethodNamesArray theArray; + + return theArray.Get()[ index ]; } const wxString Resample::GetFastMethodKey() From a3245b56a7cd0c01949b4f781ed58c4d18e977cf Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 6 Sep 2017 17:01:33 -0400 Subject: [PATCH 3/6] Translate "Audacity website:" in About dialog --- src/AboutDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 36ed92096..d4eb196f8 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -422,7 +422,7 @@ visit our [[http://forum.audacityteam.org/|forum]]."); wxT("

") + _("Special thanks:") + wxT("
") + GetCreditsByRole(roleThanks) + - wxT("


Audacity website: [[http://www.audacityteam.org/|http://www.audacityteam.org/]]") + + wxT("


") + _("Audacity website: ") + wxT("[[http://www.audacityteam.org/|http://www.audacityteam.org/]]") + // DA: Link for DA url too #ifdef EXPERIMENTAL_DA From 1e1560d63cf448153c82b097e639adef2b481f55 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 6 Sep 2017 17:57:07 -0400 Subject: [PATCH 4/6] Fix missed translations in Plot Spectrum --- src/FreqWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index f81f4336c..c4b0fa56e 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -353,7 +353,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, hRuler->ruler.SetLog(true); hRuler->ruler.SetRange(10, 20000); hRuler->ruler.SetFormat(Ruler::RealFormat); - hRuler->ruler.SetUnits(wxT("Hz")); + hRuler->ruler.SetUnits(_("Hz")); hRuler->ruler.SetFlip(true); hRuler->ruler.SetLabelEdges(true); int h; @@ -390,12 +390,12 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id, S.SetStretchyCol(1); S.SetStretchyCol(3); { - S.AddPrompt(wxT("Cursor:")); + S.AddPrompt(_("Cursor:")); S.SetStyle(wxTE_READONLY); mCursorText = S.AddTextBox(wxT(""), wxT(""), 10); - S.AddPrompt(wxT("Peak:")); + S.AddPrompt(_("Peak:")); S.SetStyle(wxTE_READONLY); mPeakText = S.AddTextBox(wxT(""), wxT(""), 10); From ec5f9d6b6697274552e98007e31e338fc0803c6d Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 6 Sep 2017 22:14:47 -0400 Subject: [PATCH 5/6] Translation of strings in Benchmark --- src/Benchmark.cpp | 104 ++++++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/src/Benchmark.cpp b/src/Benchmark.cpp index ade11ec8e..9079a5948 100644 --- a/src/Benchmark.cpp +++ b/src/Benchmark.cpp @@ -82,11 +82,9 @@ private: void RunBenchmark(wxWindow *parent) { /* - int action = wxMessageBox(wxT("This will close all project windows " - "(without saving)\n" - "and open the Audacity Benchmark dialog.\n\n" - "Are you sure you want to do this?"), - wxT("Benchmark"), + int action = wxMessageBox( +_("This will close all project windows (without saving)\nand open the Audacity Benchmark dialog.\n\nAre you sure you want to do this?"), + _("Benchmark"), wxYES_NO | wxICON_EXCLAMATION, NULL); @@ -126,7 +124,8 @@ BEGIN_EVENT_TABLE(BenchmarkDialog, wxDialogWrapper) END_EVENT_TABLE() BenchmarkDialog::BenchmarkDialog(wxWindow *parent): - wxDialogWrapper( parent, 0, wxT("Benchmark"), +/* i18n-hint: Benchmark means a software speed test */ + wxDialogWrapper( parent, 0, _("Benchmark"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) @@ -167,28 +166,30 @@ void BenchmarkDialog::MakeBenchmarkDialog() S.StartMultiColumn(4); { // - item = S.Id(BlockSizeID).AddTextBox(wxT("Disk Block Size (KB):"), + item = S.Id(BlockSizeID).AddTextBox(_("Disk Block Size (KB):"), wxT(""), 12); item->SetValidator(wxTextValidator(wxFILTER_NUMERIC, &mBlockSizeStr)); // - item = S.Id(NumEditsID).AddTextBox(wxT("Number of Edits:"), + item = S.Id(NumEditsID).AddTextBox(_("Number of Edits:"), wxT(""), 12); item->SetValidator(wxTextValidator(wxFILTER_NUMERIC, &mNumEditsStr)); // - item = S.Id(DataSizeID).AddTextBox(wxT("Test Data Size (MB):"), + item = S.Id(DataSizeID).AddTextBox(_("Test Data Size (MB):"), wxT(""), 12); item->SetValidator(wxTextValidator(wxFILTER_NUMERIC, &mDataSizeStr)); /// - item = S.Id(RandSeedID).AddTextBox(wxT("Random Seed:"), + /* i18n-hint: A "seed" is a number that initializes a + pseudorandom number generating algorithm */ + item = S.Id(RandSeedID).AddTextBox(_("Random Seed:"), wxT(""), 12); item->SetValidator(wxTextValidator(wxFILTER_NUMERIC, @@ -198,18 +199,19 @@ void BenchmarkDialog::MakeBenchmarkDialog() S.EndMultiColumn(); // - item = S.AddCheckBox(wxT("Show detailed info about each block file"), + item = S.AddCheckBox(_("Show detailed info about each block file"), wxT("false")); item->SetValidator(wxGenericValidator(&mBlockDetail)); // - item = S.AddCheckBox(wxT("Show detailed info about each editing operation"), + item = S.AddCheckBox(_("Show detailed info about each editing operation"), wxT("false")); item->SetValidator(wxGenericValidator(&mEditDetail)); // mText = S.Id(StaticTextID).AddTextWindow(wxT("")); - mText->SetName(wxT("Output")); + /* i18n-hint noun */ + mText->SetName(_("Output")); mText->SetSizeHints(wxSize(500,200)); // @@ -218,9 +220,10 @@ void BenchmarkDialog::MakeBenchmarkDialog() { S.StartHorizontalLay(wxALIGN_LEFT, false); { - S.Id(RunID).AddButton(wxT("Run"))->SetDefault(); - S.Id(BSaveID).AddButton(wxT("Save")); - S.Id(ClearID).AddButton(wxT("Clear")); + S.Id(RunID).AddButton(_("Run"))->SetDefault(); + S.Id(BSaveID).AddButton(_("Save")); + /* i18n-hint verb; to empty or erase */ + S.Id(ClearID).AddButton(_("Clear")); } S.EndHorizontalLay(); @@ -232,7 +235,8 @@ void BenchmarkDialog::MakeBenchmarkDialog() S.StartHorizontalLay(wxALIGN_NOT | wxALIGN_LEFT, false); { - S.Id(wxID_CANCEL).AddButton(wxT("Close")); + /* i18n-hint verb */ + S.Id(wxID_CANCEL).AddButton(_("Close")); } S.EndHorizontalLay(); } @@ -246,10 +250,12 @@ void BenchmarkDialog::MakeBenchmarkDialog() void BenchmarkDialog::OnSave( wxCommandEvent & WXUNUSED(event)) { - wxString fName = wxT("benchmark.txt"); +/* i18n-hint: Benchmark means a software speed test; + leave untranslated file extension .txt */ + wxString fName = _("benchmark.txt"); fName = FileNames::SelectFile(FileNames::Operation::Export, - wxT("Export Benchmark Data As:"), + _("Export Benchmark Data as:"), wxEmptyString, fName, wxT("txt"), @@ -317,17 +323,17 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) mRandSeedStr.ToLong(&randSeed); if (blockSize < 1 || blockSize > 1024) { - wxMessageBox(wxT("Block size should be in the range 1 - 1024 KB.")); + wxMessageBox(_("Block size should be in the range 1 - 1024 KB.")); return; } if (numEdits < 1 || numEdits > 10000) { - wxMessageBox(wxT("Number of edits should be in the range 1 - 10000.")); + wxMessageBox(_("Number of edits should be in the range 1 - 10000.")); return; } if (dataSize < 1 || dataSize > 2000) { - wxMessageBox(wxT("Test data size should be in the range 1 - 2000 MB.")); + wxMessageBox(_("Test data size should be in the range 1 - 2000 MB.")); return; } @@ -371,8 +377,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) // They are (and are supposed to be) a different size to // the blocks that make the blockfiles. That way we get to // do some testing of when edit chunks cross blockfile boundaries. - Printf(wxT("Using %d chunks of %d samples each, for a total of ") - wxT("%.1f MB.\n"), + Printf(_("Using %d chunks of %d samples each, for a total of %.1f MB.\n"), nChunks, chunkSize, nChunks*chunkSize*sizeof(short)/1048576.0); int trials = numEdits; @@ -381,7 +386,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) Shorts small1{ nChunks }; Shorts block{ chunkSize }; - Printf(wxT("Preparing...\n")); + Printf(_("Preparing...\n")); wxTheApp->Yield(); FlushPrint(); @@ -409,12 +414,12 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) t->GetEndTime(); if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != nChunks * chunkSize) { - Printf(wxT("Expected len %d, track len %lld.\n"), nChunks * chunkSize, + Printf(_("Expected len %d, track len %lld.\n"), nChunks * chunkSize, t->GetClipByIndex(0)->GetSequence()->GetNumSamples().as_long_long()); goto fail; } - Printf(wxT("Performing %d edits...\n"), trials); + Printf(_("Performing %d edits...\n"), trials); wxTheApp->Yield(); FlushPrint(); @@ -428,17 +433,17 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) // 1 <= xlen <= nChunks - x0 const size_t xlen = 1 + (rand() % (nChunks - x0)); if (mEditDetail) - Printf(wxT("Cut: %d - %d \n"), x0 * chunkSize, (x0 + xlen) * chunkSize); + Printf(_("Cut: %d - %d \n"), x0 * chunkSize, (x0 + xlen) * chunkSize); Track::Holder tmp; try { tmp = t->Cut(double (x0 * chunkSize), double ((x0 + xlen) * chunkSize)); } catch (const AudacityException&) { - Printf(wxT("Trial %d\n"), z); - Printf(wxT("Cut (%d, %d) failed.\n"), (x0 * chunkSize), + Printf(_("Trial %d\n"), z); + Printf(_("Cut (%d, %d) failed.\n"), (x0 * chunkSize), (x0 + xlen) * chunkSize); - Printf(wxT("Expected len %d, track len %lld.\n"), nChunks * chunkSize, + Printf(_("Expected len %d, track len %lld.\n"), nChunks * chunkSize, t->GetClipByIndex(0)->GetSequence()->GetNumSamples().as_long_long()); goto fail; } @@ -448,19 +453,19 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) const size_t y0 = rand() % (nChunks - xlen + 1); if (mEditDetail) - Printf(wxT("Paste: %d\n"), y0 * chunkSize); + Printf(_("Paste: %d\n"), y0 * chunkSize); try { t->Paste((double)(y0 * chunkSize), tmp.get()); } catch (const AudacityException&) { - Printf(wxT("Trial %d\nFailed on Paste.\n"), z); + Printf(_("Trial %d\nFailed on Paste.\n"), z); goto fail; } if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != nChunks * chunkSize) { - Printf(wxT("Trial %d\n"), z); - Printf(wxT("Expected len %d, track len %lld.\n"), nChunks * chunkSize, + Printf(_("Trial %d\n"), z); + Printf(_("Expected len %d, track len %lld.\n"), nChunks * chunkSize, t->GetClipByIndex(0)->GetSequence()->GetNumSamples().as_long_long()); goto fail; } @@ -479,19 +484,19 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) seq->DebugPrintf(seq->GetBlockArray(), seq->GetNumSamples(), &tempStr); mToPrint += tempStr; } - Printf(wxT("Time to perform %d edits: %ld ms\n"), trials, elapsed); + Printf(_("Time to perform %d edits: %ld ms\n"), trials, elapsed); FlushPrint(); wxTheApp->Yield(); #if 0 - Printf(wxT("Checking file pointer leaks:\n")); - Printf(wxT("Track # blocks: %d\n"), t->GetBlockArray()->Count()); - Printf(wxT("Disk # blocks: \n")); + Printf(_("Checking file pointer leaks:\n")); + Printf(_("Track # blocks: %d\n"), t->GetBlockArray()->Count()); + Printf(_("Disk # blocks: \n")); system("ls .audacity_temp/* | wc --lines"); #endif - Printf(wxT("Doing correctness check...\n")); + Printf(_("Doing correctness check...\n")); FlushPrint(); wxTheApp->Yield(); @@ -504,19 +509,19 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) if (block[b] != v) { bad++; if (bad < 10) - Printf(wxT("Bad: chunk %d sample %d\n"), i, b); + Printf(_("Bad: chunk %d sample %d\n"), i, b); b = chunkSize; } } if (bad == 0) - Printf(wxT("Passed correctness check!\n")); + Printf(_("Passed correctness check!\n")); else - Printf(wxT("Errors in %d/%d chunks\n"), bad, nChunks); + Printf(_("Errors in %d/%d chunks\n"), bad, nChunks); elapsed = timer.Time(); - Printf(wxT("Time to check all data: %ld ms\n"), elapsed); - Printf(wxT("Reading data again...\n")); + Printf(_("Time to check all data: %ld ms\n"), elapsed); + Printf(_("Reading data again...\n")); wxTheApp->Yield(); FlushPrint(); @@ -533,21 +538,20 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event)) elapsed = timer.Time(); - Printf(wxT("Time to check all data (2): %ld ms\n"), elapsed); + Printf(_("Time to check all data (2): %ld ms\n"), elapsed); - Printf(wxT("At 44100 Hz, 16-bits per sample, the estimated number of\n") - wxT("simultaneous tracks that could be played at once: %.1f\n"), + Printf(_("At 44100 Hz, 16-bits per sample, the estimated number of\n simultaneous tracks that could be played at once: %.1f\n"), (nChunks*chunkSize/44100.0)/(elapsed/1000.0)); goto success; fail: - Printf(wxT("TEST FAILED!!!\n")); + Printf(_("TEST FAILED!!!\n")); success: dd.reset(); - Printf(wxT("Benchmark completed successfully.\n")); + Printf(_("Benchmark completed successfully.\n")); HoldPrint(false); } From f6b5d8e651915adbf55a77cf99754c5eb22e415c Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 10 Sep 2017 09:58:01 -0400 Subject: [PATCH 6/6] Generate msgid and msgid_plural in .pot for wxPLURAL macro --- locale/Makevars | 2 +- src/Audacity.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/locale/Makevars b/locale/Makevars index 6dc4dfaed..6778964e5 100644 --- a/locale/Makevars +++ b/locale/Makevars @@ -8,7 +8,7 @@ subdir = po top_builddir = .. # These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=XO --add-comments=" i18n" +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=XO --keyword=wxPLURAL:1,2 --add-comments=" i18n" # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding diff --git a/src/Audacity.h b/src/Audacity.h index 18851c199..e6c62546e 100644 --- a/src/Audacity.h +++ b/src/Audacity.h @@ -215,6 +215,7 @@ extern const wxString& GetCustomSubstitution(const wxString& str1 ); #undef wxPLURAL #endif +// Note: The strings will go to the .pot file (do not use _(...)). #define wxPLURAL(sing, plur, n) wxGetTranslation((sing), (plur), n)