1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 07:59: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)
{
/*
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);
}