JDK-7093156 : NLS: Please change the mnemonic assignment system to avoid translation issue (Swing files)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-09-21
  • Updated: 2014-10-14
  • Resolved: 2012-06-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7u6Fixed 8 b34Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
WPTG (translation team) translatability (t13y) requirement:

When designing GUI that includes mnemonics, please define the text label and
mnemonic character in one resource, with the mnemonic character preceded by
ampersand (&).


English :  


Japanese :  



English :  


Japanese :  


The issue has been identified on the following Swing files:
This issue also impacts:

There are tests that check mnemonics for Swing components: jdk/test/javax/swing/JMenu/4515762/bug4515762.java jdk/test/javax/swing/JTabbedPane/4624207/bug4624207.java jdk/test/javax/swing/JRootPane/4670486/bug4670486.java jdk/test/javax/swing/JMenu/4692443/bug4692443.java jdk/test/javax/swing/JLabel/6596966/bug6596966.java jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java jdk/test/javax/swing/JMenuItem/ShortcutNotDiplayed/ShortcutNotDisplayedTest.java jdk/test/javax/swing/JColorChooser/Test6524757.java


EVALUATION changeset: http://hg.openjdk.java.net/jdk8/awt/jdk/rev/cbf39e7a7535

EVALUATION The demo propertis updating is covered by issue 7158926 The macosx properties updating is covered by the issue 7158928 Now all properties are generated with the following suffixes: xxx.textAndMnemonic and xxx.titleAndMnemonic - patterns which are generated to properties with the xxx.textAndMnemonic suffix: (xxxNameText, xxxNameMnemonic) (xxxNameText, xxxMnemonic) (xxx.nameText, xxx.mnemonic) (xxxText, xxxMnemonic) - pattern which is generated to properties with the xxx.titleAndMnemonic suffix: (xxxTitle, xxxMnemonic) After that the extended hashmap check a key suffix and generate a compositeKey which allows to get a property in a new format and extract a text, mnemonic or mnemonic index from it. The attached SwingResourcesTest test gets a path to the old properties and L&F class. If L&F is not null than it is set. After that the test gets all properties and it's values and check that values are equal to the values which are got from the UIManager.get(key, locale).

EVALUATION According to the bug pre-processing/post-processing property files is considered as unreliable and it is suggested to not do that for jdk8. There is the following format in the swing *.properties files now: ------------------------------------------------------- FileChooser.updateButtonText=Update FileChooser.updateButtonMnemonic=85 ------------------------------------------------------- We can't change this property to FileChooser.updateButtonText=&Update because users are able to override this property by UIManager.put(key, value) method. So it is a valid case to use the & in a text and it is expected that this symbol is shown. There will be a regression if we do not show this symbol. So we need to introduce new properties like FileChooser.localized.updateButtonText and support both formats. If a user use the old format than we need to process it in other case we need to parse new format. So it seems that there is big work that includes following changes: - L&F UI for JLabel AbstractButton JColorChooser JFileChooser JTabbedPane components - Basic and Metal L&Fs and synthetic property files - property files for different localizations: default, de, es, fr, it, ja, ko, pt_BR, sv, zh_CN, zh_TW. The second question is a public API to allow users to use & symbol for mnemonics. It looks like we need to add method like setLocalizationText(String text) for components with the setDisplayedMnemonic() method (JLabel AbstractButton JColorChooser JFileChooser JTabbedPane components) . There are some questions about it: - How the text should look like if it needs to use & in the text? - How do we want to process html text that can contain symbols like < ?