From 7fd1b0aa2ba741103a7d9ac835514ebbeae3bcff Mon Sep 17 00:00:00 2001 From: xuenhua Date: Fri, 29 Apr 2022 01:01:32 +0800 Subject: Delete mnemonics for CJK translations on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit '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 --- vcl/osx/salmenu.cxx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'vcl') 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 #include #include +#include namespace { @@ -588,22 +589,8 @@ void AquaSalMenu::SetItemText( unsigned /*i_nPos*/, SalMenuItem* i_pSalMenuItem, AquaSalMenuItem *pAquaSalMenuItem = static_cast(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"; -- cgit