Skip to content
15 changes: 3 additions & 12 deletions src/Core/src/Platform/Android/LocalizedDigitsKeyListener.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Globalization;
using Android.Text;
using Android.Text.Method;
using Java.Lang;
Expand All @@ -17,17 +18,6 @@ public class LocalizedDigitsKeyListener : NumberKeyListener
static Dictionary<char, LocalizedDigitsKeyListener>? UnsignedCache;
static Dictionary<char, LocalizedDigitsKeyListener>? SignedCache;

static char GetDecimalSeparator()
{
if (!(NumberFormat.Instance is DecimalFormat format))
return '.';


DecimalFormatSymbols? sym = format.DecimalFormatSymbols;

return sym == null ? '.' : sym.DecimalSeparator;
}

public static NumberKeyListener Create(InputTypes inputTypes)
{
if ((inputTypes & InputTypes.NumberFlagDecimal) == 0)
Expand All @@ -39,7 +29,8 @@ public static NumberKeyListener Create(InputTypes inputTypes)
}

// Figure out what the decimal separator is for the current locale
char decimalSeparator = GetDecimalSeparator();
var symbol = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
var decimalSeparator = string.IsNullOrEmpty(symbol) ? '.' : symbol[0];

if (decimalSeparator == '.')
{
Expand Down
Loading