<Swing Dev> Review request for 7093156: NLS: Please change the mnemonic assignment system to avoid translation issue (Swing files)

Pavel Porvatov pavel.porvatov at oracle.com
Thu Mar 29 09:19:22 UTC 2012


Hi Alexander,

I have several questions about the patch.

File TextAndMnemonicHashMap:
1. MNEMONIC_SUFFIX[] = {"Mnemonic", "mnemonic", "Mnemonic", "Mnemonic",}
what's the reason have three "Mnemonic" values?

2. TEXT_SUFFIX[] = {"NameText", "nameText", "Text", "Title"}
What is the reason to have "NameText", "nameText". It looks there is no 
need in that because that's a particular case of "Text"

3. Could you pleas use "for each" loops (if possible), they are more 
compact and readable

4. Integer.toString((int) Character.toUpperCase(c)) looks a little bit 
tricky. Can we use something like this:
String.valueOf(Character.toUpperCase(c)) ?

5. What is the reason to have the second loop? Can we just check
stringKey.endsWith("mnemonic") || stringKey.endsWith("Mnemonic")?

Regards, Pavel

> bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7093156
> webrev: http://cr.openjdk.java.net/~alexsch/7093156/webrev.00/
>
> The properties in the swing resources files are changed from the
>   xxxText=ABC
>   xxxMnemonic=B
> to
>   xxxTextAndMnemonic=A&BC
>
> where Text suffix can be one of the following: "NameText", "nameText", 
> "Text" and  "Title"
>
>
> The hashmap in UIDefaults class is extended to return the correct 
> values for the keys xxxText and xxxMnemonic from the stored 
> xxxTextAndMnemonic string.
>
> There is no html text in the swing resource files so this case is not 
> considered.
> The fix covers only the swing resource files in the JDK:
>   src/share/classes/com/sun/swing/internal/plaf
>   src/share/classes/com/sun/java/swing/plaf
>
> The demo resources will be fixed in the separated issue.
>
> Thanks,
> Alexandr.
>




More information about the swing-dev mailing list