1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Use TranslatedInternalString for tips of toolbar buttons

This commit is contained in:
Paul Licameli
2018-03-15 19:26:20 -04:00
parent d258385e3a
commit 9b7ccc4dff
12 changed files with 50 additions and 66 deletions

View File

@@ -1353,7 +1353,7 @@ void CommandManager::TellUserWhyDisallowed( const wxString & Name, CommandFlag f
}
wxString CommandManager::DescribeCommandsAndShortcuts
(const LocalizedCommandNameVector &commands) const
(const TranslatedInternalString commands[], size_t nCommands) const
{
wxString mark;
// This depends on the language setting and may change in-session after
@@ -1364,15 +1364,16 @@ wxString CommandManager::DescribeCommandsAndShortcuts
static const wxString &separatorFormat = wxT("%s / %s");
wxString result;
for (const auto &pair : commands) {
for (size_t ii = 0; ii < nCommands; ++ii) {
const auto &pair = commands[ii];
// If RTL, then the control character forces right-to-left sequencing of
// "/" -separated command names, and puts any "(...)" shortcuts to the
// left, consistently with accelerators in menus (assuming matching
// operating system prefernces for language), even if the command name
// was missing from the translation file and defaulted to the English.
auto piece = wxString::Format(wxT("%s%s"), mark, pair.first);
auto piece = wxString::Format(wxT("%s%s"), mark, pair.Translated());
wxString name{ pair.second };
wxString name{ pair.Internal() };
if (!name.empty()) {
auto keyStr = GetKeyFromName(name);
if (!keyStr.empty()){

View File

@@ -313,14 +313,11 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
///
/// Formatting summaries that include shortcut keys
///
using LocalizedCommandName = std::pair<wxString, const wxChar*>;
using LocalizedCommandNameVector = std::vector<LocalizedCommandName>;
wxString DescribeCommandsAndShortcuts
(// An array of paired user-visible strings, and
// non-user-visible command names. If a shortcut key is defined
// for the command, then it is appended, parenthesized, after the
// user-visible string.
const LocalizedCommandNameVector &commands) const;
(
// If a shortcut key is defined for the command, then it is appended,
// parenthesized, after the translated name.
const TranslatedInternalString commands[], size_t nCommands) const;
// Sorted list of the shortcut keys to be exluded from the standard defaults
static const std::vector<NormalizedKeyString> &ExcludedList();