1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Remove TranslatedInternalString, use ComponentInterfaceSymbol

This commit is contained in:
Paul Licameli
2019-12-15 10:58:19 -05:00
parent e875adaa6f
commit 54e2bbd8ff
19 changed files with 79 additions and 116 deletions

View File

@@ -64,7 +64,7 @@ bool BatchEvalCommand::Apply(const CommandContext & context)
auto iter = catalog.ByCommandId(cmdName);
const wxString &friendly = (iter == catalog.end())
? cmdName // Expose internal name to user, in default of a better one!
: iter->name.Translated();
: iter->name.StrippedTranslation();
// Create a Batch that will have just one command in it...
MacroCommands Batch;

View File

@@ -963,8 +963,8 @@ void CommandManager::SetKeyFromIndex(int i, const NormalizedKeyString &key)
entry->key = key;
}
wxString CommandManager::DescribeCommandsAndShortcuts
(const TranslatedInternalString commands[], size_t nCommands) const
TranslatableString CommandManager::DescribeCommandsAndShortcuts(
const ComponentInterfaceSymbol commands[], size_t nCommands) const
{
wxString mark;
// This depends on the language setting and may change in-session after
@@ -974,7 +974,7 @@ wxString CommandManager::DescribeCommandsAndShortcuts
mark = wxT("\u200f");
static const wxString &separatorFormat = wxT("%s / %s");
wxString result;
TranslatableString result;
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
@@ -982,7 +982,11 @@ wxString CommandManager::DescribeCommandsAndShortcuts
// 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.Translated());
// Note: not putting this and other short format strings in the
// translation catalogs
auto piece = TranslatableString{wxT("%s%s")}
.Format( mark, TranslatableString{pair.Msgid()}.Strip() );
auto name = pair.Internal();
if (!name.empty()) {
@@ -1000,14 +1004,14 @@ wxString CommandManager::DescribeCommandsAndShortcuts
#endif
// The mark makes correctly placed parentheses for RTL, even
// in the case that the piece is untranslated.
piece = wxString::Format(format, piece, mark, keyString);
piece = TranslatableString{format}.Format( piece, mark, keyString );
}
}
if (result.empty())
result = piece;
else
result = wxString::Format(separatorFormat, result, piece);
result = TranslatableString{ separatorFormat }.Format( result, piece );
}
return result;
}

View File

@@ -34,7 +34,6 @@ class wxMenuBar;
class wxArrayString;
class wxMenu;
class wxMenuBar;
class TranslatedInternalString;
using CommandParameter = CommandID;
struct MenuBarListEntry
@@ -288,11 +287,11 @@ class AUDACITY_DLL_API CommandManager final
///
/// Formatting summaries that include shortcut keys
///
wxString DescribeCommandsAndShortcuts
TranslatableString DescribeCommandsAndShortcuts
(
// 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;
const ComponentInterfaceSymbol commands[], size_t nCommands) const;
// Sorted list of the shortcut keys to be exluded from the standard defaults
static const std::vector<NormalizedKeyString> &ExcludedList();