DeskCalc: make input Locale-aware

Accepts input with separators based on user's Locale.  For example,
with a European locale, "1.234,56" is valid input. With a US locale,
"1,234.56" is accepted.  The grouping separator is ignored and
removed, and the decimal separator is kept.

Supports multi-byte decimal separator and grouping separators.

The keypad localization is based on the user's Language setting,
but the separators come from the Formatting. Thus if the Language
is set to English, but the Formatting is set to, for example,
German, the keypad will show '.', but when pressed it will emit
',' to match the number Formatting. Otherwise the keypad breaks
the localized formatting.

Fixes #8503

Change-Id: I0d112bdca67a4e4898e37062102343194ed47f8f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4965
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Dale Cieslak
2022-04-25 20:57:20 +00:00
committed by waddlesplash
parent cda13c638d
commit d39b5bfd0c
3 changed files with 77 additions and 11 deletions
@@ -50,6 +50,8 @@ class ExpressionParser {
int64 EvaluateToInt64(const char* expressionString);
double EvaluateToDouble(const char* expressionString);
status_t SetSeparators(BString decimal, BString group);
private:
struct Token;
class Tokenizer;