Resolves: rhbz#902694 impossible short-cuts for OK/Cancel translations

auto-adding mnemonics to the first character of OK/Cancel translations suggests
short-cuts under various CJK/Indic languages which can't be achieved with a
single keystroke combination

Some platforms want mnemonic-ed OK/Cancel, some don't. So lets have two
translations, one for each situation, rather than trying to automunge.

Change-Id: I23e21e79b27ead86f535309ca0efc2adea86ae24
This commit is contained in:
Caolán McNamara
2013-01-25 13:42:13 +00:00
parent 610ebd9a11
commit 14d8cd11d6
3 changed files with 29 additions and 12 deletions

View File

@@ -156,6 +156,8 @@
#define SV_BUTTONTEXT_NEW 10115 #define SV_BUTTONTEXT_NEW 10115
#define SV_BUTTONTEXT_EDIT 10116 #define SV_BUTTONTEXT_EDIT 10116
#define SV_BUTTONTEXT_APPLY 10117 #define SV_BUTTONTEXT_APPLY 10117
#define SV_BUTTONTEXT_OK_NOMNEMONIC 10118
#define SV_BUTTONTEXT_CANCEL_NOMNEMONIC 10119
#define SV_STDTEXT_FIRST SV_STDTEXT_SERVICENOTAVAILABLE #define SV_STDTEXT_FIRST SV_STDTEXT_SERVICENOTAVAILABLE
#define SV_STDTEXT_SERVICENOTAVAILABLE 10200 #define SV_STDTEXT_SERVICENOTAVAILABLE 10200

View File

@@ -143,18 +143,16 @@ OUString Button::GetStandardText( StandardButtonType eButton )
} }
sal_uInt32 nResId = aResIdAry[(sal_uInt16)eButton].nResId; sal_uInt32 nResId = aResIdAry[(sal_uInt16)eButton].nResId;
OUString aText = ResId(nResId, *pResMgr).toString(); #ifdef WNT
// http://lists.freedesktop.org/archives/libreoffice/2013-January/044513.html
if (nResId == SV_BUTTONTEXT_OK || nResId == SV_BUTTONTEXT_CANCEL) // Under windows we don't want accelerators on ok/cancel but do on other
{ // buttons
#ifndef WNT if (nResId == SV_BUTTONTEXT_OK)
// Windows (apparently) has some magic auto-accelerator evil around nResId = SV_BUTTONTEXT_OK_NOMNEMONIC;
// ok / cancel so add accelerators only for Unix else if (nResId == SV_BUTTONTEXT_CANCEL)
if (aText.indexOf('~') == -1) nResId = SV_BUTTONTEXT_CANCEL_NOMNEMONIC;
return "~" + aText;
#endif #endif
} return ResId(nResId, *pResMgr).toString();
return aText;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View File

@@ -18,13 +18,30 @@
#include <svids.hrc> #include <svids.hrc>
//http://lists.freedesktop.org/archives/libreoffice/2013-January/044513.html
//Special OK/Cancel handling
String SV_BUTTONTEXT_OK String SV_BUTTONTEXT_OK
{ {
Text [ en-US ] = "OK"; Text [ x-comment ] = "This is used on buttons for platforms other than windows, there should be a ~ mnemonic in this string";
Text [ en-US ] = "~OK";
}; };
String SV_BUTTONTEXT_CANCEL String SV_BUTTONTEXT_CANCEL
{ {
Text [ x-comment ] = "This is used on buttons for platforms other than windows, there should be a ~ mnemonic in this string";
Text [ en-US ] = "~Cancel";
};
String SV_BUTTONTEXT_OK_NOMNEMONIC
{
Text [ x-comment ] = "This is used on buttons for Windows, there should be no ~ mnemonic in this string";
Text [ en-US ] = "OK";
};
String SV_BUTTONTEXT_CANCEL_NOMNEMONIC
{
Text [ x-comment ] = "This is used on buttons for Windows, there should be no ~ mnemonic in this string";
Text [ en-US ] = "Cancel"; Text [ en-US ] = "Cancel";
}; };