1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 00:19:27 +02:00

Translation of strings in Benchmark

This commit is contained in:
Paul Licameli 2017-09-06 22:14:47 -04:00
parent 1e1560d63c
commit ec5f9d6b66

View File

@ -82,11 +82,9 @@ private:
void RunBenchmark(wxWindow *parent) void RunBenchmark(wxWindow *parent)
{ {
/* /*
int action = wxMessageBox(wxT("This will close all project windows " int action = wxMessageBox(
"(without saving)\n" _("This will close all project windows (without saving)\nand open the Audacity Benchmark dialog.\n\nAre you sure you want to do this?"),
"and open the Audacity Benchmark dialog.\n\n" _("Benchmark"),
"Are you sure you want to do this?"),
wxT("Benchmark"),
wxYES_NO | wxICON_EXCLAMATION, wxYES_NO | wxICON_EXCLAMATION,
NULL); NULL);
@ -126,7 +124,8 @@ BEGIN_EVENT_TABLE(BenchmarkDialog, wxDialogWrapper)
END_EVENT_TABLE() END_EVENT_TABLE()
BenchmarkDialog::BenchmarkDialog(wxWindow *parent): BenchmarkDialog::BenchmarkDialog(wxWindow *parent):
wxDialogWrapper( parent, 0, wxT("Benchmark"), /* i18n-hint: Benchmark means a software speed test */
wxDialogWrapper( parent, 0, _("Benchmark"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxDEFAULT_DIALOG_STYLE |
wxRESIZE_BORDER) wxRESIZE_BORDER)
@ -167,28 +166,30 @@ void BenchmarkDialog::MakeBenchmarkDialog()
S.StartMultiColumn(4); S.StartMultiColumn(4);
{ {
// //
item = S.Id(BlockSizeID).AddTextBox(wxT("Disk Block Size (KB):"), item = S.Id(BlockSizeID).AddTextBox(_("Disk Block Size (KB):"),
wxT(""), wxT(""),
12); 12);
item->SetValidator(wxTextValidator(wxFILTER_NUMERIC, item->SetValidator(wxTextValidator(wxFILTER_NUMERIC,
&mBlockSizeStr)); &mBlockSizeStr));
// //
item = S.Id(NumEditsID).AddTextBox(wxT("Number of Edits:"), item = S.Id(NumEditsID).AddTextBox(_("Number of Edits:"),
wxT(""), wxT(""),
12); 12);
item->SetValidator(wxTextValidator(wxFILTER_NUMERIC, item->SetValidator(wxTextValidator(wxFILTER_NUMERIC,
&mNumEditsStr)); &mNumEditsStr));
// //
item = S.Id(DataSizeID).AddTextBox(wxT("Test Data Size (MB):"), item = S.Id(DataSizeID).AddTextBox(_("Test Data Size (MB):"),
wxT(""), wxT(""),
12); 12);
item->SetValidator(wxTextValidator(wxFILTER_NUMERIC, item->SetValidator(wxTextValidator(wxFILTER_NUMERIC,
&mDataSizeStr)); &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(""), wxT(""),
12); 12);
item->SetValidator(wxTextValidator(wxFILTER_NUMERIC, item->SetValidator(wxTextValidator(wxFILTER_NUMERIC,
@ -198,18 +199,19 @@ void BenchmarkDialog::MakeBenchmarkDialog()
S.EndMultiColumn(); 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")); wxT("false"));
item->SetValidator(wxGenericValidator(&mBlockDetail)); 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")); wxT("false"));
item->SetValidator(wxGenericValidator(&mEditDetail)); item->SetValidator(wxGenericValidator(&mEditDetail));
// //
mText = S.Id(StaticTextID).AddTextWindow(wxT("")); mText = S.Id(StaticTextID).AddTextWindow(wxT(""));
mText->SetName(wxT("Output")); /* i18n-hint noun */
mText->SetName(_("Output"));
mText->SetSizeHints(wxSize(500,200)); mText->SetSizeHints(wxSize(500,200));
// //
@ -218,9 +220,10 @@ void BenchmarkDialog::MakeBenchmarkDialog()
{ {
S.StartHorizontalLay(wxALIGN_LEFT, false); S.StartHorizontalLay(wxALIGN_LEFT, false);
{ {
S.Id(RunID).AddButton(wxT("Run"))->SetDefault(); S.Id(RunID).AddButton(_("Run"))->SetDefault();
S.Id(BSaveID).AddButton(wxT("Save")); S.Id(BSaveID).AddButton(_("Save"));
S.Id(ClearID).AddButton(wxT("Clear")); /* i18n-hint verb; to empty or erase */
S.Id(ClearID).AddButton(_("Clear"));
} }
S.EndHorizontalLay(); S.EndHorizontalLay();
@ -232,7 +235,8 @@ void BenchmarkDialog::MakeBenchmarkDialog()
S.StartHorizontalLay(wxALIGN_NOT | wxALIGN_LEFT, false); 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(); S.EndHorizontalLay();
} }
@ -246,10 +250,12 @@ void BenchmarkDialog::MakeBenchmarkDialog()
void BenchmarkDialog::OnSave( wxCommandEvent & WXUNUSED(event)) 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, fName = FileNames::SelectFile(FileNames::Operation::Export,
wxT("Export Benchmark Data As:"), _("Export Benchmark Data as:"),
wxEmptyString, wxEmptyString,
fName, fName,
wxT("txt"), wxT("txt"),
@ -317,17 +323,17 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
mRandSeedStr.ToLong(&randSeed); mRandSeedStr.ToLong(&randSeed);
if (blockSize < 1 || blockSize > 1024) { 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; return;
} }
if (numEdits < 1 || numEdits > 10000) { 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; return;
} }
if (dataSize < 1 || dataSize > 2000) { 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; return;
} }
@ -371,8 +377,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
// They are (and are supposed to be) a different size to // They are (and are supposed to be) a different size to
// the blocks that make the blockfiles. That way we get to // the blocks that make the blockfiles. That way we get to
// do some testing of when edit chunks cross blockfile boundaries. // do some testing of when edit chunks cross blockfile boundaries.
Printf(wxT("Using %d chunks of %d samples each, for a total of ") Printf(_("Using %d chunks of %d samples each, for a total of %.1f MB.\n"),
wxT("%.1f MB.\n"),
nChunks, chunkSize, nChunks*chunkSize*sizeof(short)/1048576.0); nChunks, chunkSize, nChunks*chunkSize*sizeof(short)/1048576.0);
int trials = numEdits; int trials = numEdits;
@ -381,7 +386,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
Shorts small1{ nChunks }; Shorts small1{ nChunks };
Shorts block{ chunkSize }; Shorts block{ chunkSize };
Printf(wxT("Preparing...\n")); Printf(_("Preparing...\n"));
wxTheApp->Yield(); wxTheApp->Yield();
FlushPrint(); FlushPrint();
@ -409,12 +414,12 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
t->GetEndTime(); t->GetEndTime();
if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != nChunks * chunkSize) { 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()); t->GetClipByIndex(0)->GetSequence()->GetNumSamples().as_long_long());
goto fail; goto fail;
} }
Printf(wxT("Performing %d edits...\n"), trials); Printf(_("Performing %d edits...\n"), trials);
wxTheApp->Yield(); wxTheApp->Yield();
FlushPrint(); FlushPrint();
@ -428,17 +433,17 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
// 1 <= xlen <= nChunks - x0 // 1 <= xlen <= nChunks - x0
const size_t xlen = 1 + (rand() % (nChunks - x0)); const size_t xlen = 1 + (rand() % (nChunks - x0));
if (mEditDetail) 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; Track::Holder tmp;
try { try {
tmp = t->Cut(double (x0 * chunkSize), double ((x0 + xlen) * chunkSize)); tmp = t->Cut(double (x0 * chunkSize), double ((x0 + xlen) * chunkSize));
} }
catch (const AudacityException&) { catch (const AudacityException&) {
Printf(wxT("Trial %d\n"), z); Printf(_("Trial %d\n"), z);
Printf(wxT("Cut (%d, %d) failed.\n"), (x0 * chunkSize), Printf(_("Cut (%d, %d) failed.\n"), (x0 * chunkSize),
(x0 + xlen) * 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()); t->GetClipByIndex(0)->GetSequence()->GetNumSamples().as_long_long());
goto fail; goto fail;
} }
@ -448,19 +453,19 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
const size_t y0 = rand() % (nChunks - xlen + 1); const size_t y0 = rand() % (nChunks - xlen + 1);
if (mEditDetail) if (mEditDetail)
Printf(wxT("Paste: %d\n"), y0 * chunkSize); Printf(_("Paste: %d\n"), y0 * chunkSize);
try { try {
t->Paste((double)(y0 * chunkSize), tmp.get()); t->Paste((double)(y0 * chunkSize), tmp.get());
} }
catch (const AudacityException&) { catch (const AudacityException&) {
Printf(wxT("Trial %d\nFailed on Paste.\n"), z); Printf(_("Trial %d\nFailed on Paste.\n"), z);
goto fail; goto fail;
} }
if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != nChunks * chunkSize) { if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != nChunks * chunkSize) {
Printf(wxT("Trial %d\n"), z); Printf(_("Trial %d\n"), z);
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()); t->GetClipByIndex(0)->GetSequence()->GetNumSamples().as_long_long());
goto fail; goto fail;
} }
@ -479,19 +484,19 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
seq->DebugPrintf(seq->GetBlockArray(), seq->GetNumSamples(), &tempStr); seq->DebugPrintf(seq->GetBlockArray(), seq->GetNumSamples(), &tempStr);
mToPrint += 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(); FlushPrint();
wxTheApp->Yield(); wxTheApp->Yield();
#if 0 #if 0
Printf(wxT("Checking file pointer leaks:\n")); Printf(_("Checking file pointer leaks:\n"));
Printf(wxT("Track # blocks: %d\n"), t->GetBlockArray()->Count()); Printf(_("Track # blocks: %d\n"), t->GetBlockArray()->Count());
Printf(wxT("Disk # blocks: \n")); Printf(_("Disk # blocks: \n"));
system("ls .audacity_temp/* | wc --lines"); system("ls .audacity_temp/* | wc --lines");
#endif #endif
Printf(wxT("Doing correctness check...\n")); Printf(_("Doing correctness check...\n"));
FlushPrint(); FlushPrint();
wxTheApp->Yield(); wxTheApp->Yield();
@ -504,19 +509,19 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
if (block[b] != v) { if (block[b] != v) {
bad++; bad++;
if (bad < 10) if (bad < 10)
Printf(wxT("Bad: chunk %d sample %d\n"), i, b); Printf(_("Bad: chunk %d sample %d\n"), i, b);
b = chunkSize; b = chunkSize;
} }
} }
if (bad == 0) if (bad == 0)
Printf(wxT("Passed correctness check!\n")); Printf(_("Passed correctness check!\n"));
else else
Printf(wxT("Errors in %d/%d chunks\n"), bad, nChunks); Printf(_("Errors in %d/%d chunks\n"), bad, nChunks);
elapsed = timer.Time(); elapsed = timer.Time();
Printf(wxT("Time to check all data: %ld ms\n"), elapsed); Printf(_("Time to check all data: %ld ms\n"), elapsed);
Printf(wxT("Reading data again...\n")); Printf(_("Reading data again...\n"));
wxTheApp->Yield(); wxTheApp->Yield();
FlushPrint(); FlushPrint();
@ -533,21 +538,20 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
elapsed = timer.Time(); 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") Printf(_("At 44100 Hz, 16-bits per sample, the estimated number of\n simultaneous tracks that could be played at once: %.1f\n"),
wxT("simultaneous tracks that could be played at once: %.1f\n"),
(nChunks*chunkSize/44100.0)/(elapsed/1000.0)); (nChunks*chunkSize/44100.0)/(elapsed/1000.0));
goto success; goto success;
fail: fail:
Printf(wxT("TEST FAILED!!!\n")); Printf(_("TEST FAILED!!!\n"));
success: success:
dd.reset(); dd.reset();
Printf(wxT("Benchmark completed successfully.\n")); Printf(_("Benchmark completed successfully.\n"));
HoldPrint(false); HoldPrint(false);
} }