ShuttleGui::AddFixedText takes TranslatableString

This commit is contained in:
Paul Licameli 2019-12-22 19:55:59 -05:00
parent acd1158e1b
commit 13417b6d5b
19 changed files with 71 additions and 45 deletions

View File

@ -268,8 +268,8 @@ void ApplyMacroDialog::ApplyMacroToProject( int iMacro, bool bHasGui )
S.StartStatic( {}, false); // deliberately not translated (!)
{
S.SetBorder(20);
S.AddFixedText(wxString::Format(_("Applying '%s' to current project"),
name));
S.AddFixedText(XO("Applying '%s' to current project")
.Format( name ) );
}
S.EndStatic();
}

View File

@ -579,7 +579,7 @@ void FFmpegNotFoundDialog::PopulateOrExchange(ShuttleGui & S)
S.SetBorder(10);
S.StartVerticalLay(true);
{
S.AddFixedText(_(
S.AddFixedText(XO(
"Audacity attempted to use FFmpeg to import an audio file,\n\
but the libraries were not found.\n\n\
To use FFmpeg import, go to Edit > Preferences > Libraries\n\

View File

@ -250,7 +250,7 @@ void LabelDialog::Populate()
void LabelDialog::PopulateOrExchange( ShuttleGui & S )
{
S.AddFixedText(_("Press F2 or double click to edit cell contents."));
S.AddFixedText(XO("Press F2 or double click to edit cell contents."));
S.StartHorizontalLay(wxEXPAND,1);
{
S.StartVerticalLay(wxEXPAND,1);

View File

@ -426,17 +426,20 @@ wxChoice * ShuttleGuiBase::AddChoice( const TranslatableString &Prompt,
Prompt, choices, make_iterator_range( choices ).index( Selected ) );
}
void ShuttleGuiBase::AddFixedText(const wxString &Str, bool bCenter, int wrapWidth)
void ShuttleGuiBase::AddFixedText(
const TranslatableString &Str, bool bCenter, int wrapWidth)
{
const auto translated = Str.Translation();
UseUpId();
if( mShuttleMode != eIsCreating )
return;
auto text = safenew wxStaticText(GetParent(), miId, Str, wxDefaultPosition, wxDefaultSize,
auto text = safenew wxStaticText(GetParent(),
miId, translated, wxDefaultPosition, wxDefaultSize,
GetStyle( wxALIGN_LEFT ));
mpWind = text;
if ( wrapWidth > 0 )
text->Wrap( wrapWidth );
mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
mpWind->SetName(wxStripMenuCodes(translated)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
if( bCenter )
{
miProp=1;

View File

@ -342,7 +342,8 @@ public:
wxMenu * AddMenu( const wxString & Title );
void AddIcon( wxBitmap * pBmp);
void AddIconButton( const wxString & Command, const wxString & Params,wxBitmap * pBmp );
void AddFixedText( const wxString & Str, bool bCenter = false, int wrapWidth = 0 );
void AddFixedText(
const TranslatableString & Str, bool bCenter = false, int wrapWidth = 0 );
void AddConstTextBox(
const TranslatableString &Caption, const TranslatableString & Value );

View File

@ -235,13 +235,13 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
// Headings
S.AddFixedText( {} ); // spacer
S.AddFixedText(_("Start"));
S.AddFixedText(_("End"));
S.AddFixedText(XO("Start"));
S.AddFixedText(XO("End"));
S.AddFixedText( {} ); // spacer
S.AddFixedText(_("Volume "));
S.AddFixedText(XO("Volume "));
//Foreground
S.AddFixedText(_("&Foreground:"), false);
S.AddFixedText(XO("&Foreground:"), false);
if (S.GetMode() == eIsCreating)
{
mForegroundStartT = safenew
@ -275,7 +275,7 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
.AddTextBox( {}, wxT(""), 17);
//Background
S.AddFixedText(_("&Background:"));
S.AddFixedText(XO("&Background:"));
if (S.GetMode() == eIsCreating)
{
mBackgroundStartT = safenew
@ -318,7 +318,7 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
S.StartMultiColumn(3, wxCENTER);
{
auto label = XO("Co&ntrast Result:");
S.AddFixedText(label.Translation());
S.AddFixedText(label);
mPassFailText = S.Id(ID_RESULTS_TEXT)
.Name(label)
.ConnectRoot(wxEVT_KEY_DOWN,
@ -327,7 +327,7 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
m_pButton_Reset = S.Id(ID_BUTTON_RESET).AddButton(XO("R&eset"));
label = XO("&Difference:");
S.AddFixedText(label.Translation());
S.AddFixedText(label);
mDiffText = S.Id(ID_RESULTSDB_TEXT)
.Name(label)
.ConnectRoot(wxEVT_KEY_DOWN,
@ -344,7 +344,7 @@ ContrastDialog::ContrastDialog(wxWindow * parent, wxWindowID id,
{
S.SetStretchyCol(1);
m_pButton_GetURL = S.Id(ID_BUTTON_GETURL).AddButton(XO("&Help"));
S.AddFixedText(wxT(" ")); // spacer
S.AddFixedText({}); // spacer
m_pButton_Close = S.Id(ID_BUTTON_CLOSE).AddButton(XO("&Close"));
}
S.EndMultiColumn();

View File

@ -352,7 +352,7 @@ void EffectDtmf::PopulateOrExchange(ShuttleGui & S)
S.Name(XO("Duration"))
.AddWindow(mDtmfDurationT);
S.AddFixedText(_("Tone/silence ratio:"), false);
S.AddFixedText(XO("Tone/silence ratio:"), false);
mDtmfDutyCycleS = S.Id(ID_DutyCycle)
.Style(wxSL_HORIZONTAL | wxEXPAND)
.MinSize( { -1, -1 } )
@ -365,16 +365,16 @@ void EffectDtmf::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(2, wxCENTER);
{
S.AddFixedText(_("Duty cycle:"), false);
S.AddFixedText(XO("Duty cycle:"), false);
mDtmfDutyT =
S.AddVariableText(XO("%.1f %%").Format( dtmfDutyCycle ), false);
S.AddFixedText(_("Tone duration:"), false);
S.AddFixedText(XO("Tone duration:"), false);
mDtmfSilenceT =
/* i18n-hint milliseconds */
S.AddVariableText(XO("%.0f ms").Format( dtmfTone * 1000.0 ), false);
S.AddFixedText(_("Silence duration:"), false);
S.AddFixedText(XO("Silence duration:"), false);
mDtmfToneT =
/* i18n-hint milliseconds */
S.AddVariableText(XO("%0.f ms").Format( dtmfSilence * 1000.0 ), false);

View File

@ -2651,7 +2651,7 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S)
S.StartHorizontalLay(wxALIGN_LEFT, 0);
{
S.AddSpace(0, 10);
S.AddFixedText( ctrl.label, false );
S.AddFixedText( Verbatim( ctrl.label ), false );
}
S.EndHorizontalLay();
S.StartMultiColumn(4);

View File

@ -1553,10 +1553,10 @@ void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S)
{
S.SetStretchyCol(1);
S.SetStretchyCol(3);
S.Id(FEFormatLabelID).AddFixedText(_("Format:"));
S.Id(FEFormatLabelID).AddFixedText(XO("Format:"));
mFormatName = S.Id(FEFormatNameID).AddVariableText( {} );
/* i18n-hint: "codec" is short for a "coder-decoder" algorithm */
S.Id(FECodecLabelID).AddFixedText(_("Codec:"));
S.Id(FECodecLabelID).AddFixedText(XO("Codec:"));
mCodecName = S.Id(FECodecNameID).AddVariableText( {} );
}
S.EndMultiColumn();

View File

@ -91,7 +91,8 @@ public:
QuickFixDialog(wxWindow * pParent);
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void AddStuck( ShuttleGui & S, bool & bBool, wxString Pref, wxString Prompt, wxString Help );
void AddStuck( ShuttleGui & S, bool & bBool, wxString Pref,
const TranslatableString &Prompt, wxString Help );
void OnOk(wxCommandEvent &event);
void OnCancel(wxCommandEvent &event);
@ -145,7 +146,9 @@ QuickFixDialog::QuickFixDialog(wxWindow * pParent) :
Center();
}
void QuickFixDialog::AddStuck( ShuttleGui & S, bool & bBool, wxString Pref, wxString Prompt, wxString Help )
void QuickFixDialog::AddStuck(
ShuttleGui & S, bool & bBool, wxString Pref,
const TranslatableString &Prompt, wxString Help )
{
mItem++;
if( !bBool)
@ -176,7 +179,7 @@ void QuickFixDialog::PopulateOrExchange(ShuttleGui & S)
if( !bStuckInMode ){
SetLabel(XO("Nothing to do"));
S.AddFixedText(_("No quick, easily fixed problems were found"));
S.AddFixedText(XO("No quick, easily fixed problems were found"));
}
else {
S.StartMultiColumn(3, wxALIGN_CENTER);
@ -185,9 +188,13 @@ void QuickFixDialog::PopulateOrExchange(ShuttleGui & S)
// Use # in the URLs to ensure we go to the online version of help.
// Local help may well not be installed.
AddStuck( S, mbSyncLocked, "/GUI/SyncLockTracks", _("Clocks on the Tracks"), "Quick_Fix#sync_lock" );
AddStuck( S, mbInSnapTo, "/SnapTo", _("Can't select precisely"), "Quick_Fix#snap_to" );
AddStuck( S, mbSoundActivated, "/AudioIO/SoundActivatedRecord", _("Recording stops and starts"), "Quick_Fix#sound_activated_recording" );
AddStuck( S, mbSyncLocked, "/GUI/SyncLockTracks",
XO("Clocks on the Tracks"), "Quick_Fix#sync_lock" );
AddStuck( S, mbInSnapTo, "/SnapTo",
XO("Can't select precisely"), "Quick_Fix#snap_to" );
AddStuck( S, mbSoundActivated, "/AudioIO/SoundActivatedRecord",
XO("Recording stops and starts"),
"Quick_Fix#sound_activated_recording" );
}
S.EndMultiColumn();
}

View File

@ -142,7 +142,7 @@ void DevicePrefs::PopulateOrExchange(ShuttleGui & S)
);
S.AddPrompt(_("Using:"));
S.AddFixedText(wxString(wxSafeConvertMB2WX(Pa_GetVersionText())));
S.AddFixedText( Verbatim(wxSafeConvertMB2WX(Pa_GetVersionText() ) ) );
}
S.EndMultiColumn();
}

View File

@ -111,7 +111,7 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui & S)
S.EndMultiColumn();
S.StartHorizontalLay(wxEXPAND);
{
S.Prop(0).AddFixedText(_("Free Space:"));
S.Prop(0).AddFixedText(XO("Free Space:"));
mFreeSpace = S.Prop(0).AddVariableText( {} );
S.Prop(10).AddSpace( 10 );
S.Id(ChooseButtonID).Prop(0).AddButton(XO("C&hoose..."));

View File

@ -286,7 +286,7 @@ void KeyConfigPrefs::PopulateOrExchange(ShuttleGui & S)
S.EndThreeColumn();
#if defined(__WXMAC__)
S.AddFixedText(_("Note: Pressing Cmd+Q will quit. All other keys are valid."));
S.AddFixedText(XO("Note: Pressing Cmd+Q will quit. All other keys are valid."));
#endif
S.StartThreeColumn();

View File

@ -114,11 +114,19 @@ void ModulePrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic( {} );
{
S.AddFixedText(_("These are experimental modules. Enable them only if you've read the Audacity Manual\nand know what you are doing.") );
S.AddFixedText(wxString(wxT(" ")) + _("'Ask' means Audacity will ask if you want to load the module each time it starts.") );
S.AddFixedText(wxString(wxT(" ")) + _("'Failed' means Audacity thinks the module is broken and won't run it.") );
S.AddFixedText(wxString(wxT(" ")) + _("'New' means no choice has been made yet.") );
S.AddFixedText(_("Changes to these settings only take effect when Audacity starts up."));
S.AddFixedText(XO(
"These are experimental modules. Enable them only if you've read the Audacity Manual\nand know what you are doing.") );
S.AddFixedText(XO(
/* i18n-hint preserve the leading spaces */
" 'Ask' means Audacity will ask if you want to load the module each time it starts.") );
S.AddFixedText(XO(
/* i18n-hint preserve the leading spaces */
" 'Failed' means Audacity thinks the module is broken and won't run it.") );
S.AddFixedText(XO(
/* i18n-hint preserve the leading spaces */
" 'New' means no choice has been made yet.") );
S.AddFixedText(XO(
"Changes to these settings only take effect when Audacity starts up."));
{
S.StartMultiColumn( 2 );
int i;
@ -137,7 +145,7 @@ void ModulePrefs::PopulateOrExchange(ShuttleGui & S)
}
if( mModules.size() < 1 )
{
S.AddFixedText( _("No modules were found") );
S.AddFixedText( XO("No modules were found") );
}
}
S.EndStatic();

View File

@ -143,6 +143,7 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
}
S.EndStatic();
/* i18n-hint: start of two-part phrase, "Name newly recorded tracks with:" */
S.StartStatic(XO("Name newly recorded tracks"));
{
// Nested multicolumns to indent by 'With:' width, in a way that works if
@ -150,7 +151,8 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
// This extra step is worth doing to get the check boxes lined up nicely.
S.StartMultiColumn( 2 );
{
S.AddFixedText(_("With:")) ;
/* i18n-hint: end of two-part phrase, "Name newly recorded tracks with:" */
S.AddFixedText(XO("With:")) ;
S.StartMultiColumn(3);
{
S.Id(UseCustomTrackNameID).TieCheckBox(_("Custom Track &Name"),
@ -165,6 +167,7 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
_("Recorded_Audio")},
30);
}
S.EndMultiColumn();
S.AddFixedText( {} );

View File

@ -110,17 +110,20 @@ void ThemePrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic(XO("Info"));
{
S.AddFixedText(
_("Themability is an experimental feature.\n\nTo try it out, click \"Save Theme Cache\" then find and modify the images and colors in\nImageCacheVxx.png using an image editor such as the Gimp.\n\nClick \"Load Theme Cache\" to load the changed images and colors back into Audacity.\n\n(Only the Transport Toolbar and the colors on the wavetrack are currently affected, even\nthough the image file shows other icons too.)")
XO(
"Themability is an experimental feature.\n\nTo try it out, click \"Save Theme Cache\" then find and modify the images and colors in\nImageCacheVxx.png using an image editor such as the Gimp.\n\nClick \"Load Theme Cache\" to load the changed images and colors back into Audacity.\n\n(Only the Transport Toolbar and the colors on the wavetrack are currently affected, even\nthough the image file shows other icons too.)")
);
#ifdef __WXDEBUG__
S.AddFixedText(
_("This is a debug version of Audacity, with an extra button, 'Output Sourcery'. This will save a\nC version of the image cache that can be compiled in as a default.")
Verbatim(
"This is a debug version of Audacity, with an extra button, 'Output Sourcery'. This will save a\nC version of the image cache that can be compiled in as a default.")
);
#endif
S.AddFixedText(
_("Saving and loading individual theme files uses a separate file for each image, but is\notherwise the same idea.")
XO(
"Saving and loading individual theme files uses a separate file for each image, but is\notherwise the same idea.")
);
}
S.EndStatic();

View File

@ -63,7 +63,7 @@ ErrorDialog::ErrorDialog(
S.StartVerticalLay();
{
S.SetBorder( 20 );
S.AddFixedText( message.Translation() );
S.AddFixedText( message );
S.SetBorder( 2 );
S.AddStandardButtons( buttonMask );
}

View File

@ -2002,7 +2002,8 @@ void MeterPanel::OnPreferences(wxCommandEvent & WXUNUSED(event))
{
S.StartStatic(XO("Refresh Rate"), 0);
{
S.AddFixedText(_("Higher refresh rates make the meter show more frequent\nchanges. A rate of 30 per second or less should prevent\nthe meter affecting audio quality on slower machines."));
S.AddFixedText(XO(
"Higher refresh rates make the meter show more frequent\nchanges. A rate of 30 per second or less should prevent\nthe meter affecting audio quality on slower machines."));
S.StartHorizontalLay();
{
rate = S.Name(XO("Meter refresh rate per second [1-100]"))

View File

@ -72,7 +72,7 @@ WarningDialog::WarningDialog(wxWindow *parent, const TranslatableString &message
S.SetBorder(10);
S.StartVerticalLay(false);
{
S.AddFixedText(message.Translation());
S.AddFixedText(message);
mCheckBox = S.AddCheckBox(footer.Translation(), false);
}
S.EndVerticalLay();