This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 23665 - I18N - mnemonic key doesn't work with translated.
Summary: I18N - mnemonic key doesn't work with translated.
Status: CLOSED WORKSFORME
Alias: None
Product: utilities
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: All All
: P4 blocker (vote)
Assignee: issues@utilities
URL: http://www.netbeans.org/download/apis...
Keywords: A11Y, I18N
Depends on:
Blocks:
 
Reported: 2002-05-17 10:55 UTC by Masafumi Matsuda
Modified: 2002-12-23 16:35 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
snap shot (14.55 KB, image/gif)
2002-05-17 10:58 UTC, Masafumi Matsuda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Masafumi Matsuda 2002-05-17 10:55:52 UTC
Please see attched image file. 
Mnemonic Keys which was mistaken on the Japanese
is attached.

To reproduce:
1.Highlight a file or directory on the Explorer.
2.Tools -> Create Group
The Mnemonic Keys of "Look In"

Would you check if the first character is not used
as mnemonic key?
By localization, the first character becomes
no-ascii character. As a
result, the mnemonic key doesn't work by
localization. To fix this
problem, we need to set two resource bundle
messages, one is for 
caption, another is for mnemonic.
  Example=TestString
  Example_Mnemonic=T

And we should use like this:
myButton.setText(myBundle.getString("Example"));
myButton.setMnemonic(myBundle.getString("Example_Mnemonic").charAt(0).

The following line does not work with localized
version, because the
first character is not an alphanumeric because
it's replaced to
multi-byte Japanese character.

OS:Solaris 5.9  
Orion Build:orion_ml_020507  fcc Build:20.4
JDK:JDK1.4.0
locale:ja
Comment 1 Masafumi Matsuda 2002-05-17 10:58:18 UTC
Created attachment 5801 [details]
snap shot
Comment 2 Masafumi Matsuda 2002-05-17 10:59:59 UTC
I added the keyword "A11Y" for the bug.
But I could not add the interest list for the bug.
(michele.budris@sun.com) 
Comment 3 _ lkramolis 2002-05-22 15:28:14 UTC
Q: If I understand it right expresion
'myBundle.getString("Example_Mnemonic").charAt(0)' does not return
correct values which is assigned to "Example_Mnemonic" key? Is it correct?

If it is, then it should be problem with all mnemonics in IDE because
"two resource bundle keys" is preferred way, how to set mnemonic.
Comment 4 _ lkramolis 2002-05-22 15:40:40 UTC
Second try: Or do you have problem to localize 'Object Name' mnemonic?
Did you include '&' into localized value (what marks mnemonic)?
Comment 5 Keiichi Oono 2002-05-24 05:06:23 UTC
As you mentioned, 'myBundle.getString("Example_Mnemonic").charAt(0)'
should work correctly.
I've checked the attached image file. In English version, the mnemonic
of "Look
In" is 'L', and in localized window, the first character is set as
mnemonic key. The localized first character does not work as mnemonic
because mnemonic must be one of the ascii characters.

// It will not work when we localize
setText(bundle.getString("KEY_OF_LOOK_IN");
setMnemonic(bundle.getString("KEY_OF_LOOK_IN").charat(0));

// It will work with localization
setText(bundle.getString("KEY_OF_LOOK_IN");
setMnemonic(bundle.getString("KEY_OF_LOOK_IN_mnem").charat(0));

   KEY_OF_LOOK_IN=Look In
   KEY_OF_LOOK_IN_mnem=L

Would you please check the source code how it set the mnemonic?

Regards,
Keiichi
Comment 6 _ lkramolis 2002-05-24 11:37:16 UTC
OK, now I understand.

I will go through all sources and where it will be possible I will add
key for mnemonic.

But 'Look in' is something different (see issue URL). This component
is created by openide
(org.openide.TopManager.NodeOperation.select(...)) which takes just a
String, but please look at rootTitle description -- label at root of
dialog. May use & for a mnemonic. So you should use & before character
which represents mnemonic (& will not be displayed).
Comment 7 _ lkramolis 2002-05-24 15:10:55 UTC
Used separated MNEM keys for mnemonics.
Comment 8 hiroshiy 2002-10-07 10:52:01 UTC
Hello Libor,

Please revise the string as follows.
If I add japanese characters (in "Bundle_ja.properties" file),
mnemonic is appeared on the first character,
even if the first character is double bytes character.

  ---
  org/netbeans/modules/group/Bundle.properties

    PROP_Look_In=Look In
       ==>>  PROP_Look_In=&Look In
  ---                    ~~~

Hiroshi
Comment 9 _ lkramolis 2002-10-07 11:07:46 UTC
See my [2002-05-24 03:37 PDT] comment -- PROP_Look_In value have to
contain & for mnemonic (first char is default), see
<http://www.netbeans.org/download/apis/org/openide/TopManager.NodeOperation.html#select(java.lang.String,%20java.lang.String,%20org.openide.nodes.Node,%20org.openide.nodes.NodeAcceptor,%20java.awt.Component)>.

If I understand your comment, if you add & to PROP_Look_In's value in
Bundle_ja.properties, it will fix your problem. Right?
Comment 10 hiroshiy 2002-10-10 08:54:46 UTC
Sorry Labor,

I decide that, I agree with your current fixing.
Because, your modification is correct.

I will investigate a problem of API's fundamental spec for l10n work, 
in the outside of this issue.
I am sorry to confuse you.

Hiroshi.
Comment 11 hiroshiy 2002-10-10 08:55:51 UTC
I've verified the fixing in "NetBeans Development Build
(200210030100)".
Thank you - Hiroshi.
Comment 12 hiroshiy 2002-11-21 06:39:53 UTC
This issue is no longer reappeared.
Because, this function was already removed.
Therefore, this issue should be closed.

Hiroshi.
Comment 13 Jesse Glick 2002-12-23 16:35:22 UTC
Consistent use of the I18N keyword.