vcl/osx/salmenu.cxx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)
New commits: commit 7fd1b0aa2ba741103a7d9ac835514ebbeae3bcff Author: xuenhua <xuenhua2...@sina.com> AuthorDate: Fri Apr 29 01:01:32 2022 +0800 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon May 2 18:54:20 2022 +0200 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 <caol...@redhat.com> 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";