summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxuenhua <xuenhua2008@sina.com>2022-04-29 01:01:32 +0800
committerCaolán McNamara <caolanm@redhat.com>2022-05-02 21:52:44 +0200
commita2c6e46cecfb50f1f3558b078479c89c068df279 (patch)
treea97187dbd6f1e6fa70395f54b2fb7aea70c7f476
parentfdf4390415a6956144d055a32579105deaef913a (diff)
Delete mnemonics for CJK translations on macOS
'Cop~y' translated into Chinese is '复制(~Y)' But the mnemonics '(Y)' is useless on macOS. In English, 'Cop~y' with the '~' removed is the correct result. But in CJK should remove along with '(' and ')', not just only for mbMenuBar. Use the method MnemonicGenerator::EraseAllMnemonicChars already defined in vcl/mnemonic.hxx Change-Id: Ic37ce566923e3dea47535d187b1b3dba2088e960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133572 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 7fd1b0aa2ba741103a7d9ac835514ebbeae3bcff) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133714
-rw-r--r--vcl/osx/salmenu.cxx19
1 files changed, 3 insertions, 16 deletions
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index 3164ba873bae..12291be3df83 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -41,6 +41,7 @@
#include <quartz/utils.h>
#include <strings.hrc>
#include <window.h>
+#include <vcl/mnemonic.hxx>
namespace {
@@ -588,22 +589,8 @@ void AquaSalMenu::SetItemText( unsigned /*i_nPos*/, SalMenuItem* i_pSalMenuItem,
AquaSalMenuItem *pAquaSalMenuItem = static_cast<AquaSalMenuItem *>(i_pSalMenuItem);
- // Delete mnemonics
- OUString aText = i_rText.replaceAll("~", "");
-
- /* #i90015# until there is a correct solution
- strip out any appended (.*) in menubar entries
- */
- if( mbMenuBar )
- {
- sal_Int32 nPos = aText.lastIndexOf( '(' );
- if( nPos != -1 )
- {
- sal_Int32 nPos2 = aText.indexOf( ')' );
- if( nPos2 != -1 )
- aText = aText.replaceAt( nPos, nPos2-nPos+1, u"" );
- }
- }
+ // Delete all mnemonics of mbMenuBar and CJK-style mnemonic
+ OUString aText = MnemonicGenerator::EraseAllMnemonicChars(i_rText);
if (aText.endsWith("...", &aText))
aText += u"\u2026";