Remove unnecesary Format, Printf, casts to wxString

This commit is contained in:
Paul Licameli 2017-09-30 12:19:44 -04:00
parent 7fd78183d2
commit e0970ad1e8
12 changed files with 71 additions and 51 deletions

View File

@ -346,10 +346,10 @@ visit our [[http://forum.audacityteam.org/|forum]].");
#endif
/* i18n-hint: The Latin phrase, "In memory of" a deceased person, often untranslated in European languages */
wxT("<p><b>") + wxString::Format(_("In Memoriam")) + wxT("</b><br>") +
wxT("<p><b>") + _("In Memoriam") + wxT("</b><br>") +
GetCreditsByRole(roleDeceased) +
wxT("<p><b>") + wxString::Format(_("Audacity Team Members")) + wxT("</b><br>") +
wxT("<p><b>") + _("Audacity Team Members") + wxT("</b><br>") +
GetCreditsByRole(roleTeamMember) +
wxT("<p><b> ") + _("Emeritus:") + wxT("</b><br>") +

View File

@ -1123,7 +1123,7 @@ void AudacityProject::CreateMenusAndCommands()
EffectManager::Get().GetEffectName(mLastEffect));
}
else
buildMenuLabel.Printf(_("Repeat Last Effect"));
buildMenuLabel = _("Repeat Last Effect");
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
c->AddItem(wxT("ManageEffects"), _("Add / Remove Plug-ins..."), FN(OnManageEffects));
@ -1937,7 +1937,7 @@ void AudacityProject::ModifyUndoMenuItems()
}
else {
mCommandManager.Modify(wxT("Undo"),
wxString::Format(_("&Undo")));
_("&Undo"));
}
if (GetUndoManager()->RedoAvailable()) {
@ -1949,7 +1949,7 @@ void AudacityProject::ModifyUndoMenuItems()
}
else {
mCommandManager.Modify(wxT("Redo"),
wxString::Format(_("&Redo")));
_("&Redo"));
mCommandManager.Enable(wxT("Redo"), false);
}
}
@ -4602,13 +4602,13 @@ void AudacityProject::OnExportMIDI(){
}
if(numNoteTracksSelected > 1) {
AudacityMessageBox(wxString::Format(_(
"Please select only one Note Track at a time.")));
AudacityMessageBox(_(
"Please select only one Note Track at a time."));
return;
}
else if(numNoteTracksSelected < 1) {
AudacityMessageBox(wxString::Format(_(
"Please select a Note Track.")));
AudacityMessageBox(_(
"Please select a Note Track."));
return;
}

View File

@ -4920,7 +4920,7 @@ void AudacityProject::OnTimer(wxTimerEvent& WXUNUSED(event))
ODManager::Instance()->SignalTaskQueueLoop();
msg.Printf(_("On-demand import and waveform calculation complete."));
msg = _("On-demand import and waveform calculation complete.");
mStatusBar->SetStatusText(msg, mainStatusBarField);
}

View File

@ -524,12 +524,12 @@ int TimerRecordDialog::RunWaitDialog()
// Two column layout. Line spacing must match for both columns.
// First column
wxString strMsg = wxString::Format(_("Recording start:\n") +
wxString strMsg = _("Recording start:\n") +
_("Duration:\n") +
_("Recording end:\n\n") +
_("Automatic Save enabled:\n") +
_("Automatic Export enabled:\n") +
_("Action after Timer Recording:"));
_("Action after Timer Recording:");
strMsg += ProgressDialog::ColoumnSplitMarker;
@ -1009,12 +1009,12 @@ ProgressResult TimerRecordDialog::WaitForStart()
// Two column layout. Line spacing must match for both columns.
// First column
wxString strMsg = wxString::Format(_("Waiting to start recording at:\n") +
wxString strMsg = _("Waiting to start recording at:\n") +
_("Recording duration:\n") +
_("Scheduled to stop at:\n\n") +
_("Automatic Save enabled:\n") +
_("Automatic Export enabled:\n") +
_("Action after Timer Recording:"));
_("Action after Timer Recording:");
strMsg += ProgressDialog::ColoumnSplitMarker;
@ -1054,10 +1054,10 @@ ProgressResult TimerRecordDialog::PreActionDelay(int iActionIndex, TimerRecordCo
// Two column layout. Line spacing must match for both columns.
// First column
wxString strMsg = wxString::Format(_("Timer Recording completed.\n\n") +
wxString strMsg = _("Timer Recording completed.\n\n") +
_("Recording Saved:\n") +
_("Recording Exported:\n") +
_("Action after Timer Recording:"));
_("Action after Timer Recording:");
strMsg += ProgressDialog::ColoumnSplitMarker;

View File

@ -811,7 +811,7 @@ void VoiceKey::CalibrateNoise(const WaveTrack & t, sampleCount start, sampleCoun
mDirectionChangesMean = sumdc / samples;
mDirectionChangesSD =sqrt(sumdc2 / samples - mDirectionChangesMean * mDirectionChangesMean) ;
wxString text = wxString::Format(_("Calibration Results\n"));
wxString text = _("Calibration Results\n");
/* i18n-hint: %1.4f is replaced by a number. sd stands for 'Standard Deviations'*/
text += wxString::Format(_("Energy -- mean: %1.4f sd: (%1.4f)\n"),mEnergyMean,mEnergySD);
text+= wxString::Format(_("Sign Changes -- mean: %1.4f sd: (%1.4f)\n"),mSignChangesMean,mSignChangesSD);

View File

@ -685,7 +685,7 @@ void EffectAutoDuckPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
duckAmountDb < MIN_DuckAmountDb || duckAmountDb > MAX_DuckAmountDb)
{
// values are out of range, no preview available
wxString message = wxString::Format(_("Preview not available"));
wxString message = _("Preview not available");
int textWidth = 0, textHeight = 0;
dc.GetTextExtent(message, &textWidth, &textHeight);
dc.DrawText(message, (clientWidth - textWidth) / 2,

View File

@ -193,7 +193,7 @@ bool EffectClickRemoval::Process()
}
if (bGoodResult && !mbDidSomething) // Processing successful, but ineffective.
Effect::MessageBox(
wxString::Format(_("Algorithm not effective on this audio. Nothing changed.")),
_("Algorithm not effective on this audio. Nothing changed."),
wxOK | wxICON_ERROR);
this->ReplaceProcessedTracks(bGoodResult && mbDidSomething);

View File

@ -408,7 +408,7 @@ namespace {
return wxString::Format(_("%.2f dB RMS"), diffdB);
else
/* i18n-hint: dB abbreviates decibels */
return wxString::Format(_("Infinite dB difference"));
return _("Infinite dB difference");
}
}
@ -463,27 +463,27 @@ void ContrastDialog::results()
if (mForegroundIsDefined) {
mForegroundRMSText->SetName(_("Measured foreground level")); // Read by screen-readers
if(std::isinf(- foregrounddB))
mForegroundRMSText->ChangeValue(wxString::Format(_("zero")));
mForegroundRMSText->ChangeValue(_("zero"));
else
mForegroundRMSText->ChangeValue(wxString::Format(_("%.2f dB"), foregrounddB)); // i18n-hint: short form of 'decibels'
}
else {
mForegroundRMSText->SetName(_("No foreground measured")); // Read by screen-readers
mForegroundRMSText->ChangeValue(wxT(""));
mPassFailText->ChangeValue(wxString::Format(_("Foreground not yet measured")));
mPassFailText->ChangeValue(_("Foreground not yet measured"));
}
if (mBackgroundIsDefined) {
mBackgroundRMSText->SetName(_("Measured background level"));
if(std::isinf(- backgrounddB))
mBackgroundRMSText->ChangeValue(wxString::Format(_("zero")));
mBackgroundRMSText->ChangeValue(_("zero"));
else
mBackgroundRMSText->ChangeValue(wxString::Format(_("%.2f dB"), backgrounddB));
}
else {
mBackgroundRMSText->SetName(_("No background measured"));
mBackgroundRMSText->ChangeValue(wxT(""));
mPassFailText->ChangeValue(wxString::Format(_("Background not yet measured")));
mPassFailText->ChangeValue(_("Background not yet measured"));
}
}

View File

@ -288,7 +288,7 @@ bool ExportFFmpeg::Init(const char *shortname, AudacityProject *project, const T
mEncFormatCtx.reset(avformat_alloc_context());
if (!mEncFormatCtx)
{
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't allocate output format context.")),
AudacityMessageBox(_("FFmpeg : ERROR - Can't allocate output format context."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
return false;
}
@ -546,8 +546,10 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
mEncAudioFifoOutBuf.reset(static_cast<int16_t*>(av_malloc(mEncAudioFifoOutBufSiz)));
if (!mEncAudioFifoOutBuf)
{
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO.")),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - Can't allocate buffer to read into from audio FIFO."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false;
}
@ -576,22 +578,28 @@ static int encode_audio(AVCodecContext *avctx, AVPacket *pkt, int16_t *audio_sam
buffer_size = av_samples_get_buffer_size(NULL, avctx->channels, frame->nb_samples,
avctx->sample_fmt, 0);
if (buffer_size < 0) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Could not get sample buffer size")),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - Could not get sample buffer size"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return buffer_size;
}
samples.reset(static_cast<uint8_t*>(av_malloc(buffer_size)));
if (!samples) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Could not allocate bytes for samples buffer")),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - Could not allocate bytes for samples buffer"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return AVERROR(ENOMEM);
}
/* setup the data pointers in the AVFrame */
ret = avcodec_fill_audio_frame(frame.get(), avctx->channels, avctx->sample_fmt,
samples.get(), buffer_size, 0);
if (ret < 0) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Could not setup audio frame")),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - Could not setup audio frame"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return ret;
}
@ -638,8 +646,10 @@ static int encode_audio(AVCodecContext *avctx, AVPacket *pkt, int16_t *audio_sam
ret = avcodec_encode_audio2(avctx, pkt, frame.get(), &got_output);
if (ret < 0) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - encoding frame failed")),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - encoding frame failed"),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return ret;
}
@ -664,8 +674,10 @@ bool ExportFFmpeg::Finalize()
int nAudioFrameSizeOut = default_frame_size * mEncAudioCodecCtx->channels * sizeof(int16_t);
if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz || nFifoBytes > mEncAudioFifoOutBufSiz) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Too much remaining data.")),
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - Too much remaining data."),
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION
);
return false;
}
@ -727,8 +739,10 @@ bool ExportFFmpeg::Finalize()
if (av_interleaved_write_frame(mEncFormatCtx.get(), &pkt) != 0)
{
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Couldn't write last audio frame to output file.")),
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - Couldn't write last audio frame to output file."),
_("FFmpeg Error"), wxOK | wxCENTER | wxICON_EXCLAMATION
);
break;
}
}
@ -777,8 +791,10 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
return false;
if (nAudioFrameSizeOut > mEncAudioFifoOutBufSiz) {
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - nAudioFrameSizeOut too large.")),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - nAudioFrameSizeOut too large."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false;
}
@ -795,8 +811,10 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
default_frame_size);
if (ret < 0)
{
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Can't encode audio frame.")),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - Can't encode audio frame."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false;
}
if (ret == 0)
@ -814,8 +832,10 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
// Write the encoded audio frame to the output file.
if ((ret = av_interleaved_write_frame(mEncFormatCtx.get(), &pkt)) < 0)
{
AudacityMessageBox(wxString::Format(_("FFmpeg : ERROR - Failed to write audio frame to file.")),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION);
AudacityMessageBox(
_("FFmpeg : ERROR - Failed to write audio frame to file."),
_("FFmpeg Error"), wxOK|wxCENTER|wxICON_EXCLAMATION
);
return false;
}
}

View File

@ -307,12 +307,12 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S)
// Row 1
S.SetBorder(1);
mTrack = S.Id(TrackID)
.AddRadioButton(wxString(_("Tracks")));
.AddRadioButton(_("Tracks"));
mTrack->SetName(_("Tracks"));
// Row 2
S.SetBorder(1);
mLabel = S.Id(LabelID).AddRadioButtonToGroup(wxString(_("Labels")));
mLabel = S.Id(LabelID).AddRadioButtonToGroup(_("Labels"));
mLabel->SetName(_("Labels"));
S.SetBorder(3);

View File

@ -875,7 +875,7 @@ UIHandle::Result TimeShiftHandle::Release
wxString msg;
bool consolidate;
if (mDidSlideVertically) {
msg.Printf(_("Moved clips to another track"));
msg = _("Moved clips to another track");
consolidate = false;
}
else {

View File

@ -2235,11 +2235,11 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
// always retain the leading space. Therefore a space has
// been added to ensure at least one space, and stop
// words from being merged
*name += wxT(" ") + wxString::Format(_(" Monitoring "));
*name += wxT(" ") + _(" Monitoring ");
}
else if (m->mActive)
{
*name += wxT(" ") + wxString::Format(_(" Active "));
*name += wxT(" ") + _(" Active ");
}
float peak = 0.;
@ -2262,7 +2262,7 @@ wxAccStatus MeterAx::GetName(int WXUNUSED(childId), wxString* name)
if (clipped)
{
*name += wxT(" ") + wxString::Format(_(" Clipped "));
*name += wxT(" ") + _(" Clipped ");
}
}