Entry with numeric keyboard - no comma displayed on device

MikilllMikilll Member ✭✭✭
edited March 15 in Xamarin.Forms

Hello,
I created a simple Entry with numeric keyboard like this:

<StackLayout x:Name="root" VerticalOptions="FillAndExpand" Spacing="0">
    <Entry Keyboard="Numeric"/>
</StackLayout>

On my Samsung device, I don't know why it is not displaying a button for a comma. In my country (Poland) the comma is used as a decimal separator so I want to be able to type it.

Anyone has encountered such a problem?

I will be grateful for any help.

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Since it says "Done" in English and not "Gotowe" in Polish, I would assume the device locale has not been set to Poland. If you have the device set to US you should get all the US localization including decimal separator.

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    @ClintStLaurent said:
    Since it says "Done" in English and not "Gotowe" in Polish, I would assume the device locale has not been set to Poland. If you have the device set to US you should get all the US localization including decimal separator.

    Taking the opportunity to ask my Polish colleague who happens to be in our office today. His basic Android calculator (Polish locale) has a comma where I have a decimal point on my UK locale phone. So I reckon Clint's hit the nail on the head here.

  • MikilllMikilll Member ✭✭✭

    Ok. So how to force locale of the keyboard to be Polish always regardless of what is the device locale?

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭
    edited March 15

    You don't. You set the device to a give locale. The operating system takes care of everything it is responsible for, like the various keyboards.

    It would be highly confusing if the numeric keyboard were in polish, and the regular keyboard was in Russian, and the email keyboard were in English while the rest of the OS was in French.

    It would be even worse when dealing with currency if different parts of the device were in different localities.

    So you don't get to pick and choose. You set the entire device to a locale.

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    Actually it is possible, I think - see this stackoverflow thread.

    You then have to balance the potential confusion of different keyboard layouts in your app compared with the device as a whole (as mentioned by Clint).

  • MikilllMikilll Member ✭✭✭

    Unfortunately, I have switched device language to Polish and I still can't type comma on my numeric keyboard. I think it's a problem with Xamarin Forms.

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    @Mikilll That's interesting. It could well be a bug in Forms. I'll try creating a project and see what happens (with my Polish colleague).

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    Which device is this on? If it's a Samsung device, then there is a bug (https://github.com/xamarin/Xamarin.Forms/issues/1898) logged which describe almost exactly your problem.

    The bad news is that the bug is in the Samsung device, not Forms. :(

    The good news is that there is a workaround. :) - see https://github.com/xamarin/Xamarin.Forms/issues/1898#issuecomment-432539426

    I haven't reviewed the exact workaround to see if it works!

Sign In or Register to comment.