1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-19 17:40:51 +02:00

TranslatableString for title prefix in PrefsDialog...

... and the title strings do not include a trailing space
This commit is contained in:
Paul Licameli 2019-12-19 22:09:20 -05:00
parent 91ebadef81
commit a70524446e
4 changed files with 15 additions and 13 deletions

View File

@ -417,14 +417,14 @@ class wxTreebookExt final : public wxTreebook
{ {
public: public:
wxTreebookExt( wxWindow *parent, wxTreebookExt( wxWindow *parent,
wxWindowID id, const wxString &titlePrefix) wxWindowID id, const TranslatableString &titlePrefix)
: wxTreebook( parent, id ) : wxTreebook( parent, id )
, mTitlePrefix(titlePrefix) , mTitlePrefix(titlePrefix)
{;}; {;};
~wxTreebookExt(){;}; ~wxTreebookExt(){;};
int ChangeSelection(size_t n) override; int ChangeSelection(size_t n) override;
int SetSelection(size_t n) override; int SetSelection(size_t n) override;
const wxString mTitlePrefix; const TranslatableString mTitlePrefix;
}; };
@ -439,7 +439,7 @@ int wxTreebookExt::ChangeSelection(size_t n) {
int wxTreebookExt::SetSelection(size_t n) int wxTreebookExt::SetSelection(size_t n)
{ {
int i = wxTreebook::SetSelection(n); int i = wxTreebook::SetSelection(n);
wxString Temp = wxString(mTitlePrefix) + GetPageText( n ); auto Temp = mTitlePrefix.Translation() + wxT(" ") + GetPageText( n );
static_cast<wxDialog*>(GetParent())->SetTitle( Temp ); static_cast<wxDialog*>(GetParent())->SetTitle( Temp );
static_cast<wxDialog*>(GetParent())->SetName( Temp ); static_cast<wxDialog*>(GetParent())->SetName( Temp );
@ -532,8 +532,9 @@ PrefsDialog::Factories
} }
PrefsDialog::PrefsDialog PrefsDialog::PrefsDialog(
(wxWindow * parent, const wxString &titlePrefix, Factories &factories) wxWindow * parent,
const TranslatableString &titlePrefix, Factories &factories)
: wxDialogWrapper(parent, wxID_ANY, XO("Audacity Preferences"), : wxDialogWrapper(parent, wxID_ANY, XO("Audacity Preferences"),
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
@ -694,7 +695,8 @@ int PrefsDialog::ShowModal()
mCategories->SetSelection(selected); mCategories->SetSelection(selected);
} }
else { else {
auto Temp = TranslatableString{ mTitlePrefix + mUniquePage->GetLabel() }; auto Temp = mTitlePrefix;
Temp.Join( TranslatableString{ mUniquePage->GetLabel() }, wxT(" ") );
SetTitle(Temp); SetTitle(Temp);
SetName(Temp); SetName(Temp);
} }
@ -887,7 +889,7 @@ int PrefsDialog::GetSelectedPage() const
} }
GlobalPrefsDialog::GlobalPrefsDialog(wxWindow * parent, Factories &factories) GlobalPrefsDialog::GlobalPrefsDialog(wxWindow * parent, Factories &factories)
: PrefsDialog(parent, _("Preferences: "), factories) : PrefsDialog(parent, XO("Preferences:"), factories)
{ {
} }

View File

@ -48,7 +48,7 @@ class PrefsDialog /* not final */ : public wxDialogWrapper
static Factories &DefaultFactories(); static Factories &DefaultFactories();
PrefsDialog(wxWindow * parent, PrefsDialog(wxWindow * parent,
const wxString &titlePrefix = _("Preferences: "), const TranslatableString &titlePrefix = XO("Preferences:"),
Factories &factories = DefaultFactories()); Factories &factories = DefaultFactories());
virtual ~PrefsDialog(); virtual ~PrefsDialog();
@ -82,7 +82,7 @@ private:
wxTreebook *mCategories{}; wxTreebook *mCategories{};
PrefsPanel *mUniquePage{}; PrefsPanel *mUniquePage{};
Factories &mFactories; Factories &mFactories;
const wxString mTitlePrefix; const TranslatableString mTitlePrefix;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -779,8 +779,8 @@ void WaveTrackMenuTable::OnSpectrogramSettings(wxCommandEvent &)
class ViewSettingsDialog final : public PrefsDialog class ViewSettingsDialog final : public PrefsDialog
{ {
public: public:
ViewSettingsDialog ViewSettingsDialog(wxWindow *parent,
(wxWindow *parent, const wxString &title, PrefsDialog::Factories &factories, const TranslatableString &title, PrefsDialog::Factories &factories,
int page) int page)
: PrefsDialog(parent, title, factories) : PrefsDialog(parent, title, factories)
, mPage(page) , mPage(page)
@ -817,8 +817,7 @@ void WaveTrackMenuTable::OnSpectrogramSettings(wxCommandEvent &)
// (pTrack->GetDisplay() == WaveTrack::Spectrum) ? 1 : // (pTrack->GetDisplay() == WaveTrack::Spectrum) ? 1 :
0; 0;
/* i18n-hint: An item name followed by a value, with appropriate separating punctuation */ auto title = XO("%s:").Format( pTrack->GetName() );
auto title = wxString::Format(_("%s: %s"), pTrack->GetName(), wxT(""));
ViewSettingsDialog dialog(mpData->pParent, title, factories, page); ViewSettingsDialog dialog(mpData->pParent, title, factories, page);
if (0 != dialog.ShowModal()) { if (0 != dialog.ShowModal()) {

View File

@ -982,6 +982,7 @@ wxString LWSlider::GetTip(float value) const
#endif #endif
} }
/* i18n-hint: An item name followed by a value, with appropriate separating punctuation */
label = XO("%s: %s").Format( mName, val ).Translation(); label = XO("%s: %s").Format( mName, val ).Translation();
} }
else else