diff options
author | xuenhua <xuenhua2008@sina.com> | 2022-04-29 01:01:32 +0800 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-05-02 18:54:20 +0200 |
commit | 7fd1b0aa2ba741103a7d9ac835514ebbeae3bcff (patch) | |
tree | 91245f8e1af359f92e799f47a566b0ccc50f7173 | |
parent | 1139013b129fb7f3c58583cdef86b3cdae469f20 (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>
-rw-r--r-- | vcl/osx/salmenu.cxx | 19 |
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"; |