Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PT Run][Calculator] Ignore regional formatting #33275

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

evinnichenko
Copy link

@evinnichenko evinnichenko commented Jun 7, 2024

Summary of the Pull Request

PR Checklist

Detailed Description of the Pull Request / Additional comments

Initial issue has been inconsistency when pressing . on numpad in Russian, which would produce non-English decimal separators (namely, for my locale, , instead of .). This PR aims to fix that by introducing a new optional flag IgnoreRegionalFormatting and editing the input in NumberTranslator.cs to remove all but last separators and replace the last with the locale-appropriate one.

Validation Steps Performed

Open PT Run and enter same mixed decimal number with different decimal separators, and see that if the flag is turned on, the exact symbol for the decimal separator doesn't matter. Couple tests were created to check it.

@evinnichenko
Copy link
Author

One drawback is that upon reviewing it, the current solution only works for select locale pairs where decimal separator of the second language is same as the group separator in the first language (e.g. en/ru pair works fine). If this condition doesn't apply, then this fix doesn't work.

TODO: add functionality to cover for other separators. In particular, Windows seems to only have four default separators (,, ., , and '), so NumberTranslator.cs/GetSplitRegex() could be modified to use different regex, including all four of them, if the flag is raised. Theoretically, this would allow to expand it from certain particular locale pairs to all of them except the ones where symbol used is custom (e.g. you can make 1,234.5 show up as 1-234\5 by editing the Windows settings).

@evinnichenko
Copy link
Author

@microsoft-github-policy-service agree

@htcfreek
Copy link
Collaborator

htcfreek commented Jun 7, 2024

I worry that the two settings can break each other or at least confuse users. Can we switch to a drop down "Select how to handle seperators on input" with the options system default, en-us (,) and auto-detect? Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants