1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 08:29:27 +02:00

Construct MenuItem with untranslated label, so it can be static...

... and other storage of TranslatableString instead of naked wxString, for
management of menu items, in CommandManager
This commit is contained in:
Paul Licameli 2019-01-09 15:26:32 -05:00
parent aac50ae36e
commit a8de4d9e50
21 changed files with 122 additions and 124 deletions

View File

@ -116,7 +116,7 @@ void GroupItem::AppendOne( BaseItemPtr&& ptr )
} }
GroupItem::~GroupItem() {} GroupItem::~GroupItem() {}
MenuItem::MenuItem( const wxString &title_, BaseItemPtrs &&items_ ) MenuItem::MenuItem( const TranslatableString &title_, BaseItemPtrs &&items_ )
: GroupItem{ std::move( items_ ) }, title{ title_ } : GroupItem{ std::move( items_ ) }, title{ title_ }
{ {
wxASSERT( !title.empty() ); wxASSERT( !title.empty() );

View File

@ -112,7 +112,7 @@ CommandManager. It holds the callback for one command.
#define MAX_SUBMENU_LEN 1000 #define MAX_SUBMENU_LEN 1000
#endif #endif
#define COMMAND _("Command") #define COMMAND XO("Command")
NonKeystrokeInterceptingWindow::~NonKeystrokeInterceptingWindow() NonKeystrokeInterceptingWindow::~NonKeystrokeInterceptingWindow()
@ -133,17 +133,11 @@ MenuBarListEntry::~MenuBarListEntry()
} }
SubMenuListEntry::SubMenuListEntry( SubMenuListEntry::SubMenuListEntry(
const wxString &name_, std::unique_ptr<wxMenu> &&menu_ ) const TranslatableString &name_, std::unique_ptr<wxMenu> menu_ )
: name(name_), menu( std::move(menu_) ) : name(name_), menu( std::move(menu_) )
{ {
} }
SubMenuListEntry::SubMenuListEntry(SubMenuListEntry &&that)
: name(std::move(that.name))
, menu(std::move(that.menu))
{
}
SubMenuListEntry::~SubMenuListEntry() SubMenuListEntry::~SubMenuListEntry()
{ {
} }
@ -371,7 +365,7 @@ void CommandManager::PopMenuBar()
/// ///
/// This starts a NEW menu /// This starts a NEW menu
/// ///
wxMenu *CommandManager::BeginMenu(const wxString & tName) wxMenu *CommandManager::BeginMenu(const TranslatableString & tName)
{ {
if ( mCurrentMenu ) if ( mCurrentMenu )
return BeginSubMenu( tName ); return BeginSubMenu( tName );
@ -396,7 +390,7 @@ void CommandManager::EndMenu()
/// ///
/// This starts a NEW menu /// This starts a NEW menu
/// ///
wxMenu *CommandManager::BeginMainMenu(const wxString & tName) wxMenu *CommandManager::BeginMainMenu(const TranslatableString & tName)
{ {
uCurrentMenu = std::make_unique<wxMenu>(); uCurrentMenu = std::make_unique<wxMenu>();
mCurrentMenu = uCurrentMenu.get(); mCurrentMenu = uCurrentMenu.get();
@ -414,7 +408,8 @@ void CommandManager::EndMainMenu()
// added to the menu to allow OSX to rearrange special menu // added to the menu to allow OSX to rearrange special menu
// items like Preferences, About, and Quit. // items like Preferences, About, and Quit.
wxASSERT(uCurrentMenu); wxASSERT(uCurrentMenu);
CurrentMenuBar()->Append(uCurrentMenu.release(), mCurrentMenuName); CurrentMenuBar()->Append(
uCurrentMenu.release(), mCurrentMenuName.Translation());
mCurrentMenu = nullptr; mCurrentMenu = nullptr;
mCurrentMenuName = COMMAND; mCurrentMenuName = COMMAND;
} }
@ -423,7 +418,7 @@ void CommandManager::EndMainMenu()
/// ///
/// This starts a NEW submenu, and names it according to /// This starts a NEW submenu, and names it according to
/// the function's argument. /// the function's argument.
wxMenu* CommandManager::BeginSubMenu(const wxString & tName) wxMenu* CommandManager::BeginSubMenu(const TranslatableString & tName)
{ {
mSubMenuList.push_back mSubMenuList.push_back
(std::make_unique< SubMenuListEntry > ( tName, std::make_unique<wxMenu>() )); (std::make_unique< SubMenuListEntry > ( tName, std::make_unique<wxMenu>() ));
@ -445,8 +440,9 @@ void CommandManager::EndSubMenu()
mSubMenuList.pop_back(); mSubMenuList.pop_back();
//Add the submenu to the current menu //Add the submenu to the current menu
CurrentMenu()->Append auto name = tmpSubMenu.name.Translation();
(0, tmpSubMenu.name, tmpSubMenu.menu.release(), tmpSubMenu.name); CurrentMenu()->Append(0, name, tmpSubMenu.menu.release(),
name /* help string */ );
mbSeparatorAllowed = true; mbSeparatorAllowed = true;
} }
@ -656,7 +652,7 @@ CommandListEntry *CommandManager::NewIdentifier(const CommandID & nameIn,
{ {
auto entry = std::make_unique<CommandListEntry>(); auto entry = std::make_unique<CommandListEntry>();
wxString labelPrefix; TranslatableString labelPrefix;
if (!mSubMenuList.empty()) { if (!mSubMenuList.empty()) {
labelPrefix = mSubMenuList.back()->name; labelPrefix = mSubMenuList.back()->name;
} }
@ -699,7 +695,7 @@ CommandListEntry *CommandManager::NewIdentifier(const CommandID & nameIn,
entry->key = NormalizedKeyString{ accel.BeforeFirst(wxT('\t')) }; entry->key = NormalizedKeyString{ accel.BeforeFirst(wxT('\t')) };
entry->defaultKey = entry->key; entry->defaultKey = entry->key;
entry->labelPrefix = labelPrefix; entry->labelPrefix = labelPrefix;
entry->labelTop = wxMenuItem::GetLabelText(mCurrentMenuName); entry->labelTop = wxMenuItem::GetLabelText(mCurrentMenuName.Translation());
entry->menu = menu; entry->menu = menu;
entry->finder = finder; entry->finder = finder;
entry->callback = callback; entry->callback = callback;
@ -1203,7 +1199,7 @@ CommandManager::HandleTextualCommand(const CommandID & Str,
// PRL: uh oh, mixing internal string (Str) with user-visible // PRL: uh oh, mixing internal string (Str) with user-visible
// (labelPrefix, which was initialized from a user-visible // (labelPrefix, which was initialized from a user-visible
// sub-menu name) // sub-menu name)
Str == entry->labelPrefix ) Str == entry->labelPrefix.Translation() )
{ {
return HandleCommandEntry( entry.get(), flags, alwaysEnabled) return HandleCommandEntry( entry.get(), flags, alwaysEnabled)
? CommandSuccess : CommandFailure; ? CommandSuccess : CommandFailure;
@ -1292,7 +1288,7 @@ void CommandManager::GetAllCommandData(
wxArrayString &labels, wxArrayString &labels,
wxArrayString &categories, wxArrayString &categories,
#if defined(EXPERIMENTAL_KEY_VIEW) #if defined(EXPERIMENTAL_KEY_VIEW)
wxArrayString &prefixes, TranslatableStrings &prefixes,
#endif #endif
bool includeMultis) bool includeMultis)
{ {
@ -1352,11 +1348,11 @@ wxString CommandManager::GetPrefixedLabelFromName(const CommandID &name)
#if defined(EXPERIMENTAL_KEY_VIEW) #if defined(EXPERIMENTAL_KEY_VIEW)
wxString prefix; wxString prefix;
if (!entry->labelPrefix.empty()) { if (!entry->labelPrefix.empty()) {
prefix = entry->labelPrefix + wxT(" - "); prefix = entry->labelPrefix.Translation() + wxT(" - ");
} }
return wxMenuItem::GetLabelText(prefix + entry->label); return wxMenuItem::GetLabelText(prefix + entry->label);
#else #else
return wxString(entry->labelPrefix + wxT(" ") + entry->label).Trim(false).Trim(true); return wxString(entry->labelPrefix.Translation() + wxT(" ") + entry->label).Trim(false).Trim(true);
#endif #endif
} }

View File

@ -48,11 +48,11 @@ struct MenuBarListEntry
struct SubMenuListEntry struct SubMenuListEntry
{ {
SubMenuListEntry(const wxString &name_, std::unique_ptr<wxMenu> &&menu_); SubMenuListEntry(const TranslatableString &name_, std::unique_ptr<wxMenu> menu_);
SubMenuListEntry(SubMenuListEntry &&that); SubMenuListEntry( SubMenuListEntry&& ) = default;
~SubMenuListEntry(); ~SubMenuListEntry();
wxString name; TranslatableString name;
std::unique_ptr<wxMenu> menu; std::unique_ptr<wxMenu> menu;
}; };
@ -64,7 +64,7 @@ struct CommandListEntry
NormalizedKeyString key; NormalizedKeyString key;
NormalizedKeyString defaultKey; NormalizedKeyString defaultKey;
wxString label; wxString label;
wxString labelPrefix; TranslatableString labelPrefix;
wxString labelTop; wxString labelTop;
wxMenu *menu; wxMenu *menu;
CommandHandlerFinder finder; CommandHandlerFinder finder;
@ -136,7 +136,7 @@ class AUDACITY_DLL_API CommandManager final
// You may either called SetCurrentMenu later followed by ClearCurrentMenu, // You may either called SetCurrentMenu later followed by ClearCurrentMenu,
// or else BeginMenu followed by EndMenu. Don't mix them. // or else BeginMenu followed by EndMenu. Don't mix them.
wxMenu *BeginMenu(const wxString & tName); wxMenu *BeginMenu(const TranslatableString & tName);
void EndMenu(); void EndMenu();
// For specifying unusual arguments in AddItem // For specifying unusual arguments in AddItem
@ -259,7 +259,7 @@ class AUDACITY_DLL_API CommandManager final
std::vector<NormalizedKeyString> &default_keys, std::vector<NormalizedKeyString> &default_keys,
wxArrayString &labels, wxArrayString &categories, wxArrayString &labels, wxArrayString &categories,
#if defined(EXPERIMENTAL_KEY_VIEW) #if defined(EXPERIMENTAL_KEY_VIEW)
wxArrayString &prefixes, TranslatableStrings &prefixes,
#endif #endif
bool includeMultis); bool includeMultis);
@ -332,9 +332,9 @@ private:
// //
void Enable(CommandListEntry *entry, bool enabled); void Enable(CommandListEntry *entry, bool enabled);
wxMenu *BeginMainMenu(const wxString & tName); wxMenu *BeginMainMenu(const TranslatableString & tName);
void EndMainMenu(); void EndMainMenu();
wxMenu* BeginSubMenu(const wxString & tName); wxMenu* BeginSubMenu(const TranslatableString & tName);
void EndSubMenu(); void EndSubMenu();
// //
@ -374,7 +374,7 @@ private:
bool mbSeparatorAllowed; // false at the start of a menu and immediately after a separator. bool mbSeparatorAllowed; // false at the start of a menu and immediately after a separator.
wxString mCurrentMenuName; TranslatableString mCurrentMenuName;
std::unique_ptr<wxMenu> uCurrentMenu; std::unique_ptr<wxMenu> uCurrentMenu;
wxMenu *mCurrentMenu {}; wxMenu *mCurrentMenu {};
@ -456,16 +456,17 @@ namespace MenuTable {
struct MenuItem final : GroupItem { struct MenuItem final : GroupItem {
// Construction from a previously built-up vector of pointers // Construction from a previously built-up vector of pointers
MenuItem( const wxString &title_, BaseItemPtrs &&items_ ); MenuItem( const TranslatableString &title_, BaseItemPtrs &&items_ );
// In-line, variadic constructor that doesn't require building a vector // In-line, variadic constructor that doesn't require building a vector
template< typename... Args > template< typename... Args >
MenuItem( const wxString &title_, Args&&... args ) MenuItem(
const TranslatableString &title_, Args&&... args )
: GroupItem{ std::forward<Args>(args)... } : GroupItem{ std::forward<Args>(args)... }
, title{ title_ } , title{ title_ }
{} {}
~MenuItem() override; ~MenuItem() override;
wxString title; // translated TranslatableString title;
}; };
struct ConditionalGroupItem final : GroupItem { struct ConditionalGroupItem final : GroupItem {
@ -552,11 +553,11 @@ namespace MenuTable {
// Items will appear in a main toolbar menu or in a sub-menu // Items will appear in a main toolbar menu or in a sub-menu
template< typename... Args > template< typename... Args >
inline BaseItemPtr Menu( inline BaseItemPtr Menu(
const wxString &title, Args&&... args ) const TranslatableString &title, Args&&... args )
{ return std::make_unique<MenuItem>( { return std::make_unique<MenuItem>(
title, std::forward<Args>(args)... ); } title, std::forward<Args>(args)... ); }
inline BaseItemPtr Menu( inline BaseItemPtr Menu(
const wxString &title, BaseItemPtrs &&items ) const TranslatableString &title, BaseItemPtrs &&items )
{ return std::make_unique<MenuItem>( title, std::move( items ) ); } { return std::make_unique<MenuItem>( title, std::move( items ) ); }
// Conditional group items can be constructed two ways, as for group items // Conditional group items can be constructed two ways, as for group items
@ -575,12 +576,12 @@ namespace MenuTable {
// of the title // of the title
template< typename... Args > template< typename... Args >
inline BaseItemPtr MenuOrItems( inline BaseItemPtr MenuOrItems(
const wxString &title, Args&&... args ) const TranslatableString &title, Args&&... args )
{ if ( title.empty() ) return Items( std::forward<Args>(args)... ); { if ( title.empty() ) return Items( std::forward<Args>(args)... );
else return std::make_unique<MenuItem>( else return std::make_unique<MenuItem>(
title, std::forward<Args>(args)... ); } title, std::forward<Args>(args)... ); }
inline BaseItemPtr MenuOrItems( inline BaseItemPtr MenuOrItems(
const wxString &title, BaseItemPtrs &&items ) const TranslatableString &title, BaseItemPtrs &&items )
{ if ( title.empty() ) return Items( std::move( items ) ); { if ( title.empty() ) return Items( std::move( items ) );
else return std::make_unique<MenuItem>( title, std::move( items ) ); } else return std::make_unique<MenuItem>( title, std::move( items ) ); }

View File

@ -828,7 +828,7 @@ MenuTable::BaseItemPtr ClipSelectMenu( AudacityProject& )
using namespace MenuTable; using namespace MenuTable;
using Options = CommandManager::Options; using Options = CommandManager::Options;
return Menu( _("Clip B&oundaries"), return Menu( XO("Clip B&oundaries"),
Command( wxT("SelPrevClipBoundaryToCursor"), Command( wxT("SelPrevClipBoundaryToCursor"),
XXO("Pre&vious Clip Boundary to Cursor"), XXO("Pre&vious Clip Boundary to Cursor"),
FN(OnSelectPrevClipBoundaryToCursor), FN(OnSelectPrevClipBoundaryToCursor),

View File

@ -1057,7 +1057,7 @@ MenuTable::BaseItemPtr EditMenu( AudacityProject & )
#endif #endif
; ;
return Menu( _("&Edit"), return Menu( XO("&Edit"),
Command( wxT("Undo"), XXO("&Undo"), FN(OnUndo), Command( wxT("Undo"), XXO("&Undo"), FN(OnUndo),
AudioIONotBusyFlag | UndoAvailableFlag, wxT("Ctrl+Z") ), AudioIONotBusyFlag | UndoAvailableFlag, wxT("Ctrl+Z") ),
@ -1091,7 +1091,7 @@ MenuTable::BaseItemPtr EditMenu( AudacityProject & )
Separator(), Separator(),
Menu( _("R&emove Special"), Menu( XO("R&emove Special"),
/* i18n-hint: (verb) Do a special kind of cut*/ /* i18n-hint: (verb) Do a special kind of cut*/
Command( wxT("SplitCut"), XXO("Spl&it Cut"), FN(OnSplitCut), Command( wxT("SplitCut"), XXO("Spl&it Cut"), FN(OnSplitCut),
NotBusyTimeAndTracksFlags, NotBusyTimeAndTracksFlags,
@ -1117,7 +1117,7 @@ MenuTable::BaseItemPtr EditMenu( AudacityProject & )
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Menu( _("Clip B&oundaries"), Menu( XO("Clip B&oundaries"),
/* i18n-hint: (verb) It's an item on a menu. */ /* i18n-hint: (verb) It's an item on a menu. */
Command( wxT("Split"), XXO("Sp&lit"), FN(OnSplit), Command( wxT("Split"), XXO("Sp&lit"), FN(OnSplit),
AudioIONotBusyFlag | WaveTracksSelectedFlag, AudioIONotBusyFlag | WaveTracksSelectedFlag,
@ -1159,7 +1159,7 @@ MenuTable::BaseItemPtr ExtraEditMenu( AudacityProject & )
using Options = CommandManager::Options; using Options = CommandManager::Options;
static const auto flags = static const auto flags =
AudioIONotBusyFlag | TracksSelectedFlag | TimeSelectedFlag; AudioIONotBusyFlag | TracksSelectedFlag | TimeSelectedFlag;
return Menu( _("&Edit"), return Menu( XO("&Edit"),
Command( wxT("DeleteKey"), XXO("&Delete Key"), FN(OnDelete), Command( wxT("DeleteKey"), XXO("&Delete Key"), FN(OnDelete),
(flags | NoAutoSelect), (flags | NoAutoSelect),
wxT("Backspace") ), wxT("Backspace") ),

View File

@ -187,13 +187,13 @@ MenuTable::BaseItemPtr ExtraMenu( AudacityProject & )
[]{ return gPrefs->ReadBool(wxT("/GUI/ShowExtraMenus"), false); }; []{ return gPrefs->ReadBool(wxT("/GUI/ShowExtraMenus"), false); };
static const auto factory = static const auto factory =
[](AudacityProject &){ return extraItems; }; [](AudacityProject &){ return extraItems; };
return ConditionalItems( pred, Menu( _("Ext&ra"), factory ) ); return ConditionalItems( pred, Menu( XO("Ext&ra"), factory ) );
} }
MenuTable::BaseItemPtr ExtraMixerMenu( AudacityProject & ) MenuTable::BaseItemPtr ExtraMixerMenu( AudacityProject & )
{ {
using namespace MenuTable; using namespace MenuTable;
return Menu( _("Mi&xer"), return Menu( XO("Mi&xer"),
Command( wxT("OutputGain"), XXO("Ad&just Playback Volume..."), Command( wxT("OutputGain"), XXO("Ad&just Playback Volume..."),
FN(OnOutputGain), AlwaysEnabledFlag ), FN(OnOutputGain), AlwaysEnabledFlag ),
Command( wxT("OutputGainInc"), XXO("&Increase Playback Volume"), Command( wxT("OutputGainInc"), XXO("&Increase Playback Volume"),
@ -212,7 +212,7 @@ MenuTable::BaseItemPtr ExtraMixerMenu( AudacityProject & )
MenuTable::BaseItemPtr ExtraDeviceMenu( AudacityProject & ) MenuTable::BaseItemPtr ExtraDeviceMenu( AudacityProject & )
{ {
using namespace MenuTable; using namespace MenuTable;
return Menu( _("De&vice"), return Menu( XO("De&vice"),
Command( wxT("InputDevice"), XXO("Change &Recording Device..."), Command( wxT("InputDevice"), XXO("Change &Recording Device..."),
FN(OnInputDevice), FN(OnInputDevice),
AudioIONotBusyFlag, wxT("Shift+I") ), AudioIONotBusyFlag, wxT("Shift+I") ),

View File

@ -551,7 +551,7 @@ MenuTable::BaseItemPtr FileMenu( AudacityProject& )
using namespace MenuTable; using namespace MenuTable;
using Options = CommandManager::Options; using Options = CommandManager::Options;
return Menu( _("&File"), return Menu( XO("&File"),
/*i18n-hint: "New" is an action (verb) to create a NEW project*/ /*i18n-hint: "New" is an action (verb) to create a NEW project*/
Command( wxT("New"), XXO("&New"), FN(OnNew), Command( wxT("New"), XXO("&New"), FN(OnNew),
AudioIONotBusyFlag, wxT("Ctrl+N") ), AudioIONotBusyFlag, wxT("Ctrl+N") ),
@ -574,10 +574,10 @@ MenuTable::BaseItemPtr FileMenu( AudacityProject& )
Menu( Menu(
#ifdef __WXMAC__ #ifdef __WXMAC__
/* i18n-hint: This is the name of the menu item on Mac OS X only */ /* i18n-hint: This is the name of the menu item on Mac OS X only */
_("Open Recent") XO("Open Recent")
#else #else
/* i18n-hint: This is the name of the menu item on Windows and Linux */ /* i18n-hint: This is the name of the menu item on Windows and Linux */
_("Recent &Files") XO("Recent &Files")
#endif #endif
, ,
Special( [](AudacityProject &, wxMenu &theMenu){ Special( [](AudacityProject &, wxMenu &theMenu){
@ -609,7 +609,7 @@ MenuTable::BaseItemPtr FileMenu( AudacityProject& )
Separator(), Separator(),
Menu( _("&Save Project"), Menu( XO("&Save Project"),
Command( wxT("Save"), XXO("&Save Project"), FN(OnSave), Command( wxT("Save"), XXO("&Save Project"), FN(OnSave),
AudioIONotBusyFlag | UnsavedChangesFlag, wxT("Ctrl+S") ), AudioIONotBusyFlag | UnsavedChangesFlag, wxT("Ctrl+S") ),
Command( wxT("SaveAs"), XXO("Save Project &As..."), FN(OnSaveAs), Command( wxT("SaveAs"), XXO("Save Project &As..."), FN(OnSaveAs),
@ -627,7 +627,7 @@ MenuTable::BaseItemPtr FileMenu( AudacityProject& )
Separator(), Separator(),
Menu( _("&Export"), Menu( XO("&Export"),
// Enable Export audio commands only when there are audio tracks. // Enable Export audio commands only when there are audio tracks.
Command( wxT("ExportMp3"), XXO("Export as MP&3"), FN(OnExportMp3), Command( wxT("ExportMp3"), XXO("Export as MP&3"), FN(OnExportMp3),
AudioIONotBusyFlag | WaveTracksExistFlag ), AudioIONotBusyFlag | WaveTracksExistFlag ),
@ -661,7 +661,7 @@ MenuTable::BaseItemPtr FileMenu( AudacityProject& )
#endif #endif
), ),
Menu( _("&Import"), Menu( XO("&Import"),
Command( wxT("ImportAudio"), XXO("&Audio..."), FN(OnImport), Command( wxT("ImportAudio"), XXO("&Audio..."), FN(OnImport),
AudioIONotBusyFlag, wxT("Ctrl+Shift+I") ), AudioIONotBusyFlag, wxT("Ctrl+Shift+I") ),
Command( wxT("ImportLabels"), XXO("&Labels..."), FN(OnImportLabels), Command( wxT("ImportLabels"), XXO("&Labels..."), FN(OnImportLabels),

View File

@ -420,7 +420,7 @@ MenuTable::BaseItemPtr HelpMenu( AudacityProject & )
using namespace MenuTable; using namespace MenuTable;
return Menu( _("&Help"), return Menu( XO("&Help"),
// QuickFix menu item not in Audacity 2.3.1 whilst we discuss further. // QuickFix menu item not in Audacity 2.3.1 whilst we discuss further.
#ifdef EXPERIMENTAL_DA #ifdef EXPERIMENTAL_DA
// DA: Has QuickFix menu item. // DA: Has QuickFix menu item.
@ -439,7 +439,7 @@ MenuTable::BaseItemPtr HelpMenu( AudacityProject & )
Separator(), Separator(),
Menu( _("&Diagnostics"), Menu( XO("&Diagnostics"),
Command( wxT("DeviceInfo"), XXO("Au&dio Device Info..."), Command( wxT("DeviceInfo"), XXO("Au&dio Device Info..."),
FN(OnAudioDeviceInfo), FN(OnAudioDeviceInfo),
AudioIONotBusyFlag ), AudioIONotBusyFlag ),

View File

@ -576,7 +576,7 @@ MenuTable::BaseItemPtr LabelEditMenus( AudacityProject & )
return Items( return Items(
Menu( _("&Labels"), Menu( XO("&Labels"),
Command( wxT("EditLabels"), XXO("&Edit Labels..."), FN(OnEditLabels), Command( wxT("EditLabels"), XXO("&Edit Labels..."), FN(OnEditLabels),
AudioIONotBusyFlag ), AudioIONotBusyFlag ),
@ -606,7 +606,7 @@ MenuTable::BaseItemPtr LabelEditMenus( AudacityProject & )
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
Menu( _("La&beled Audio"), Menu( XO("La&beled Audio"),
/* i18n-hint: (verb)*/ /* i18n-hint: (verb)*/
Command( wxT("CutLabels"), XXO("&Cut"), FN(OnCutLabels), Command( wxT("CutLabels"), XXO("&Cut"), FN(OnCutLabels),
AudioIONotBusyFlag | LabelsSelectedFlag | WaveTracksExistFlag | AudioIONotBusyFlag | LabelsSelectedFlag | WaveTracksExistFlag |

View File

@ -576,7 +576,7 @@ MenuTable::BaseItemPtr ExtraFocusMenu( AudacityProject & )
using namespace MenuTable; using namespace MenuTable;
static const auto FocusedTracksFlags = TracksExistFlag | TrackPanelHasFocus; static const auto FocusedTracksFlags = TracksExistFlag | TrackPanelHasFocus;
return Menu( _("F&ocus"), return Menu( XO("F&ocus"),
Command( wxT("PrevFrame"), Command( wxT("PrevFrame"),
XXO("Move &Backward from Toolbars to Tracks"), FN(OnPrevFrame), XXO("Move &Backward from Toolbars to Tracks"), FN(OnPrevFrame),
AlwaysEnabledFlag, wxT("Ctrl+Shift+F6") ), AlwaysEnabledFlag, wxT("Ctrl+Shift+F6") ),

View File

@ -181,7 +181,7 @@ bool CompareEffectsByType(const PluginDescriptor *a, const PluginDescriptor *b)
// Forward-declared function has its definition below with OnEffect in view // Forward-declared function has its definition below with OnEffect in view
void AddEffectMenuItemGroup( void AddEffectMenuItemGroup(
MenuTable::BaseItemPtrs &table, MenuTable::BaseItemPtrs &table,
const wxArrayString & names, const TranslatableStrings & names,
const PluginIDs & plugs, const PluginIDs & plugs,
const std::vector<CommandFlag> & flags, const std::vector<CommandFlag> & flags,
bool isDefault); bool isDefault);
@ -212,37 +212,37 @@ void AddEffectMenuItems(
return batchflags; return batchflags;
}; };
wxArrayString groupNames; TranslatableStrings groupNames;
PluginIDs groupPlugs; PluginIDs groupPlugs;
std::vector<CommandFlag> groupFlags; std::vector<CommandFlag> groupFlags;
if (grouped) if (grouped)
{ {
wxString last; TranslatableString last;
wxString current; TranslatableString current;
for (size_t i = 0; i < pluginCnt; i++) for (size_t i = 0; i < pluginCnt; i++)
{ {
const PluginDescriptor *plug = plugs[i]; const PluginDescriptor *plug = plugs[i];
auto name = plug->GetSymbol().Translation(); auto name = plug->GetSymbol().Msgid();
if (plug->IsEffectInteractive()) if (plug->IsEffectInteractive())
name += _("..."); name += XO("...");
if (groupBy == wxT("groupby:publisher")) if (groupBy == wxT("groupby:publisher"))
{ {
current = EffectManager::Get().GetVendorName(plug->GetID()).Translation(); current = EffectManager::Get().GetVendorName(plug->GetID());
if (current.empty()) if (current.empty())
{ {
current = _("Unknown"); current = XO("Unknown");
} }
} }
else if (groupBy == wxT("groupby:type")) else if (groupBy == wxT("groupby:type"))
{ {
current = EffectManager::Get().GetEffectFamilyName(plug->GetID()).Translation(); current = EffectManager::Get().GetEffectFamilyName(plug->GetID());
if (current.empty()) if (current.empty())
{ {
current = _("Unknown"); current = XO("Unknown");
} }
} }
@ -257,7 +257,7 @@ void AddEffectMenuItems(
groupPlugs, groupFlags, isDefault); groupPlugs, groupFlags, isDefault);
table.push_back( MenuOrItems( table.push_back( MenuOrItems(
( bInSubmenu ? last : wxString{} ), std::move( temp ) ( bInSubmenu ? last : TranslatableString{} ), std::move( temp )
) ); ) );
groupNames.clear(); groupNames.clear();
@ -266,7 +266,7 @@ void AddEffectMenuItems(
last = current; last = current;
} }
groupNames.push_back(name); groupNames.push_back( name );
groupPlugs.push_back(plug->GetID()); groupPlugs.push_back(plug->GetID());
groupFlags.push_back( groupFlags.push_back(
plug->IsEffectRealtime() ? realflags : getBatchFlags( plug ) ); plug->IsEffectRealtime() ? realflags : getBatchFlags( plug ) );
@ -282,7 +282,7 @@ void AddEffectMenuItems(
groupNames, groupPlugs, groupFlags, isDefault); groupNames, groupPlugs, groupFlags, isDefault);
table.push_back( MenuOrItems( table.push_back( MenuOrItems(
( bInSubmenu ? current : wxString{} ), std::move( temp ) ( bInSubmenu ? current : TranslatableString{} ), std::move( temp )
) ); ) );
} }
} }
@ -292,31 +292,32 @@ void AddEffectMenuItems(
{ {
const PluginDescriptor *plug = plugs[i]; const PluginDescriptor *plug = plugs[i];
auto name = plug->GetSymbol().Translation(); auto name = plug->GetSymbol().Msgid();
if (plug->IsEffectInteractive()) if (plug->IsEffectInteractive())
name += _("..."); name += XO("...");
wxString group; TranslatableString group;
if (groupBy == wxT("sortby:publisher:name")) if (groupBy == wxT("sortby:publisher:name"))
{ {
group = EffectManager::Get().GetVendorName(plug->GetID()).Translation(); group = EffectManager::Get().GetVendorName(plug->GetID());
} }
else if (groupBy == wxT("sortby:type:name")) else if (groupBy == wxT("sortby:type:name"))
{ {
group = EffectManager::Get().GetEffectFamilyName(plug->GetID()).Translation(); group = EffectManager::Get().GetEffectFamilyName(plug->GetID());
} }
if (plug->IsEffectDefault()) if (plug->IsEffectDefault())
{ {
group = wxEmptyString; group = {};
} }
groupNames.push_back( groupNames.push_back(
group.empty() group.empty()
? name ? name
: wxString::Format(_("%s: %s"), group, name) : XO("%s: %s").Format( group, name )
); );
groupPlugs.push_back(plug->GetID()); groupPlugs.push_back(plug->GetID());
groupFlags.push_back( groupFlags.push_back(
plug->IsEffectRealtime() ? realflags : getBatchFlags( plug ) ); plug->IsEffectRealtime() ? realflags : getBatchFlags( plug ) );
@ -589,7 +590,7 @@ namespace {
void AddEffectMenuItemGroup( void AddEffectMenuItemGroup(
MenuTable::BaseItemPtrs &table, MenuTable::BaseItemPtrs &table,
const wxArrayString & names, const TranslatableStrings & names,
const PluginIDs & plugs, const PluginIDs & plugs,
const std::vector<CommandFlag> & flags, const std::vector<CommandFlag> & flags,
bool isDefault) bool isDefault)
@ -671,8 +672,8 @@ void AddEffectMenuItemGroup(
const PluginDescriptor *plug = const PluginDescriptor *plug =
PluginManager::Get().GetPlugin(plugs[i]); PluginManager::Get().GetPlugin(plugs[i]);
if( plug->GetPluginType() == PluginTypeEffect ) if( plug->GetPluginType() == PluginTypeEffect )
pTable->push_back( Command( names[i], pTable->push_back( Command( names[i].MSGID(),
TranslatableString{ names[i] }, names[i],
FN(OnEffect), FN(OnEffect),
flags[i], flags[i],
CommandManager::Options{} CommandManager::Options{}
@ -693,7 +694,7 @@ void AddEffectMenuItemGroup(
} }
// Done collecting // Done collecting
table.push_back( Menu( table.push_back( Menu(
wxString::Format(_("Plug-in %d to %d"), groupNdx + 1, end), XO("Plug-in %d to %d").Format( groupNdx + 1, end ),
std::move( temp1 ) std::move( temp1 )
) ); ) );
items = max; items = max;
@ -735,7 +736,7 @@ MenuTable::BaseItemPtr GenerateMenu( AudacityProject & )
// All of this is a bit hacky until we can get more things connected into // All of this is a bit hacky until we can get more things connected into
// the plugin manager...sorry! :-( // the plugin manager...sorry! :-(
return Menu( _("&Generate"), return Menu( XO("&Generate"),
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT #ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
Command( wxT("ManageGenerators"), XXO("Add / Remove Plug-ins..."), Command( wxT("ManageGenerators"), XXO("Add / Remove Plug-ins..."),
FN(OnManageGenerators), AudioIONotBusyFlag ), FN(OnManageGenerators), AudioIONotBusyFlag ),
@ -772,7 +773,7 @@ MenuTable::BaseItemPtr EffectMenu( AudacityProject &project )
else else
buildMenuLabel = XO("Repeat Last Effect"); buildMenuLabel = XO("Repeat Last Effect");
return Menu( _("Effe&ct"), return Menu( XO("Effe&ct"),
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT #ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
Command( wxT("ManageEffects"), XXO("Add / Remove Plug-ins..."), Command( wxT("ManageEffects"), XXO("Add / Remove Plug-ins..."),
FN(OnManageEffects), AudioIONotBusyFlag ), FN(OnManageEffects), AudioIONotBusyFlag ),
@ -801,7 +802,7 @@ MenuTable::BaseItemPtr AnalyzeMenu( AudacityProject & )
// All of this is a bit hacky until we can get more things connected into // All of this is a bit hacky until we can get more things connected into
// the plugin manager...sorry! :-( // the plugin manager...sorry! :-(
return Menu( _("&Analyze"), return Menu( XO("&Analyze"),
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT #ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
Command( wxT("ManageAnalyzers"), XXO("Add / Remove Plug-ins..."), Command( wxT("ManageAnalyzers"), XXO("Add / Remove Plug-ins..."),
FN(OnManageAnalyzers), AudioIONotBusyFlag ), FN(OnManageAnalyzers), AudioIONotBusyFlag ),
@ -829,7 +830,7 @@ MenuTable::BaseItemPtr ToolsMenu( AudacityProject & )
using Options = CommandManager::Options; using Options = CommandManager::Options;
auto gAudioIO = AudioIO::Get(); auto gAudioIO = AudioIO::Get();
return Menu( _("T&ools"), return Menu( XO("T&ools"),
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT #ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
Command( wxT("ManageTools"), XXO("Add / Remove Plug-ins..."), Command( wxT("ManageTools"), XXO("Add / Remove Plug-ins..."),
@ -842,7 +843,7 @@ MenuTable::BaseItemPtr ToolsMenu( AudacityProject & )
Command( wxT("ManageMacros"), XXO("&Macros..."), Command( wxT("ManageMacros"), XXO("&Macros..."),
FN(OnManageMacros), AudioIONotBusyFlag ), FN(OnManageMacros), AudioIONotBusyFlag ),
Menu( _("&Apply Macro"), Menu( XO("&Apply Macro"),
// Palette has no access key to ensure first letter navigation of // Palette has no access key to ensure first letter navigation of
// sub menu // sub menu
Command( wxT("ApplyMacrosPalette"), XXO("Palette..."), Command( wxT("ApplyMacrosPalette"), XXO("Palette..."),
@ -899,7 +900,7 @@ MenuTable::BaseItemPtr ExtraScriptablesIMenu( AudacityProject & )
// These are the more useful to VI user Scriptables. // These are the more useful to VI user Scriptables.
// i18n-hint: Scriptables are commands normally used from Python, Perl etc. // i18n-hint: Scriptables are commands normally used from Python, Perl etc.
return Menu( _("Script&ables I"), return Menu( XO("Script&ables I"),
// Note that the PLUGIN_SYMBOL must have a space between words, // Note that the PLUGIN_SYMBOL must have a space between words,
// whereas the short-form used here must not. // whereas the short-form used here must not.
// (So if you did write "CompareAudio" for the PLUGIN_SYMBOL name, then // (So if you did write "CompareAudio" for the PLUGIN_SYMBOL name, then
@ -944,7 +945,7 @@ MenuTable::BaseItemPtr ExtraScriptablesIIMenu( AudacityProject & )
using namespace MenuTable; using namespace MenuTable;
// Less useful to VI users. // Less useful to VI users.
return Menu( _("Scripta&bles II"), return Menu( XO("Scripta&bles II"),
Command( wxT("Select"), XXO("Select..."), FN(OnAudacityCommand), Command( wxT("Select"), XXO("Select..."), FN(OnAudacityCommand),
AudioIONotBusyFlag ), AudioIONotBusyFlag ),
Command( wxT("SetTrack"), XXO("Set Track..."), FN(OnAudacityCommand), Command( wxT("SetTrack"), XXO("Set Track..."), FN(OnAudacityCommand),

View File

@ -1034,7 +1034,7 @@ MenuTable::BaseItemPtr SelectMenu( AudacityProject& )
using Options = CommandManager::Options; using Options = CommandManager::Options;
/* i18n-hint: (verb) It's an item on a menu. */ /* i18n-hint: (verb) It's an item on a menu. */
return Menu( _("&Select"), return Menu( XO("&Select"),
Command( wxT("SelectAll"), XXO("&All"), FN(OnSelectAll), Command( wxT("SelectAll"), XXO("&All"), FN(OnSelectAll),
TracksExistFlag, TracksExistFlag,
Options{ wxT("Ctrl+A"), XO("Select All") } ), Options{ wxT("Ctrl+A"), XO("Select All") } ),
@ -1044,7 +1044,7 @@ MenuTable::BaseItemPtr SelectMenu( AudacityProject& )
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Menu( _("&Tracks"), Menu( XO("&Tracks"),
Command( wxT("SelAllTracks"), XXO("In All &Tracks"), Command( wxT("SelAllTracks"), XXO("In All &Tracks"),
FN(OnSelectAllTracks), FN(OnSelectAllTracks),
TracksExistFlag, TracksExistFlag,
@ -1061,7 +1061,7 @@ MenuTable::BaseItemPtr SelectMenu( AudacityProject& )
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Menu( _("R&egion"), Menu( XO("R&egion"),
Command( wxT("SetLeftSelection"), XXO("&Left at Playback Position"), Command( wxT("SetLeftSelection"), XXO("&Left at Playback Position"),
FN(OnSetLeftSelection), TracksExistFlag, FN(OnSetLeftSelection), TracksExistFlag,
Options{ wxT("["), XO("Set Selection Left at Play Position") } ), Options{ wxT("["), XO("Set Selection Left at Play Position") } ),
@ -1095,7 +1095,7 @@ MenuTable::BaseItemPtr SelectMenu( AudacityProject& )
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
Menu( _("S&pectral"), Menu( XO("S&pectral"),
Command( wxT("ToggleSpectralSelection"), Command( wxT("ToggleSpectralSelection"),
XXO("To&ggle Spectral Selection"), FN(OnToggleSpectralSelection), XXO("To&ggle Spectral Selection"), FN(OnToggleSpectralSelection),
TracksExistFlag, wxT("Q") ), TracksExistFlag, wxT("Q") ),
@ -1138,7 +1138,7 @@ MenuTable::BaseItemPtr SelectMenu( AudacityProject& )
MenuTable::BaseItemPtr ExtraSelectionMenu( AudacityProject & ) MenuTable::BaseItemPtr ExtraSelectionMenu( AudacityProject & )
{ {
using namespace MenuTable; using namespace MenuTable;
return Menu( _("&Selection"), return Menu( XO("&Selection"),
Command( wxT("SnapToOff"), XXO("Snap-To &Off"), FN(OnSnapToOff), Command( wxT("SnapToOff"), XXO("Snap-To &Off"), FN(OnSnapToOff),
AlwaysEnabledFlag ), AlwaysEnabledFlag ),
Command( wxT("SnapToNearest"), XXO("Snap-To &Nearest"), Command( wxT("SnapToNearest"), XXO("Snap-To &Nearest"),
@ -1187,7 +1187,7 @@ MenuTable::BaseItemPtr CursorMenu( AudacityProject & )
// GA: 'Skip to' moves the viewpoint to center of the track and preserves the // GA: 'Skip to' moves the viewpoint to center of the track and preserves the
// selection. 'Cursor to' does neither. 'Center at' might describe it better // selection. 'Cursor to' does neither. 'Center at' might describe it better
// than 'Skip'. // than 'Skip'.
return Menu( _("&Cursor to"), return Menu( XO("&Cursor to"),
Command( wxT("CursSelStart"), XXO("Selection Star&t"), Command( wxT("CursSelStart"), XXO("Selection Star&t"),
FN(OnCursorSelStart), FN(OnCursorSelStart),
TimeSelectedFlag, TimeSelectedFlag,
@ -1224,7 +1224,7 @@ MenuTable::BaseItemPtr ExtraCursorMenu( AudacityProject & )
{ {
using namespace MenuTable; using namespace MenuTable;
return Menu( _("&Cursor"), return Menu( XO("&Cursor"),
Command( wxT("CursorLeft"), XXO("Cursor &Left"), FN(OnCursorLeft), Command( wxT("CursorLeft"), XXO("Cursor &Left"), FN(OnCursorLeft),
TracksExistFlag | TrackPanelHasFocus, TracksExistFlag | TrackPanelHasFocus,
wxT("Left\twantKeyup\tallowDup") ), wxT("Left\twantKeyup\tallowDup") ),
@ -1251,7 +1251,7 @@ MenuTable::BaseItemPtr ExtraCursorMenu( AudacityProject & )
MenuTable::BaseItemPtr ExtraSeekMenu( AudacityProject & ) MenuTable::BaseItemPtr ExtraSeekMenu( AudacityProject & )
{ {
using namespace MenuTable; using namespace MenuTable;
return Menu( _("See&k"), return Menu( XO("See&k"),
Command( wxT("SeekLeftShort"), XXO("Short Seek &Left During Playback"), Command( wxT("SeekLeftShort"), XXO("Short Seek &Left During Playback"),
FN(OnSeekLeftShort), AudioIOBusyFlag, wxT("Left\tallowDup") ), FN(OnSeekLeftShort), AudioIOBusyFlag, wxT("Left\tallowDup") ),
Command( wxT("SeekRightShort"), Command( wxT("SeekRightShort"),

View File

@ -252,7 +252,7 @@ MenuTable::BaseItemPtr ToolbarsMenu( AudacityProject& )
static const auto checkOff = Options{}.CheckState( false ); static const auto checkOff = Options{}.CheckState( false );
return Menu( _("&Toolbars"), return Menu( XO("&Toolbars"),
/* i18n-hint: (verb)*/ /* i18n-hint: (verb)*/
Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"), Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"),
FN(OnResetToolBars), AlwaysEnabledFlag ), FN(OnResetToolBars), AlwaysEnabledFlag ),
@ -320,7 +320,7 @@ MenuTable::BaseItemPtr ToolbarsMenu( AudacityProject& )
MenuTable::BaseItemPtr ExtraToolsMenu( AudacityProject & ) MenuTable::BaseItemPtr ExtraToolsMenu( AudacityProject & )
{ {
using namespace MenuTable; using namespace MenuTable;
return Menu( _("T&ools"), return Menu( XO("T&ools"),
Command( wxT("SelectTool"), XXO("&Selection Tool"), FN(OnSelectTool), Command( wxT("SelectTool"), XXO("&Selection Tool"), FN(OnSelectTool),
AlwaysEnabledFlag, wxT("F1") ), AlwaysEnabledFlag, wxT("F1") ),
Command( wxT("EnvelopeTool"), XXO("&Envelope Tool"), Command( wxT("EnvelopeTool"), XXO("&Envelope Tool"),

View File

@ -1253,9 +1253,9 @@ MenuTable::BaseItemPtr TracksMenu( AudacityProject & )
// Tracks Menu (formerly Project Menu) // Tracks Menu (formerly Project Menu)
using namespace MenuTable; using namespace MenuTable;
using Options = CommandManager::Options; using Options = CommandManager::Options;
return Menu( _("&Tracks"), return Menu( XO("&Tracks"),
Menu( _("Add &New"), Menu( XO("Add &New"),
Command( wxT("NewMonoTrack"), XXO("&Mono Track"), FN(OnNewWaveTrack), Command( wxT("NewMonoTrack"), XXO("&Mono Track"), FN(OnNewWaveTrack),
AudioIONotBusyFlag, wxT("Ctrl+Shift+N") ), AudioIONotBusyFlag, wxT("Ctrl+Shift+N") ),
Command( wxT("NewStereoTrack"), XXO("&Stereo Track"), Command( wxT("NewStereoTrack"), XXO("&Stereo Track"),
@ -1270,7 +1270,7 @@ MenuTable::BaseItemPtr TracksMenu( AudacityProject & )
Separator(), Separator(),
Menu( _("Mi&x"), Menu( XO("Mi&x"),
// Stereo to Mono is an oddball command that is also subject to control // Stereo to Mono is an oddball command that is also subject to control
// by the plug-in manager, as if an effect. Decide whether to show or // by the plug-in manager, as if an effect. Decide whether to show or
// hide it. // hide it.
@ -1305,14 +1305,14 @@ MenuTable::BaseItemPtr TracksMenu( AudacityProject & )
Separator(), Separator(),
Menu( _("M&ute/Unmute"), Menu( XO("M&ute/Unmute"),
Command( wxT("MuteAllTracks"), XXO("&Mute All Tracks"), Command( wxT("MuteAllTracks"), XXO("&Mute All Tracks"),
FN(OnMuteAllTracks), AudioIONotBusyFlag, wxT("Ctrl+U") ), FN(OnMuteAllTracks), AudioIONotBusyFlag, wxT("Ctrl+U") ),
Command( wxT("UnmuteAllTracks"), XXO("&Unmute All Tracks"), Command( wxT("UnmuteAllTracks"), XXO("&Unmute All Tracks"),
FN(OnUnmuteAllTracks), AudioIONotBusyFlag, wxT("Ctrl+Shift+U") ) FN(OnUnmuteAllTracks), AudioIONotBusyFlag, wxT("Ctrl+Shift+U") )
), ),
Menu( _("&Pan"), Menu( XO("&Pan"),
// As Pan changes are not saved on Undo stack, // As Pan changes are not saved on Undo stack,
// pan settings for all tracks // pan settings for all tracks
// in the project could very easily be lost unless we // in the project could very easily be lost unless we
@ -1332,7 +1332,7 @@ MenuTable::BaseItemPtr TracksMenu( AudacityProject & )
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Menu( _("&Align Tracks"), //_("Just Move Tracks"), Menu( XO("&Align Tracks"), // XO("Just Move Tracks"),
// Mutual alignment of tracks independent of selection or zero // Mutual alignment of tracks independent of selection or zero
CommandGroup(wxT("Align"), CommandGroup(wxT("Align"),
{ {
@ -1361,7 +1361,7 @@ MenuTable::BaseItemPtr TracksMenu( AudacityProject & )
#if 0 #if 0
// TODO: Can these labels be made clearer? // TODO: Can these labels be made clearer?
// Do we need this sub-menu at all? // Do we need this sub-menu at all?
Menu( _("Move Sele&ction and Tracks"), { Menu( XO("Move Sele&ction and Tracks"), {
CommandGroup(wxT("AlignMove"), alignLabels, CommandGroup(wxT("AlignMove"), alignLabels,
FN(OnAlignMoveSel), AudioIONotBusyFlag | TracksSelectedFlag), FN(OnAlignMoveSel), AudioIONotBusyFlag | TracksSelectedFlag),
} ), } ),
@ -1377,7 +1377,7 @@ MenuTable::BaseItemPtr TracksMenu( AudacityProject & )
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Menu( _("S&ort Tracks"), Menu( XO("S&ort Tracks"),
Command( wxT("SortByTime"), XXO("By &Start Time"), FN(OnSortTime), Command( wxT("SortByTime"), XXO("By &Start Time"), FN(OnSortTime),
TracksExistFlag, TracksExistFlag,
Options{}.LongName( XO("Sort by Time") ) ), Options{}.LongName( XO("Sort by Time") ) ),
@ -1405,7 +1405,7 @@ MenuTable::BaseItemPtr ExtraTrackMenu( AudacityProject & )
{ {
using namespace MenuTable; using namespace MenuTable;
return Menu( _("&Track"), return Menu( XO("&Track"),
Command( wxT("TrackPan"), XXO("Change P&an on Focused Track..."), Command( wxT("TrackPan"), XXO("Change P&an on Focused Track..."),
FN(OnTrackPan), FN(OnTrackPan),
TrackPanelHasFocus | TracksExistFlag, wxT("Shift+P") ), TrackPanelHasFocus | TracksExistFlag, wxT("Shift+P") ),

View File

@ -904,8 +904,8 @@ MenuTable::BaseItemPtr TransportMenu( AudacityProject &project )
/* i18n-hint: 'Transport' is the name given to the set of controls that /* i18n-hint: 'Transport' is the name given to the set of controls that
play, record, pause etc. */ play, record, pause etc. */
return Menu( _("Tra&nsport"), return Menu( XO("Tra&nsport"),
Menu( _("Pl&aying"), Menu( XO("Pl&aying"),
/* i18n-hint: (verb) Start or Stop audio playback*/ /* i18n-hint: (verb) Start or Stop audio playback*/
Command( wxT("PlayStop"), XXO("Pl&ay/Stop"), FN(OnPlayStop), Command( wxT("PlayStop"), XXO("Pl&ay/Stop"), FN(OnPlayStop),
CanStopAudioStreamFlag, wxT("Space") ), CanStopAudioStreamFlag, wxT("Space") ),
@ -917,7 +917,7 @@ MenuTable::BaseItemPtr TransportMenu( AudacityProject &project )
CanStopAudioStreamFlag, wxT("P") ) CanStopAudioStreamFlag, wxT("P") )
), ),
Menu( _("&Recording"), Menu( XO("&Recording"),
/* i18n-hint: (verb)*/ /* i18n-hint: (verb)*/
Command( wxT("Record1stChoice"), XXO("&Record"), FN(OnRecord), Command( wxT("Record1stChoice"), XXO("&Record"), FN(OnRecord),
CanStopFlags, wxT("R") ), CanStopFlags, wxT("R") ),
@ -961,7 +961,7 @@ MenuTable::BaseItemPtr TransportMenu( AudacityProject &project )
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Menu( _("Pla&y Region"), Menu( XO("Pla&y Region"),
Command( wxT("LockPlayRegion"), XXO("&Lock"), FN(OnLockPlayRegion), Command( wxT("LockPlayRegion"), XXO("&Lock"), FN(OnLockPlayRegion),
PlayRegionNotLockedFlag ), PlayRegionNotLockedFlag ),
Command( wxT("UnlockPlayRegion"), XXO("&Unlock"), Command( wxT("UnlockPlayRegion"), XXO("&Unlock"),
@ -973,7 +973,7 @@ MenuTable::BaseItemPtr TransportMenu( AudacityProject &project )
Command( wxT("RescanDevices"), XXO("R&escan Audio Devices"), Command( wxT("RescanDevices"), XXO("R&escan Audio Devices"),
FN(OnRescanDevices), AudioIONotBusyFlag | CanStopAudioStreamFlag ), FN(OnRescanDevices), AudioIONotBusyFlag | CanStopAudioStreamFlag ),
Menu( _("Transport &Options"), Menu( XO("Transport &Options"),
// Sound Activated recording options // Sound Activated recording options
Command( wxT("SoundActivationLevel"), Command( wxT("SoundActivationLevel"),
XXO("Sound Activation Le&vel..."), FN(OnSoundActivated), XXO("Sound Activation Le&vel..."), FN(OnSoundActivated),
@ -1012,7 +1012,7 @@ MenuTable::BaseItemPtr TransportMenu( AudacityProject &project )
MenuTable::BaseItemPtr ExtraTransportMenu( AudacityProject & ) MenuTable::BaseItemPtr ExtraTransportMenu( AudacityProject & )
{ {
using namespace MenuTable; using namespace MenuTable;
return Menu( _("T&ransport"), return Menu( XO("T&ransport"),
// PlayStop is already in the menus. // PlayStop is already in the menus.
/* i18n-hint: (verb) Start playing audio*/ /* i18n-hint: (verb) Start playing audio*/
Command( wxT("Play"), XXO("Pl&ay"), FN(OnPlayStop), Command( wxT("Play"), XXO("Pl&ay"), FN(OnPlayStop),
@ -1054,7 +1054,7 @@ MenuTable::BaseItemPtr ExtraTransportMenu( AudacityProject & )
MenuTable::BaseItemPtr ExtraPlayAtSpeedMenu( AudacityProject & ) MenuTable::BaseItemPtr ExtraPlayAtSpeedMenu( AudacityProject & )
{ {
using namespace MenuTable; using namespace MenuTable;
return Menu( _("&Play-at-Speed"), return Menu( XO("&Play-at-Speed"),
/* i18n-hint: 'Normal Play-at-Speed' doesn't loop or cut preview. */ /* i18n-hint: 'Normal Play-at-Speed' doesn't loop or cut preview. */
Command( wxT("PlayAtSpeed"), XXO("Normal Pl&ay-at-Speed"), Command( wxT("PlayAtSpeed"), XXO("Normal Pl&ay-at-Speed"),
FN(OnPlayAtSpeed), CaptureNotBusyFlag ), FN(OnPlayAtSpeed), CaptureNotBusyFlag ),

View File

@ -441,8 +441,8 @@ MenuTable::BaseItemPtr ViewMenu( AudacityProject& )
static const auto checkOff = Options{}.CheckState( false ); static const auto checkOff = Options{}.CheckState( false );
return Menu( _("&View"), return Menu( XO("&View"),
Menu( _("&Zoom"), Menu( XO("&Zoom"),
Command( wxT("ZoomIn"), XXO("Zoom &In"), FN(OnZoomIn), Command( wxT("ZoomIn"), XXO("Zoom &In"), FN(OnZoomIn),
ZoomInAvailableFlag, wxT("Ctrl+1") ), ZoomInAvailableFlag, wxT("Ctrl+1") ),
Command( wxT("ZoomNormal"), XXO("Zoom &Normal"), FN(OnZoomNormal), Command( wxT("ZoomNormal"), XXO("Zoom &Normal"), FN(OnZoomNormal),
@ -459,7 +459,7 @@ MenuTable::BaseItemPtr ViewMenu( AudacityProject& )
Options{}.CheckState( gPrefs->Read(wxT("/GUI/VerticalZooming"), 0L) ) ) Options{}.CheckState( gPrefs->Read(wxT("/GUI/VerticalZooming"), 0L) ) )
), ),
Menu( _("T&rack Size"), Menu( XO("T&rack Size"),
Command( wxT("FitInWindow"), XXO("&Fit to Width"), FN(OnZoomFit), Command( wxT("FitInWindow"), XXO("&Fit to Width"), FN(OnZoomFit),
TracksExistFlag, wxT("Ctrl+F") ), TracksExistFlag, wxT("Ctrl+F") ),
Command( wxT("FitV"), XXO("Fit to &Height"), FN(OnZoomFitV), Command( wxT("FitV"), XXO("Fit to &Height"), FN(OnZoomFitV),
@ -470,7 +470,7 @@ MenuTable::BaseItemPtr ViewMenu( AudacityProject& )
FN(OnExpandAllTracks), TracksExistFlag, wxT("Ctrl+Shift+X") ) FN(OnExpandAllTracks), TracksExistFlag, wxT("Ctrl+Shift+X") )
), ),
Menu( _("Sk&ip to"), Menu( XO("Sk&ip to"),
Command( wxT("SkipSelStart"), XXO("Selection Sta&rt"), Command( wxT("SkipSelStart"), XXO("Selection Sta&rt"),
FN(OnGoSelStart), TimeSelectedFlag, FN(OnGoSelStart), TimeSelectedFlag,
Options{ wxT("Ctrl+["), XO("Skip to Selection Start") } ), Options{ wxT("Ctrl+["), XO("Skip to Selection Start") } ),

View File

@ -125,7 +125,7 @@ MenuTable::BaseItemPtr WindowMenu( AudacityProject & )
// poor imitation of the Mac Windows Menu // poor imitation of the Mac Windows Menu
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
using namespace MenuTable; using namespace MenuTable;
return Menu( _("&Window"), return Menu( XO("&Window"),
/* i18n-hint: Standard Macintosh Window menu item: Make (the current /* i18n-hint: Standard Macintosh Window menu item: Make (the current
* window) shrink to an icon on the dock */ * window) shrink to an icon on the dock */
Command( wxT("MacMinimize"), XXO("&Minimize"), FN(OnMacMinimize), Command( wxT("MacMinimize"), XXO("&Minimize"), FN(OnMacMinimize),

View File

@ -309,7 +309,7 @@ void KeyConfigPrefs::RefreshBindings(bool bSort)
{ {
wxArrayString Labels; wxArrayString Labels;
wxArrayString Categories; wxArrayString Categories;
wxArrayString Prefixes; TranslatableStrings Prefixes;
mNames.clear(); mNames.clear();
mKeys.clear(); mKeys.clear();

View File

@ -1043,7 +1043,7 @@ MenuTable::BaseItemPtr Scrubber::Menu()
) ); ) );
} }
return MenuTable::Menu( _("Scru&bbing"), std::move( ptrs ) ); return MenuTable::Menu( XO("Scru&bbing"), std::move( ptrs ) );
} }
void Scrubber::PopulatePopupMenu(wxMenu &menu) void Scrubber::PopulatePopupMenu(wxMenu &menu)

View File

@ -635,7 +635,7 @@ KeyView::UpdateHScroll()
void void
KeyView::RefreshBindings(const CommandIDs & names, KeyView::RefreshBindings(const CommandIDs & names,
const wxArrayString & categories, const wxArrayString & categories,
const wxArrayString & prefixes, const TranslatableStrings & prefixes,
const wxArrayString & labels, const wxArrayString & labels,
const std::vector<NormalizedKeyString> & keys, const std::vector<NormalizedKeyString> & keys,
bool bSort bool bSort
@ -665,7 +665,7 @@ KeyView::RefreshBindings(const CommandIDs & names,
// Remove any menu code from the category and prefix // Remove any menu code from the category and prefix
wxString cat = wxMenuItem::GetLabelText(categories[i]); wxString cat = wxMenuItem::GetLabelText(categories[i]);
wxString pfx = wxMenuItem::GetLabelText(prefixes[i]); wxString pfx = wxMenuItem::GetLabelText(prefixes[i].Translation());
// Append "Menu" this node is for a menu title // Append "Menu" this node is for a menu title
if (cat != wxT("Command")) if (cat != wxT("Command"))

View File

@ -83,7 +83,7 @@ public:
void RefreshBindings(const CommandIDs & names, void RefreshBindings(const CommandIDs & names,
const wxArrayString & categories, const wxArrayString & categories,
const wxArrayString & prefixes, const TranslatableStrings & prefixes,
const wxArrayString & labels, const wxArrayString & labels,
const std::vector<NormalizedKeyString> & keys, const std::vector<NormalizedKeyString> & keys,
bool bSort); bool bSort);