Hello Dimitry and Chris,
the following code makes it possible to assign mnemonics to menu items in a
language-independent way, using ampersand &.
public void setLabelAndMnemonic(JMenuItem item, String inLabel) {
//Ampersand indicates that the character after it is a mnemo,
//unless the character is a space. In "Find & Replace",
//ampersand does not label mnemo, while in "&About", mnemo is
//"Alt + A".
String rawLabel = inLabel;
if (rawLabel==null) rawLabel = item.getLabel();
if (rawLabel==null) return;
item.setLabel(rawLabel.replaceAll("&([a-zA-Z])","$1"));
int mnemoSignIndex = rawLabel.indexOf("&");
if (mnemoSignIndex >= 0 && mnemoSignIndex+1 < rawLabel.length()) {
char charAfterMnemoSign = rawLabel.charAt(mnemoSignIndex+1);
if (charAfterMnemoSign!=' ')
item.setMnemonic(charAfterMnemoSign); }}
The code is copyright (C) Daniel Polansky, 2007, published under GNU GPL V2
or later, as usual. You may want to incorporate it into the coming version;
if so, I may, when the time of translations comes, tell the translators they
may use the ampersand & to indicate where they have chosen to set mnemonic.
Using ampersand is a standard way of indicating mnemos, says my web
research.
References
- popeye.sourceforge.net > Images >
ScreenShot-0-4<http://popeye.sourceforge.net/images/ScreenShot-0-4.jpg>
- Download Language File Editor 1.1.2 - The Language File Editor is a
small program that allows to edit language files used by most of my
softwares. -
Softpedia<http://www.softpedia.com/get/Others/Miscellaneous/Language-File-Editor.shtml>
- Punt Homepage :
Translators<http://punt.sourceforge.net/new_svn/translators.html>
- Peculiarities and Difficulties (KDE
Localization)<http://l10n.kde.org/docs/translation-howto/gui-peculiarities.html>
Best regards,
Dan
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freemind-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemind-developer