mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 22:12:58 +02:00
Fix format of tooltip text for toolbar buttons in RTL languages...
... No translatable strings were added, two were removed
This commit is contained in:
@@ -1287,24 +1287,51 @@ void CommandManager::TellUserWhyDisallowed( const wxString & Name, CommandFlag f
|
||||
}
|
||||
|
||||
wxString CommandManager::DescribeCommandsAndShortcuts
|
||||
(const std::vector<wxString> &commands, const wxString &separator) const
|
||||
(const std::vector<wxString> &commands) const
|
||||
{
|
||||
wxString mark;
|
||||
// This depends on the language setting and may change in-session after
|
||||
// change of preferences:
|
||||
bool rtl = (wxLayout_RightToLeft == wxTheApp->GetLayoutDirection());
|
||||
if (rtl)
|
||||
mark = wxT("\u200f");
|
||||
|
||||
static const wxString &separatorFormat = wxT("%s / %s");
|
||||
wxString result;
|
||||
auto iter = commands.begin(), end = commands.end();
|
||||
while (iter != end) {
|
||||
result += *iter++;
|
||||
// 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, *iter++);
|
||||
|
||||
if (iter != end) {
|
||||
if (!iter->empty()) {
|
||||
auto keyStr = GetKeyFromName(*iter);
|
||||
if (!keyStr.empty()){
|
||||
result += wxT(" ");
|
||||
result += Internat::Parenthesize(KeyStringDisplay(keyStr, true));
|
||||
auto keyString = KeyStringDisplay(keyStr, true);
|
||||
auto format = wxT("%s %s(%s)");
|
||||
#ifdef __WXMAC__
|
||||
// The unicode controls push and pop left-to-right embedding.
|
||||
// This keeps the directionally weak characters, such as uparrow
|
||||
// for Shift, left of the key name,
|
||||
// consistently with how menu accelerators appear, even when the
|
||||
// system language is RTL.
|
||||
format = wxT("%s %s(\u202a%s\u202c)");
|
||||
#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);
|
||||
}
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
if (iter != end)
|
||||
result += separator;
|
||||
if (result.empty())
|
||||
result = piece;
|
||||
else
|
||||
result = wxString::Format(separatorFormat, result, piece);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -270,9 +270,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
||||
// 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 std::vector<wxString> &commands,
|
||||
// If more than one pair of strings is given, then use this separator.
|
||||
const wxString &separator = wxT(" / ")) const;
|
||||
const std::vector<wxString> &commands) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
Reference in New Issue
Block a user