Conversion of TranslatableString to wxString is private

This commit is contained in:
Paul Licameli 2019-11-30 13:32:18 -05:00
parent 0b6618e491
commit 72df562c4a
30 changed files with 119 additions and 99 deletions

View File

@ -62,11 +62,16 @@ public:
ComponentInterfaceSymbol() = default;
// Allows implicit construction from a msgid re-used as an internal string
ComponentInterfaceSymbol( const wxString &msgid )
: mInternal{ msgid }, mMsgid{ msgid }
ComponentInterfaceSymbol( const TranslatableString &msgid )
: mInternal{ msgid.MSGID().GET(), }, mMsgid{ msgid }
{}
// Allows implicit construction from a msgid re-used as an internal string
// Allows implicit construction from an internal string re-used as a msgid
ComponentInterfaceSymbol( const wxString &internal )
: mInternal{ internal }, mMsgid{ internal }
{}
// Allows implicit construction from an internal string re-used as a msgid
ComponentInterfaceSymbol( const wxChar *msgid )
: mInternal{ msgid }, mMsgid{ msgid }
{}
@ -82,8 +87,7 @@ public:
const wxString &Internal() const { return mInternal; }
const TranslatableString &Msgid() const { return mMsgid; }
const wxString &Translation() const
{ return GetCustomTranslation( mMsgid ); }
const wxString &Translation() const { return mMsgid.Translation(); }
bool empty() const { return mInternal.empty(); }

View File

@ -299,7 +299,8 @@ using CommandIDs = std::vector<CommandID>;
// the user-visible translation. The msgid should be used only in unusual cases
// and the translation more often
//
class TranslatableString : public wxString {
// Implicit conversions to and from wxString are intentionally disabled
class TranslatableString : private wxString {
public:
TranslatableString() {}

View File

@ -56,7 +56,7 @@ enum eCommandType { CtEffect, CtMenu, CtSpecial };
// TIDY-ME: Not currently translated,
// but there are issues to address if we do.
// CLEANSPEECH remnant
static const std::pair<const wxChar*, CommandID> SpecialCommands[] = {
static const std::pair<TranslatableString, CommandID> SpecialCommands[] = {
// Use translations of the first members, some other day.
// For 2.2.2 we'll get them into the catalog at least.
@ -103,16 +103,16 @@ MacroCommands::MacroCommands()
}
}
static const wxString MP3Conversion = XO("MP3 Conversion");
static const wxString FadeEnds = XO("Fade Ends");
static const wxString SelectToEnds = XO("Select to Ends");
static const auto MP3Conversion = XO("MP3 Conversion");
static const auto FadeEnds = XO("Fade Ends");
static const auto SelectToEnds = XO("Select to Ends");
wxArrayStringEx MacroCommands::GetNamesOfDefaultMacros()
{
return {
GetCustomTranslation( MP3Conversion ) ,
GetCustomTranslation( FadeEnds ) ,
MP3Conversion.Translation() ,
FadeEnds.Translation() ,
//Don't add this one anymore, as there is a new menu command for it.
//GetCustomTranslation( SelectToEnds ) ,
};
@ -123,16 +123,16 @@ void MacroCommands::RestoreMacro(const wxString & name)
// TIDY-ME: Effects change their name with localisation.
// Commands (at least currently) don't. Messy.
ResetMacro();
if (name == GetCustomTranslation( MP3Conversion ) ){
if (name == MP3Conversion.Translation() ){
AddToMacro( wxT("Normalize") );
AddToMacro( wxT("ExportMP3") );
} else if (name == GetCustomTranslation( FadeEnds ) ){
} else if (name == FadeEnds.Translation() ){
AddToMacro( wxT("Select"), wxT("Start=\"0\" End=\"1\"") );
AddToMacro( wxT("FadeIn") );
AddToMacro( wxT("Select"), wxT("Start=\"0\" End=\"1\" RelativeTo=\"ProjectEnd\"") );
AddToMacro( wxT("FadeOut") );
AddToMacro( wxT("Select"), wxT("Start=\"0\" End=\"0\"") );
} else if (name == GetCustomTranslation( SelectToEnds ) ){
} else if (name == SelectToEnds.Translation() ){
AddToMacro( wxT("SelCursorEnd") );
AddToMacro( wxT("SelStartCursor") );
}
@ -294,7 +294,7 @@ MacroCommandsCatalog::MacroCommandsCatalog( const AudacityProject *project )
Entries commands;
for( const auto &command : SpecialCommands )
commands.push_back( {
{ command.second, GetCustomTranslation( command.first ) },
{ command.second, command.first.Translation() },
_("Special Command")
} );

View File

@ -119,7 +119,7 @@ void LangChoiceDialog::OnOk(wxCommandEvent & WXUNUSED(event))
}
}
else {
sname = mLangNames[sndx];
sname = mLangNames[sndx].Translation();
}
if (mLang.Left(2) != slang.Left(2)) {

View File

@ -293,7 +293,10 @@ void GetLanguages(
reverseHash[tempNames[j]] = tempCodes[j];
}
std::sort( tempNames.begin(), tempNames.end() );
std::sort( tempNames.begin(), tempNames.end(),
[]( const TranslatableString &a, const TranslatableString &b ){
return a.Translation() < b.Translation();
} );
// Add system language
langNames.push_back(XO("System"));

View File

@ -738,7 +738,7 @@ void MenuManager::TellUserWhyDisallowed(
return;
// Message is already translated but title is not yet
auto title = ::GetCustomTranslation( untranslatedTitle );
auto title = untranslatedTitle.Translation();
// Does not have the warning icon...
ShowErrorDialog(

View File

@ -59,7 +59,7 @@ int PitchOctave(const double dMIDInote)
wxString PitchName(const double dMIDInote, const PitchNameChoice choice)
{
static const wxString sharpnames[12] = {
static const TranslatableString sharpnames[12] = {
/* i18n-hint: Name of a musical note in the 12-tone chromatic scale */
XO("C"),
/* i18n-hint: Name of a musical note in the 12-tone chromatic scale */
@ -86,7 +86,7 @@ wxString PitchName(const double dMIDInote, const PitchNameChoice choice)
XO("B"),
};
static const wxString flatnames[12] = {
static const TranslatableString flatnames[12] = {
/* i18n-hint: Name of a musical note in the 12-tone chromatic scale */
XO("C"),
/* i18n-hint: Name of a musical note in the 12-tone chromatic scale */
@ -113,7 +113,7 @@ wxString PitchName(const double dMIDInote, const PitchNameChoice choice)
XO("B"),
};
static const wxString bothnames[12] = {
static const TranslatableString bothnames[12] = {
/* i18n-hint: Name of a musical note in the 12-tone chromatic scale */
XO("C"),
/* i18n-hint: Two, alternate names of a musical note in the 12-tone chromatic scale */
@ -140,7 +140,7 @@ wxString PitchName(const double dMIDInote, const PitchNameChoice choice)
XO("B"),
};
const wxString *table = nullptr;
const TranslatableString *table = nullptr;
switch ( choice ) {
case PitchNameChoice::Sharps: table = sharpnames; break;
case PitchNameChoice::Flats: table = flatnames; break;
@ -148,7 +148,7 @@ wxString PitchName(const double dMIDInote, const PitchNameChoice choice)
default: wxASSERT(false); break;
}
return GetCustomTranslation( table[PitchIndex(dMIDInote)] );
return table[PitchIndex(dMIDInote)].Translation();
}
wxString PitchName_Absolute(const double dMIDInote, const PitchNameChoice choice)

View File

@ -2307,7 +2307,7 @@ void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type)
// PRL: Writing KEY_NAME which is no longer read, but older Audacity
// versions expect to find it.
pRegistry->Write(KEY_NAME, plug.GetSymbol().Msgid());
pRegistry->Write(KEY_NAME, plug.GetSymbol().Msgid().MSGID());
pRegistry->Write(KEY_VERSION, plug.GetUntranslatedVersion());
pRegistry->Write(KEY_VENDOR, plug.GetVendor());

View File

@ -753,7 +753,7 @@ static wxArrayString names()
void Populate() override
{
for (auto &name : theNames)
mContents.push_back( wxGetTranslation( name ) );
mContents.push_back( name.Translation() );
}
};
@ -999,7 +999,7 @@ bool TagsEditor::TransferDataFromWindow()
for (i = 0; i < cnt; i++) {
// Get tag name from the grid
wxString n = mGrid->GetCellValue(i, 0);
auto n = mGrid->GetCellValue(i, 0);
wxString v = mGrid->GetCellValue(i, 1);
if (n.empty()) {
@ -1009,25 +1009,25 @@ bool TagsEditor::TransferDataFromWindow()
bool bSpecialTag = true;
// Map special tag names back to internal keys
if (n.CmpNoCase(wxGetTranslation(LABEL_ARTIST)) == 0) {
if (n.CmpNoCase(LABEL_ARTIST.Translation()) == 0) {
n = TAG_ARTIST;
}
else if (n.CmpNoCase(wxGetTranslation(LABEL_TITLE)) == 0) {
else if (n.CmpNoCase(LABEL_TITLE.Translation()) == 0) {
n = TAG_TITLE;
}
else if (n.CmpNoCase(wxGetTranslation(LABEL_ALBUM)) == 0) {
else if (n.CmpNoCase(LABEL_ALBUM.Translation()) == 0) {
n = TAG_ALBUM;
}
else if (n.CmpNoCase(wxGetTranslation(LABEL_TRACK)) == 0) {
else if (n.CmpNoCase(LABEL_TRACK.Translation()) == 0) {
n = TAG_TRACK;
}
else if (n.CmpNoCase(wxGetTranslation(LABEL_YEAR)) == 0) {
else if (n.CmpNoCase(LABEL_YEAR.Translation()) == 0) {
n = TAG_YEAR;
}
else if (n.CmpNoCase(wxGetTranslation(LABEL_GENRE)) == 0) {
else if (n.CmpNoCase(LABEL_GENRE.Translation()) == 0) {
n = TAG_GENRE;
}
else if (n.CmpNoCase(wxGetTranslation(LABEL_COMMENTS)) == 0) {
else if (n.CmpNoCase(LABEL_COMMENTS.Translation()) == 0) {
n = TAG_COMMENTS;
}
else {
@ -1060,16 +1060,16 @@ bool TagsEditor::TransferDataToWindow()
mGrid->SetReadOnly(i, 0);
// The special tag name that's displayed and translated may not match
// the key string used for internal lookup.
mGrid->SetCellValue(i, 0, wxGetTranslation( labelmap[i].label ) );
mGrid->SetCellValue(i, 0, labelmap[i].label.Translation() );
mGrid->SetCellValue(i, 1, mLocal.GetTag(labelmap[i].name));
if (!mEditTitle &&
mGrid->GetCellValue(i, 0).CmpNoCase(wxGetTranslation(LABEL_TITLE)) == 0) {
mGrid->GetCellValue(i, 0).CmpNoCase(LABEL_TITLE.Translation()) == 0) {
mGrid->SetReadOnly(i, 1);
}
if (!mEditTrack &&
mGrid->GetCellValue(i, 0).CmpNoCase(wxGetTranslation(LABEL_TRACK)) == 0) {
mGrid->GetCellValue(i, 0).CmpNoCase(LABEL_TRACK.Translation()) == 0) {
mGrid->SetReadOnly(i, 1);
}
@ -1399,12 +1399,12 @@ void TagsEditor::OnRemove(wxCommandEvent & WXUNUSED(event))
size_t row = mGrid->GetGridCursorRow();
if (!mEditTitle &&
mGrid->GetCellValue(row, 0).CmpNoCase(wxGetTranslation(LABEL_TITLE)) == 0) {
mGrid->GetCellValue(row, 0).CmpNoCase(LABEL_TITLE.Translation()) == 0) {
return;
}
else if (!mEditTrack &&
mGrid->GetCellValue(row, 0)
.CmpNoCase(wxGetTranslation(LABEL_TRACK)) == 0) {
.CmpNoCase(LABEL_TRACK.Translation()) == 0) {
return;
}
else if (row < STATICCNT) {
@ -1478,7 +1478,7 @@ void TagsEditor::SetEditors()
for (int i = 0; i < cnt; i++) {
wxString label = mGrid->GetCellValue(i, 0);
if (label.CmpNoCase(wxGetTranslation(LABEL_GENRE)) == 0) {
if (label.CmpNoCase(LABEL_GENRE.Translation()) == 0) {
// This use of GetDefaultEditorForType does not require DecRef.
mGrid->SetCellEditor(i, 1, mGrid->GetDefaultEditorForType(wxT("Combo")));
}

View File

@ -270,6 +270,7 @@ bool CommandImplementation::SetParameter(const wxString &paramName, const wxVari
context.Error( wxString::Format(
_("%s is not a parameter accepted by %s"),
paramName, GetSymbol().Internal() ) );
// neglect translation for scripting ??
return false;
}

View File

@ -300,16 +300,7 @@ void EffectChangeSpeed::PopulateOrExchange(ShuttleGui & S)
wxArrayStringEx vinylChoices;
for (int i = 0; i < nVinyl; i++)
{
if (i == kVinyl_NA)
{
vinylChoices.push_back(wxGetTranslation(kVinylStrings[i]));
}
else
{
vinylChoices.push_back(kVinylStrings[i]);
}
}
vinylChoices.push_back(kVinylStrings[i].Translation());
S.SetBorder(5);

View File

@ -144,7 +144,7 @@ wxString defaultLabel(int index)
void Populate() override
{
for (auto &name : names)
mContents.push_back( wxGetTranslation( name ) );
mContents.push_back( name.Translation() );
}
};
@ -338,7 +338,7 @@ RegistryPaths EffectDistortion::GetFactoryPresets()
for (size_t i = 0; i < WXSIZEOF(FactoryPresets); i++)
{
names.push_back(wxGetTranslation(FactoryPresets[i].name));
names.push_back( FactoryPresets[i].name.Translation() );
}
return names;

View File

@ -428,7 +428,7 @@ bool EffectEqualization::LoadFactoryDefaults()
static const struct
{
const wxChar *name;
const TranslatableString name;
const wxChar *values;
}
FactoryPresets[] =
@ -463,7 +463,7 @@ RegistryPaths EffectEqualization::GetFactoryPresets()
for (size_t i = 0; i < WXSIZEOF(FactoryPresets); i++)
{
names.push_back(wxGetTranslation(FactoryPresets[i].name));
names.push_back(FactoryPresets[i].name.Translation());
}
return names;

View File

@ -335,7 +335,7 @@ RegistryPaths EffectReverb::GetFactoryPresets()
for (size_t i = 0; i < WXSIZEOF(FactoryPresets); i++)
{
names.push_back(wxGetTranslation(FactoryPresets[i].name));
names.push_back( FactoryPresets[i].name.Translation() );
}
return names;

View File

@ -37,7 +37,7 @@ public:
static double getRate(double rateStart, double rateEnd, SlideType slideType, double t);
protected:
wxString mProxyEffectName { XO("SBSMS Time / Pitch Stretch") };
TranslatableString mProxyEffectName { XO("SBSMS Time / Pitch Stretch") };
// This supplies the abstract virtual function, but in fact this symbol
// does not get used: this class is either a temporary helper, or else
// GetSymbol() is overridden further in derived classes.

View File

@ -344,7 +344,7 @@ VendorSymbol LV2Effect::GetVendor()
if (vendor.empty())
{
vendor = XO("n/a");
return XO("n/a");
}
return { vendor };

View File

@ -186,7 +186,7 @@ NyquistEffect::NyquistEffect(const wxString &fName)
}
mFileName = fName;
mName = mFileName.GetName();
mName = TranslatableString{ mFileName.GetName() };
mFileModified = mFileName.GetModificationTime();
ParseFile();
@ -228,12 +228,15 @@ VendorSymbol NyquistEffect::GetVendor()
wxString NyquistEffect::GetVersion()
{
return mReleaseVersion;
// Are Nyquist version strings really supposed to be translatable?
// See commit a06e561 which used XO for at least one of them
return mReleaseVersion.Translation();
}
wxString NyquistEffect::GetDescription()
{
return mCopyright;
// This should be a translated string, consistent with other effects
return mCopyright.Translation();
}
wxString NyquistEffect::ManualPage()
@ -924,7 +927,7 @@ finish:
if (mDebug && !mRedirectOutput) {
NyquistOutputDialog dlog(mUIParent, -1,
mName,
mName.Translation(),
_("Debug Output: "),
mDebugOutput);
dlog.CentreOnParent();
@ -1333,7 +1336,7 @@ bool NyquistEffect::ProcessOne()
// If we're not showing debug window, log errors and warnings:
if (!mDebugOutput.empty() && !mDebug && !mTrace) {
/* i18n-hint: An effect "returned" a message.*/
wxLogMessage(_("\'%s\' returned:\n%s"), mName, mDebugOutput);
wxLogMessage(_("\'%s\' returned:\n%s"), mName.Translation(), mDebugOutput);
}
// Audacity has no idea how long Nyquist processing will take, but
@ -1368,8 +1371,10 @@ bool NyquistEffect::ProcessOne()
// Show error in debug window if trace enabled, otherwise log.
if (mTrace) {
/* i18n-hint: "%s" is replaced by name of plug-in.*/
mDebugOutput = wxString::Format(_("nyx_error returned from %s.\n"),
mName.empty()? _("plug-in") : mName) + mDebugOutput;
mDebugOutput = wxString::Format(
_("nyx_error returned from %s.\n"),
mName.empty()? _("plug-in") : mName.Translation()
) + mDebugOutput;
mDebug = true;
}
else {
@ -1878,14 +1883,15 @@ bool NyquistEffect::Parse(
}
if (len >= 2 && tokens[0] == wxT("name")) {
mName = UnQuote(tokens[1]);
auto name = UnQuote(tokens[1]);
// Strip ... from name if it's present, perhaps in third party plug-ins
// Menu system puts ... back if there are any controls
// This redundant naming convention must NOT be followed for
// shipped Nyquist effects with internationalization. Else the msgid
// later looked up will lack the ... and will not be found.
if (mName.EndsWith(wxT("...")))
mName = mName.RemoveLast(3);
if (name.EndsWith(wxT("...")))
name = name.RemoveLast(3);
mName = TranslatableString{ name };
return true;
}

View File

@ -213,8 +213,8 @@ private:
wxString mInitError;
wxString mInputCmd; // history: exactly what the user typed
wxString mCmd; // the command to be processed
wxString mName; ///< Name of the Effect (untranslated)
wxString mPromptName; // If a prompt, we need to remember original name.
TranslatableString mName; ///< Name of the Effect (untranslated)
TranslatableString mPromptName; // If a prompt, we need to remember original name.
TranslatableString mAction;
TranslatableString mInfo;
TranslatableString mAuthor;

View File

@ -160,7 +160,7 @@ TranslatableString ExportPlugin::GetUntranslatedDescription(int index)
wxString ExportPlugin::GetTranslatedDescription(int index)
{
return GetCustomTranslation( GetUntranslatedDescription( index ) );
return GetUntranslatedDescription( index ).Translation();
}
FileExtension ExportPlugin::GetExtension(int index)

View File

@ -536,7 +536,7 @@ void ExportMP3Options::LoadNames(const TranslatableStrings &names)
{
mRate->Clear();
for (const auto &name : names)
mRate->Append( GetCustomTranslation( name ) );
mRate->Append( name.Translation() );
}
//----------------------------------------------------------------------------

View File

@ -187,6 +187,18 @@ void AddEffectMenuItemGroup(
const std::vector<CommandFlag> & flags,
bool isDefault);
namespace
{
inline bool HasDialog( const PluginDescriptor *plug )
{
// Un-translated string is expected to follow a certain convention
// Translation, perhaps, uses some other punctuation
return plug->GetSymbol().Msgid().MSGID().GET().Contains("...");
}
}
void AddEffectMenuItems(
MenuTable::BaseItemPtrs &table,
std::vector<const PluginDescriptor*> & plugs,
@ -207,7 +219,7 @@ void AddEffectMenuItems(
// Some weird special case stuff just for Noise Reduction so that there is
// more informative help
const auto getBatchFlags = [&]( const PluginDescriptor *plug ){
if ( plug->GetSymbol().Msgid() == wxT( "Noise Reduction" ) )
if ( plug->GetSymbol().Msgid() == XO( "Noise Reduction" ) )
return
( batchflags | NoiseReductionTimeSelectedFlag ) & ~TimeSelectedFlag;
return batchflags;
@ -226,7 +238,7 @@ void AddEffectMenuItems(
{
const PluginDescriptor *plug = plugs[i];
bool hasDialog = plug->GetSymbol().Msgid().Contains("...");
bool hasDialog = HasDialog( plug );
auto name = plug->GetSymbol().Translation();
if (plug->IsEffectInteractive())
@ -299,7 +311,7 @@ void AddEffectMenuItems(
{
const PluginDescriptor *plug = plugs[i];
bool hasDialog = plug->GetSymbol().Msgid().Contains("...");
bool hasDialog = HasDialog( plug );
auto name = plug->GetSymbol().Translation();
if (plug->IsEffectInteractive())

View File

@ -115,7 +115,7 @@ void DevicePrefs::GetNamesAndLabels()
const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
if ((info!=NULL)&&(info->maxOutputChannels > 0 || info->maxInputChannels > 0)) {
wxString name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(info->hostApi)->name);
if ( ! make_iterator_range( mHostNames ).contains( name ) ) {
if (!make_iterator_range(mHostNames).contains(TranslatableString{name})) {
mHostNames.push_back( TranslatableString{ name } );
mHostLabels.push_back(name);
}
@ -214,7 +214,7 @@ void DevicePrefs::OnHost(wxCommandEvent & e)
// Find the index for the host API selected
int index = -1;
wxString apiName = mHostNames[mHost->GetCurrentSelection()];
auto apiName = mHostLabels[mHost->GetCurrentSelection()];
int nHosts = Pa_GetHostApiCount();
for (int i = 0; i < nHosts; ++i) {
wxString name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(i)->name);

View File

@ -99,7 +99,7 @@ namespace {
// It is not required that each module be found here, nor that each module
// mentioned here be found.
const std::map< wxString, wxString > SuggestedPrompts{
const std::map< wxString, TranslatableString > SuggestedPrompts{
/* i18n-hint: Audio Unit is the name of an Apple audio software protocol */
{ wxT("AudioUnit"), XO("Audio Unit") },
@ -131,7 +131,7 @@ const std::map< wxString, wxString > SuggestedPrompts{
// Collect needed prompts and settings paths, at most once, on demand
struct Entry {
wxString prompt; // untranslated
TranslatableString prompt;
wxString setting;
};
static const std::vector< Entry > &GetModuleData()
@ -146,7 +146,7 @@ static const std::vector< Entry > &GetModuleData()
if ( internal.empty() )
continue;
wxString prompt;
TranslatableString prompt;
auto iter = SuggestedPrompts.find( internal );
if ( iter == SuggestedPrompts.end() )
// For the built-in modules this Msgid includes " Effects",
@ -187,7 +187,7 @@ void EffectsPrefs::PopulateOrExchange(ShuttleGui & S)
for ( const auto &entry : GetModuleData() )
{
S.TieCheckBox(
GetCustomTranslation( entry.prompt ),
entry.prompt.Translation(),
{entry.setting,
true}
);

View File

@ -102,7 +102,8 @@ void GUIPrefs::GetRangeChoices(
if (pChoicesTranslated)
*pChoicesTranslated =
transform_container<wxArrayStringEx>( sChoices, GetCustomTranslation );
transform_container<wxArrayStringEx>( sChoices,
std::mem_fn( &TranslatableString::Translation ) );
if (pDefaultRangeIndex)
*pDefaultRangeIndex = 2; // 60 == ENV_DB_RANGE

View File

@ -119,7 +119,7 @@ void MidiIOPrefs::GetNamesAndLabels() {
const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
if (info->output || info->input) { //should always happen
wxString name = wxSafeConvertMB2WX(info->interf);
if ( ! make_iterator_range( mHostNames ).contains( name ) ) {
if (!make_iterator_range(mHostNames).contains(TranslatableString{name})) {
mHostNames.push_back( TranslatableString{ name } );
mHostLabels.push_back(name);
}
@ -194,7 +194,7 @@ void MidiIOPrefs::OnHost(wxCommandEvent & WXUNUSED(e))
wxString itemAtIndex;
int index = mHost->GetCurrentSelection();
if (index >= 0 && index < (int)mHostNames.size())
itemAtIndex = mHostNames[index];
itemAtIndex = mHostLabels[index];
int nDevices = Pm_CountDevices();
if (nDevices == 0) {

View File

@ -687,14 +687,14 @@ registeredStatusWidthFunction{
-> ProjectStatus::StatusWidthResult
{
if ( field == stateStatusBarField ) {
const auto pauseString = wxT(" ") + GetCustomTranslation(sStatePause);
const auto pauseString = wxT(" ") + sStatePause.Translation();
std::vector<wxString> strings;
for ( auto pString :
{ &sStatePlay, &sStateStop, &sStateRecord } )
{
strings.push_back(
GetCustomTranslation(*pString) + pauseString + wxT(".") );
pString->Translation() + pauseString + wxT(".") );
}
// added constant needed because xMax isn't large enough for some reason, plus some space.
@ -716,16 +716,16 @@ wxString ControlToolBar::StateForStatusBar()
if (!scrubState.empty())
state = scrubState.Translation();
else if (mPlay->IsDown())
state = wxGetTranslation(sStatePlay);
state = sStatePlay.Translation();
else if (projectAudioManager.Recording())
state = wxGetTranslation(sStateRecord);
state = sStateRecord.Translation();
else
state = wxGetTranslation(sStateStop);
state = sStateStop.Translation();
if (mPause->IsDown())
{
state.Append(wxT(" "));
state.Append(wxGetTranslation(sStatePause));
state.Append(sStatePause.Translation());
}
state.Append(wxT("."));

View File

@ -278,7 +278,7 @@ void EditToolBar::ForAllButtons(int Action)
#if wxUSE_TOOLTIPS
if( Action & ETBActTooltips ){
TranslatedInternalString command{
entry.commandName, wxGetTranslation(entry.untranslatedLabel) };
entry.commandName, entry.untranslatedLabel.Translation() };
ToolBar::SetButtonToolTip( mProject,
*mButtons[entry.tool], &command, 1u );
}

View File

@ -154,7 +154,7 @@ void ToolsToolBar::RegenerateTooltips()
for (const auto &entry : table) {
TranslatedInternalString command{
entry.commandName, wxGetTranslation(entry.untranslatedLabel) };
entry.commandName, entry.untranslatedLabel.Translation() };
ToolBar::SetButtonToolTip( mProject,
*mTool[entry.tool], &command, 1u );
}

View File

@ -347,8 +347,8 @@ void TranscriptionToolBar::RegenerateTooltips()
for (const auto &entry : table) {
TranslatedInternalString commands[] = {
{ entry.commandName, wxGetTranslation(entry.untranslatedLabel) },
{ entry.commandName2, wxGetTranslation(entry.untranslatedLabel2) },
{ entry.commandName, entry.untranslatedLabel.Translation() },
{ entry.commandName2, entry.untranslatedLabel2.Translation() },
};
ToolBar::SetButtonToolTip( mProject,
*mButtons[entry.tool], commands, 2u );

View File

@ -267,7 +267,7 @@ namespace {
bool seek;
bool (Scrubber::*StatusTest)() const;
const wxString &GetStatus() const { return status; }
const TranslatableString &GetStatus() const { return status; }
} menuItems[] = {
/* i18n-hint: These commands assist the user in finding a sound by ear. ...
"Scrubbing" is variable-speed playback, ...
@ -1000,11 +1000,11 @@ registeredStatusWidthFunction{
std::vector< wxString > strings;
// Note that Scrubbing + Paused is not allowed.
for (const auto &item : menuItems)
strings.push_back( GetCustomTranslation( item.GetStatus() ) );
strings.push_back( item.GetStatus().Translation() );
strings.push_back(
GetCustomTranslation( sPlayAtSpeedStatus ) +
sPlayAtSpeedStatus.Translation() +
wxT(" ") +
GetCustomTranslation( XO("Paused") ) +
XO("Paused").Translation() +
wxT(".")
);
// added constant needed because xMax isn't large enough for some reason, plus some space.
@ -1032,7 +1032,8 @@ MenuTable::BaseItemPtr Scrubber::Menu()
MenuTable::BaseItemPtrs ptrs;
for (const auto &item : menuItems) {
ptrs.push_back( MenuTable::Command( item.name, wxGetTranslation(item.label),
ptrs.push_back( MenuTable::Command(
item.name, item.label.Translation(),
// No menu items yet have dialogs
false,
findme, static_cast<CommandFunctorPointer>(item.memFn),
@ -1055,7 +1056,7 @@ void Scrubber::PopulatePopupMenu(wxMenu &menu)
for (const auto &item : menuItems) {
if (cm.GetEnabled(item.name)) {
auto test = item.StatusTest;
menu.Append(id, wxGetTranslation(item.label), wxString{},
menu.Append(id, item.label.Translation(), wxString{},
test ? wxITEM_CHECK : wxITEM_NORMAL);
if(test && (this->*test)())
menu.FindItem(id)->Check();