1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-08 16:11:14 +02:00

Some more uses of TranslatableString

This commit is contained in:
Paul Licameli 2019-12-21 12:49:06 -05:00
commit 1399f12c00
24 changed files with 131 additions and 145 deletions

View File

@ -207,7 +207,8 @@ void MacroCommandDialog::OnItemSelected(wxListEvent &event)
// Later we can put help information there, perhaps. // Later we can put help information there, perhaps.
// Macro command details are one place that we do expose Identifier // Macro command details are one place that we do expose Identifier
// to (more sophisticated) users // to (more sophisticated) users
mDetails->SetValue( mInternalCommandName.GET() + "\r\n" + command.category ); mDetails->SetValue(
mInternalCommandName.GET() + "\r\n" + command.category.Translation() );
mParameters->SetValue(params); mParameters->SetValue(params);
} }
@ -249,7 +250,8 @@ void MacroCommandDialog::SetCommandAndParams(const CommandID &Command, const wxS
// using GET to expose a CommandID to the user! // using GET to expose a CommandID to the user!
// Macro command details are one place that we do expose Identifier // Macro command details are one place that we do expose Identifier
// to (more sophisticated) users // to (more sophisticated) users
mDetails->SetValue( iter->name.Internal() + "\r\n" + iter->category ); mDetails->SetValue(
iter->name.Internal() + "\r\n" + iter->category.Translation() );
mChoices->SetItemState(iter - mCatalog.begin(), mChoices->SetItemState(iter - mCatalog.begin(),
wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);

View File

@ -295,7 +295,7 @@ MacroCommandsCatalog::MacroCommandsCatalog( const AudacityProject *project )
for( const auto &command : SpecialCommands ) for( const auto &command : SpecialCommands )
commands.push_back( { commands.push_back( {
{ command.second, command.first }, { command.second, command.first },
_("Special Command") XO("Special Command")
} ); } );
// end CLEANSPEECH remnant // end CLEANSPEECH remnant
@ -311,7 +311,7 @@ MacroCommandsCatalog::MacroCommandsCatalog( const AudacityProject *project )
commands.push_back( { commands.push_back( {
{ command, plug->GetSymbol().Msgid() }, { command, plug->GetSymbol().Msgid() },
plug->GetPluginType() == PluginTypeEffect ? plug->GetPluginType() == PluginTypeEffect ?
_("Effect") : _("Menu Command (With Parameters)") XO("Effect") : XO("Menu Command (With Parameters)")
} ); } );
plug = pm.GetNextPlugin(PluginTypeEffect|PluginTypeAudacityCommand); plug = pm.GetNextPlugin(PluginTypeEffect|PluginTypeAudacityCommand);
} }
@ -367,7 +367,7 @@ MacroCommandsCatalog::MacroCommandsCatalog( const AudacityProject *project )
mNames[i], // Internal name. mNames[i], // Internal name.
label // User readable name label // User readable name
}, },
_("Menu Command (No Parameters)") XO("Menu Command (No Parameters)")
} }
); );
} }

View File

@ -30,7 +30,7 @@ public:
// A triple of user-visible name, internal string identifier and type/help string. // A triple of user-visible name, internal string identifier and type/help string.
struct Entry { struct Entry {
ComponentInterfaceSymbol name; ComponentInterfaceSymbol name;
wxString category; TranslatableString category;
}; };
using Entries = std::vector<Entry>; using Entries = std::vector<Entry>;

View File

@ -965,8 +965,8 @@ void MacrosWindow::OnAdd(wxCommandEvent & WXUNUSED(event))
{ {
while (true) { while (true) {
AudacityTextEntryDialog d(this, AudacityTextEntryDialog d(this,
_("Enter name of new macro"), XO("Enter name of new macro"),
_("Name of new macro")); XO("Name of new macro"));
d.SetName(d.GetTitle()); d.SetName(d.GetTitle());
wxString name; wxString name;

View File

@ -59,11 +59,11 @@ void Generate(wxDebugReport::Context ctx)
if (ok && rpt.Process()) if (ok && rpt.Process())
{ {
AudacityTextEntryDialog dlg(NULL, AudacityTextEntryDialog dlg(nullptr,
_("Report generated to:"), XO("Report generated to:"),
_("Audacity Support Data"), XO("Audacity Support Data"),
rpt.GetCompressedFileName(), rpt.GetCompressedFileName(),
wxOK | wxCENTER); wxOK | wxCENTER);
dlg.SetName(dlg.GetTitle()); dlg.SetName(dlg.GetTitle());
dlg.ShowModal(); dlg.ShowModal();

View File

@ -332,30 +332,39 @@ int NumWindowFuncs()
return eWinFuncCount; return eWinFuncCount;
} }
const wxChar *WindowFuncName(int whichFunction) const TranslatableString WindowFuncName(int whichFunction)
{ {
switch (whichFunction) { switch (whichFunction) {
default: default:
case eWinFuncRectangular: case eWinFuncRectangular:
return _("Rectangular"); return XO("Rectangular");
case eWinFuncBartlett: case eWinFuncBartlett:
return wxT("Bartlett"); /* i18n-hint a proper name */
return XO("Bartlett");
case eWinFuncHamming: case eWinFuncHamming:
return wxT("Hamming"); /* i18n-hint a proper name */
return XO("Hamming");
case eWinFuncHanning: case eWinFuncHanning:
return wxT("Hann"); /* i18n-hint a proper name */
return XO("Hann");
case eWinFuncBlackman: case eWinFuncBlackman:
return wxT("Blackman"); /* i18n-hint a proper name */
return XO("Blackman");
case eWinFuncBlackmanHarris: case eWinFuncBlackmanHarris:
return wxT("Blackman-Harris"); /* i18n-hint two proper names */
return XO("Blackman-Harris");
case eWinFuncWelch: case eWinFuncWelch:
return wxT("Welch"); /* i18n-hint a proper name */
return XO("Welch");
case eWinFuncGaussian25: case eWinFuncGaussian25:
return wxT("Gaussian(a=2.5)"); /* i18n-hint a mathematical function named for C. F. Gauss */
return XO("Gaussian(a=2.5)");
case eWinFuncGaussian35: case eWinFuncGaussian35:
return wxT("Gaussian(a=3.5)"); /* i18n-hint a mathematical function named for C. F. Gauss */
return XO("Gaussian(a=3.5)");
case eWinFuncGaussian45: case eWinFuncGaussian45:
return wxT("Gaussian(a=4.5)"); /* i18n-hint a mathematical function named for C. F. Gauss */
return XO("Gaussian(a=4.5)");
} }
} }

View File

@ -34,6 +34,8 @@
#include <wx/defs.h> #include <wx/defs.h>
class TranslatableString;
/* /*
Salvo Ventura - November 2006 Salvo Ventura - November 2006
Added more window functions: Added more window functions:
@ -138,7 +140,7 @@ void DerivativeOfWindowFunc(int whichFunction, size_t NumSamples, bool extraSamp
* Returns the name of the windowing function (for UI display) * Returns the name of the windowing function (for UI display)
*/ */
const wxChar *WindowFuncName(int whichFunction); const TranslatableString WindowFuncName(int whichFunction);
/* /*
* Returns the number of windowing functions supported * Returns the number of windowing functions supported

View File

@ -241,10 +241,11 @@ FrequencyPlotDialog::FrequencyPlotDialog(wxWindow * parent, wxWindowID id,
wxArrayStringEx funcChoices; wxArrayStringEx funcChoices;
for (int i = 0, cnt = NumWindowFuncs(); i < cnt; i++) for (int i = 0, cnt = NumWindowFuncs(); i < cnt; i++)
{ {
/* i18n-hint: This refers to a "window function", funcChoices.push_back(
* such as Hann or Rectangular, used in the /* i18n-hint: This refers to a "window function",
* Frequency analyze dialog box. */ * such as Hann or Rectangular, used in the
funcChoices.push_back(wxString::Format("%s window", WindowFuncName(i) ) ); * Frequency analyze dialog box. */
XO("%s window").Format( WindowFuncName(i) ).Translation() );
} }
wxArrayStringEx axisChoices{ wxArrayStringEx axisChoices{
@ -949,35 +950,32 @@ void FrequencyPlotDialog::PlotPaint(wxPaintEvent & event)
value = mAnalyst->GetProcessedValue(xPos, xPos + xStep); value = mAnalyst->GetProcessedValue(xPos, xPos + xStep);
} }
wxString cursor; TranslatableString cursor;
wxString peak; TranslatableString peak;
wxString xpitch;
wxString peakpitch;
const wxChar *xp;
const wxChar *pp;
if (mAlg == SpectrumAnalyst::Spectrum) { if (mAlg == SpectrumAnalyst::Spectrum) {
xpitch = PitchName_Absolute(FreqToMIDInote(xPos)); auto xp = PitchName_Absolute(FreqToMIDInote(xPos));
peakpitch = PitchName_Absolute(FreqToMIDInote(bestpeak)); auto pp = PitchName_Absolute(FreqToMIDInote(bestpeak));
xp = xpitch;
pp = peakpitch;
/* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#*/ /* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#*/
cursor.Printf(_("%d Hz (%s) = %d dB"), (int)(xPos + 0.5), xp, (int)(value + 0.5)); cursor = XO("%d Hz (%s) = %d dB")
peak.Printf(_("%d Hz (%s) = %.1f dB"), (int)(bestpeak + 0.5), pp, bestValue); .Format( (int)(xPos + 0.5), xp, (int)(value + 0.5));
/* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#*/
peak = XO("%d Hz (%s) = %.1f dB")
.Format( (int)(bestpeak + 0.5), pp, bestValue );
} else if (xPos > 0.0 && bestpeak > 0.0) { } else if (xPos > 0.0 && bestpeak > 0.0) {
xpitch = PitchName_Absolute(FreqToMIDInote(1.0 / xPos)); auto xp = PitchName_Absolute(FreqToMIDInote(1.0 / xPos));
peakpitch = PitchName_Absolute(FreqToMIDInote(1.0 / bestpeak)); auto pp = PitchName_Absolute(FreqToMIDInote(1.0 / bestpeak));
xp = xpitch;
pp = peakpitch;
/* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A# /* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#
* the %.4f are numbers, and 'sec' should be an abbreviation for seconds */ * the %.4f are numbers, and 'sec' should be an abbreviation for seconds */
cursor.Printf(_("%.4f sec (%d Hz) (%s) = %f"), cursor = XO("%.4f sec (%d Hz) (%s) = %f")
xPos, (int)(1.0 / xPos + 0.5), xp, value); .Format( xPos, (int)(1.0 / xPos + 0.5), xp, value );
peak.Printf(_("%.4f sec (%d Hz) (%s) = %.3f"), /* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#
bestpeak, (int)(1.0 / bestpeak + 0.5), pp, bestValue); * the %.4f are numbers, and 'sec' should be an abbreviation for seconds */
peak = XO("%.4f sec (%d Hz) (%s) = %.3f")
.Format( bestpeak, (int)(1.0 / bestpeak + 0.5), pp, bestValue );
} }
mCursorText->SetValue(cursor); mCursorText->SetValue( cursor.Translation() );
mPeakText->SetValue(peak); mPeakText->SetValue( peak.Translation() );
} }
else { else {
mCursorText->SetValue(wxT("")); mCursorText->SetValue(wxT(""));

View File

@ -812,10 +812,10 @@ void LabelDialog::OnChangeTrack(wxGridEvent & WXUNUSED(event), int row, RowData
// User selected the "New..." choice so ask for a NEW name // User selected the "New..." choice so ask for a NEW name
if ( make_iterator_range( mTrackNames ).index( val ) == 0 ) { if ( make_iterator_range( mTrackNames ).index( val ) == 0 ) {
AudacityTextEntryDialog d(this, AudacityTextEntryDialog d(this,
_("New Label Track"), XO("New Label Track"),
_("Enter track name"), XO("Enter track name"),
/* i18n-hint: (noun) it's the name of a kind of track.*/ /* i18n-hint: (noun) it's the name of a kind of track.*/
_("Label Track")); XO("Label Track").Translation());
// User canceled so repopulating the grid will set the track // User canceled so repopulating the grid will set the track
// name to the orignal value // name to the orignal value

View File

@ -57,7 +57,7 @@ int PitchOctave(const double dMIDInote)
} }
wxString PitchName(const double dMIDInote, const PitchNameChoice choice) TranslatableString PitchName(const double dMIDInote, const PitchNameChoice choice)
{ {
static const TranslatableString sharpnames[12] = { static const TranslatableString sharpnames[12] = {
/* i18n-hint: Name of a musical note in the 12-tone chromatic scale */ /* i18n-hint: Name of a musical note in the 12-tone chromatic scale */
@ -148,14 +148,14 @@ wxString PitchName(const double dMIDInote, const PitchNameChoice choice)
default: wxASSERT(false); break; default: wxASSERT(false); break;
} }
return table[PitchIndex(dMIDInote)].Translation(); return table[PitchIndex(dMIDInote)];
} }
wxString PitchName_Absolute(const double dMIDInote, const PitchNameChoice choice) TranslatableString PitchName_Absolute(const double dMIDInote, const PitchNameChoice choice)
{ {
// The format string is not localized. Should it be? // The format string is not localized. Should it be?
return wxString::Format( return Verbatim( wxT("%s%d") )
wxT("%s%d"), PitchName(dMIDInote, choice), PitchOctave(dMIDInote) ); .Format( PitchName(dMIDInote, choice), PitchOctave(dMIDInote) );
} }
double PitchToMIDInote(const unsigned int nPitchIndex, const int nPitchOctave) double PitchToMIDInote(const unsigned int nPitchIndex, const int nPitchOctave)

View File

@ -18,7 +18,7 @@
#ifndef __AUDACITY_PITCHNAME__ #ifndef __AUDACITY_PITCHNAME__
#define __AUDACITY_PITCHNAME__ #define __AUDACITY_PITCHNAME__
class wxString; class TranslatableString;
// FreqToMIDInote takes a frequency in Hz (exponential scale relative to // FreqToMIDInote takes a frequency in Hz (exponential scale relative to
// alphabetic pitch names) and returns a pitch ID number (linear // alphabetic pitch names) and returns a pitch ID number (linear
@ -44,14 +44,14 @@ enum class PitchNameChoice { Sharps, Flats, Both };
// PitchName takes dMIDInote (per result from // PitchName takes dMIDInote (per result from
// FreqToMIDInote) and returns a standard pitch/note name [C, C#, etc.). // FreqToMIDInote) and returns a standard pitch/note name [C, C#, etc.).
wxString PitchName( TranslatableString PitchName(
const double dMIDInote, const double dMIDInote,
const PitchNameChoice choice = PitchNameChoice::Sharps ); const PitchNameChoice choice = PitchNameChoice::Sharps );
// PitchName_Absolute does the same thing as PitchName, but appends // PitchName_Absolute does the same thing as PitchName, but appends
// the octave number, e.g., instead of "C" it will return "C4" // the octave number, e.g., instead of "C" it will return "C4"
// if the dMIDInote corresonds to middle C, i.e., is 60. // if the dMIDInote corresonds to middle C, i.e., is 60.
wxString PitchName_Absolute( TranslatableString PitchName_Absolute(
const double dMIDInote, const double dMIDInote,
const PitchNameChoice choice = PitchNameChoice::Sharps); const PitchNameChoice choice = PitchNameChoice::Sharps);

View File

@ -735,33 +735,15 @@ private:
#define LABEL_GENRE XO("Genre") #define LABEL_GENRE XO("Genre")
#define LABEL_COMMENTS XO("Comments") #define LABEL_COMMENTS XO("Comments")
static wxArrayString names() static TranslatableStrings names{
{ LABEL_ARTIST,
static TranslatableString theNames[] = LABEL_TITLE,
{ LABEL_ALBUM,
LABEL_ARTIST, LABEL_TRACK,
LABEL_TITLE, LABEL_YEAR,
LABEL_ALBUM, LABEL_GENRE,
LABEL_TRACK, LABEL_COMMENTS
LABEL_YEAR, };
LABEL_GENRE,
LABEL_COMMENTS
};
class NamesArray final : public TranslatableStringArray
{
void Populate() override
{
for (auto &name : theNames)
mContents.push_back( name.Translation() );
}
};
static NamesArray theArray;
// Yes, return array by value
return theArray.Get();
}
static const struct static const struct
{ {
@ -911,7 +893,8 @@ void TagsEditorDialog::PopulateOrExchange(ShuttleGui & S)
mGrid->SetColLabelSize(mGrid->GetDefaultRowSize()); mGrid->SetColLabelSize(mGrid->GetDefaultRowSize());
auto cs = names(); auto cs = transform_container<wxArrayStringEx>(
names, std::mem_fn( &TranslatableString::Translation ) );
// Build the initial (empty) grid // Build the initial (empty) grid
mGrid->CreateGrid(0, 2); mGrid->CreateGrid(0, 2);

View File

@ -63,6 +63,4 @@ protected:
ArrayType mContents; ArrayType mContents;
}; };
typedef TranslatableArray<wxArrayStringEx> TranslatableStringArray;
#endif #endif

View File

@ -255,7 +255,7 @@ void EffectChangePitch::PopulateOrExchange(ShuttleGui & S)
wxArrayStringEx pitch; wxArrayStringEx pitch;
for (int ii = 0; ii < 12; ++ii) for (int ii = 0; ii < 12; ++ii)
pitch.push_back( PitchName( ii, PitchNameChoice::Both ) ); pitch.push_back( PitchName( ii, PitchNameChoice::Both ).Translation() );
S.SetBorder(5); S.SetBorder(5);
@ -265,8 +265,9 @@ void EffectChangePitch::PopulateOrExchange(ShuttleGui & S)
{ {
S.AddTitle(_("Change Pitch without Changing Tempo")); S.AddTitle(_("Change Pitch without Changing Tempo"));
S.AddTitle( S.AddTitle(
wxString::Format(_("Estimated Start Pitch: %s%d (%.3f Hz)"), XO("Estimated Start Pitch: %s%d (%.3f Hz)")
pitch[m_nFromPitch], m_nFromOctave, m_FromFrequency)); .Format( pitch[m_nFromPitch], m_nFromOctave, m_FromFrequency)
.Translation() );
} }
S.EndVerticalLay(); S.EndVerticalLay();

View File

@ -3516,8 +3516,8 @@ void EditCurvesDialog::OnRename(wxCommandEvent & WXUNUSED(event))
bad = false; bad = false;
// build the dialog // build the dialog
AudacityTextEntryDialog dlg( this, AudacityTextEntryDialog dlg( this,
wxString::Format( _("Rename '%s' to..."), mEditCurves[ item ].Name ), XO("Rename '%s' to...").Format( mEditCurves[ item ].Name ),
_("Rename...") ); XO("Rename...") );
dlg.SetTextValidator( wxFILTER_EXCLUDE_CHAR_LIST ); dlg.SetTextValidator( wxFILTER_EXCLUDE_CHAR_LIST );
dlg.SetName( dlg.SetName(
wxString::Format( _("Rename '%s'"), mEditCurves[ item ].Name ) ); wxString::Format( _("Rename '%s'"), mEditCurves[ item ].Name ) );

View File

@ -1111,20 +1111,22 @@ wxString ExportMultipleDialog::MakeFileName(const wxString &input)
if(changed) if(changed)
{ // need to get user to fix file name { // need to get user to fix file name
// build the dialog // build the dialog
wxString msg; TranslatableString msg;
wxString excluded = ::wxJoin( Internat::GetExcludedCharacters(), wxChar(' ') ); wxString excluded = ::wxJoin( Internat::GetExcludedCharacters(), wxChar(' ') );
// TODO: For Russian langauge we should have separate cases for 2 and more than 2 letters. // TODO: For Russian langauge we should have separate cases for 2 and more than 2 letters.
if( excluded.length() > 1 ){ if( excluded.length() > 1 ){
// i18n-hint: The second %s gives some letters that can't be used. // i18n-hint: The second %s gives some letters that can't be used.
msg.Printf(_("Label or track \"%s\" is not a legal file name. You cannot use any of: %s\nUse..."), input, msg = XO(
excluded); "Label or track \"%s\" is not a legal file name. You cannot use any of: %s\nUse...")
.Format( input, excluded );
} else { } else {
// i18n-hint: The second %s gives a letter that can't be used. // i18n-hint: The second %s gives a letter that can't be used.
msg.Printf(_("Label or track \"%s\" is not a legal file name. You cannot use \"%s\".\nUse..."), input, msg = XO(
excluded); "Label or track \"%s\" is not a legal file name. You cannot use \"%s\".\nUse...")
.Format( input, excluded );
} }
AudacityTextEntryDialog dlg( this, msg, _("Save As..."), newname ); AudacityTextEntryDialog dlg( this, msg, XO("Save As..."), newname );
// And tell the validator about excluded chars // And tell the validator about excluded chars

View File

@ -159,25 +159,17 @@ const TranslatableStrings &SpectrogramSettings::GetScaleNames()
} }
//static //static
const wxArrayStringEx &SpectrogramSettings::GetAlgorithmNames() const TranslatableStrings &SpectrogramSettings::GetAlgorithmNames()
{ {
class AlgorithmNamesArray final : public TranslatableStringArray static const TranslatableStrings results{
{ // Keep in correspondence with enum SpectrogramSettings::Algorithm:
void Populate() override XO("Frequencies") ,
{ /* i18n-hint: the Reassignment algorithm for spectrograms */
mContents.insert( mContents.end(), { XO("Reassignment") ,
// Keep in correspondence with enum SpectrogramSettings::Algorithm: /* i18n-hint: EAC abbreviates "Enhanced Autocorrelation" */
_("Frequencies") , XO("Pitch (EAC)") ,
/* i18n-hint: the Reassignment algorithm for spectrograms */
_("Reassignment") ,
/* i18n-hint: EAC abbreviates "Enhanced Autocorrelation" */
_("Pitch (EAC)") ,
} );
}
}; };
return results;
static AlgorithmNamesArray theArray;
return theArray.Get();
} }
bool SpectrogramSettings::Validate(bool quiet) bool SpectrogramSettings::Validate(bool quiet)

View File

@ -67,7 +67,7 @@ public:
}; };
static const TranslatableStrings &GetScaleNames(); static const TranslatableStrings &GetScaleNames();
static const wxArrayStringEx &GetAlgorithmNames(); static const TranslatableStrings &GetAlgorithmNames();
static SpectrogramSettings &defaults(); static SpectrogramSettings &defaults();
SpectrogramSettings(); SpectrogramSettings();

View File

@ -112,7 +112,7 @@ void SpectrumPrefs::Populate(size_t windowSize)
PopulatePaddingChoices(windowSize); PopulatePaddingChoices(windowSize);
for (int i = 0; i < NumWindowFuncs(); i++) { for (int i = 0; i < NumWindowFuncs(); i++) {
mTypeChoices.push_back(WindowFuncName(i)); mTypeChoices.push_back( WindowFuncName(i).Translation() );
} }
//------------------------- Main section -------------------- //------------------------- Main section --------------------
@ -242,7 +242,9 @@ void SpectrumPrefs::PopulateOrExchange(ShuttleGui & S)
mAlgorithmChoice = mAlgorithmChoice =
S.Id(ID_ALGORITHM).TieChoice(_("A&lgorithm:"), S.Id(ID_ALGORITHM).TieChoice(_("A&lgorithm:"),
mTempSettings.algorithm, mTempSettings.algorithm,
SpectrogramSettings::GetAlgorithmNames()); transform_container<wxArrayStringEx>(
SpectrogramSettings::GetAlgorithmNames(),
std::mem_fn( &TranslatableString::Translation ) ) );
S.Id(ID_WINDOW_SIZE).TieChoice(_("Window &size:"), S.Id(ID_WINDOW_SIZE).TieChoice(_("Window &size:"),
mTempSettings.windowSize, mTempSettings.windowSize,

View File

@ -110,7 +110,9 @@ void WaveformPrefs::PopulateOrExchange(ShuttleGui & S)
mScaleChoice = mScaleChoice =
S.Id(ID_SCALE).TieChoice(_("S&cale:"), S.Id(ID_SCALE).TieChoice(_("S&cale:"),
mTempSettings.scaleType, mTempSettings.scaleType,
WaveformSettings::GetScaleNames()); transform_container<wxArrayStringEx>(
WaveformSettings::GetScaleNames(),
std::mem_fn( &TranslatableString::Translation ) ) );
mRangeChoice = mRangeChoice =
S.Id(ID_RANGE).TieChoice(_("Waveform dB &range:"), S.Id(ID_RANGE).TieChoice(_("Waveform dB &range:"),

View File

@ -147,20 +147,14 @@ void WaveformSettings::NextHigherDBRange()
} }
//static //static
const wxArrayStringEx &WaveformSettings::GetScaleNames() const TranslatableStrings &WaveformSettings::GetScaleNames()
{ {
class ScaleNamesArray final : public TranslatableStringArray static const TranslatableStrings result{
{ // Keep in correspondence with enum WaveTrack::WaveTrackDisplay:
void Populate() override XO("Linear"),
{ XO("Logarithmic"),
// Keep in correspondence with enum WaveTrack::WaveTrackDisplay:
mContents.push_back(_("Linear"));
mContents.push_back(_("Logarithmic"));
}
}; };
return result;
static ScaleNamesArray theArray;
return theArray.Get();
} }
WaveformSettings::~WaveformSettings() WaveformSettings::~WaveformSettings()

View File

@ -11,7 +11,7 @@ Paul Licameli
#ifndef __AUDACITY_WAVEFORM_SETTINGS__ #ifndef __AUDACITY_WAVEFORM_SETTINGS__
#define __AUDACITY_WAVEFORM_SETTINGS__ #define __AUDACITY_WAVEFORM_SETTINGS__
class wxArrayStringEx; #include "../Internat.h" // for TranslatableStrings
class WaveformSettings class WaveformSettings
{ {
@ -58,7 +58,7 @@ public:
stNumScaleTypes, stNumScaleTypes,
}; };
static const wxArrayStringEx &GetScaleNames(); static const TranslatableStrings &GetScaleNames();
ScaleType scaleType; ScaleType scaleType;
int dBRange; int dBRange;

View File

@ -2085,8 +2085,8 @@ int LabelTrackView::DialogForLabelName(
position = trackPanel.ClientToScreen(position); position = trackPanel.ClientToScreen(position);
auto &window = GetProjectFrame( project ); auto &window = GetProjectFrame( project );
AudacityTextEntryDialog dialog{ &window, AudacityTextEntryDialog dialog{ &window,
_("Name:"), XO("Name:"),
_("New label"), XO("New label"),
initialValue, initialValue,
wxOK | wxCANCEL, wxOK | wxCANCEL,
position }; position };

View File

@ -69,13 +69,14 @@ class AudacityTextEntryDialog : public wxTabTraversalWrapper< wxTextEntryDialog
public: public:
AudacityTextEntryDialog( AudacityTextEntryDialog(
wxWindow *parent, wxWindow *parent,
const wxString& message, const TranslatableString& message,
const wxString& caption, // don't use = wxGetTextFromUserPromptStr, const TranslatableString& caption, // don't use = wxGetTextFromUserPromptStr,
const wxString& value = {}, const wxString& value = {},
long style = wxTextEntryDialogStyle, long style = wxTextEntryDialogStyle,
const wxPoint& pos = wxDefaultPosition) const wxPoint& pos = wxDefaultPosition)
: wxTabTraversalWrapper< wxTextEntryDialog> : wxTabTraversalWrapper< wxTextEntryDialog>(
( parent, message, caption, value, style, pos ) parent,
message.Translation(), caption.Translation(), value, style, pos )
{} {}
void SetInsertionPointEnd(); void SetInsertionPointEnd();