pressing numpad comma displays period

Hi,If I press the comma on my numpad, a period is shown in my Java UI.First of all, is this a localization issue? If so, how do I solve this issue?Thanks!Peter
[194 byte] By [ptiea] at [2007-10-3 3:20:25]
# 1

It sounds as if you are running your Java UI with an input language that uses a keyboard layout with a comma on the numpad, not a period. That would be a lot of keyboard layouts, since most countries use a comma as the decimal separator, not a period.

It sounds as if this is working as designed, not an "issue".

one_danea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...
# 2

I am indeed running my Java UI with an input language that uses a keyboard layout with a comma on the numpad, i.e. Dutch, and in Dutch the decimal separator is the comma.

So if I press 1 2 3 , 4 5 I expect the following:

123,45

But I get the following:

123.45

...which is not want a Dutch user expects.

ptiea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...
# 3

Sorry, I misread your original post (too early in the morning, before I had my first cup of coffee...).

So, you are running this application on a system with Dutch as the system locale, and Dutch keyboard layout as the default. And the keyboard layout seems to be switched under the covers for this one, specific application. That is indeed strange.

I assume this impacts not just the numpad period key, but other keys that are laid out differently on a Dutch keyboard? Have you tried switching the layout back to Dutch manually for the application? I understand this would not fix your problem (since you want to figure out why this happens in the first place).

one_danea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...
# 4

I checked the default Locale with:

System.err.println(Locale.getDefault()); // prints nl_NLl

And the keyboard layout with (is this the right way to check this?):

System.err.println(InputContext.getInstance().getLocale()); // prints nl_NL too

InputContext.getInstance().selectInputMethod(Locale.getDefault()) returns true, but does not fix my problem.

ptiea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...
# 5

I would be inclined to think that you are really seeing the effect of the Windows defaulting for Dutch that is described in Michael Kaplan's blog here:

http://blogs.msdn.com/michkap/archive/2006/08/03/687472.aspx

I assume from what you are saying that you actually use the "real" Dutch keyboard layout as the default on your system, however, and not the US International which is the Windows default for the nl_NL locale? Which keyboard do your regional options list for the Dutch language?

I don't think the InputContext locale that you got indicates keyboard layout, btw., it only shows the locale (you can use any keyboard layout in combination with that locale).

one_danea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...
# 6

The keyboard listed is US International, but the default input language is set to:

Dutch (Dutch) - US (International)

If I change this to:

Dutch (Dutch) - Dutch (Dutch)

...the problem is solved.

But... we don 't want our users have to switch their input language just to use our application. Therefore, I think we will just listen to the KeyEvents thrown by Java, and convert any Numpad period to a Numpad comma if the Dutch locale is the default locale.

If you have a better solution than the the one stated above, just tell me :)

Thank you for pointing me in the right direction!

Regards,

Peter

ptiea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...
# 7

yw :-)

Unfortunately, I don't have a better recommendation.

I would probably be rather hesitant to implement your suggested workaround, though, if the use of the US International keyboard is a widespread as is suggested in Michael's blog. I should add that his comments correspond with my own experience, working with Dutch translation testers: according to them, it would be extremely rare for Dutch users to actually use the "Ducth" keyboard. In the cases where they needed to input Dutch special characters (also rare, according to them), they would use an Alt + key combination.

So I would have thought that your workaround would actually produce unexpected results for the majority of Dutch users?

one_danea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...
# 8

Hmmm... I don 't think so.

First of all, if the keyboard numpad displays a comma, you would expect a comma, not a period :)

Second, although a US keyboard has a numpad period (here at home, I have one before me, a Dell keyboard), a Dutch user still expects a comma. This is for example how Excel and OpenOffice Calc work. If I press the numpad period in Excel I get a comma. The same applies to OpenOffice Calc.

Putting it al together, at work I have (propably a Dutch keyboard with) a numpad comma which displays a period. At home I have a US keyboard with a numpad period which (as a US user would expect) displays a period. For a Dutch user, both is undesireable behaviour (especially for applications like Excel and OpenOffice Calc).

Therefore the workaround.

Still following me? ;)

ptiea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...
# 9

> First of all, if the keyboard numpad displays a

> comma, you would expect a comma, not a period :)

>

Well, the physical keyboard layout does not necessarily have any relationship to the keyboard layout defined by software - as you have just verified. And I think what I have heard in the past is that many Dutch users actually have the physical US keyboard also.

Having said that, i did just verify that Excel has the behavior you described, so it seems that Microsoft (and OpenOffice) implemented the kind of workaround for the Dutch input locale that you describe in those specific apps, so it makes sense to do the same if your users will be inputting a lot of numbers.

However, this behavior has only been implemented in these kinds of Windows applications - if you use a Dutch input locale in Microsoft Word, Notepad, etc., a Numpad period/comma (whatever is physically on the keyboard) produces a period.

So, I guess the expected behavior for Dutch depends on the primary purpose of the application. Which apparently makes sense to Dutch users - I would be hopelessly confused :-)

one_danea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...
# 10
Thanks again for your replies!Message was edited by: ptie
ptiea at 2007-7-14 21:12:37 > top of Java-index,Desktop,I18N...