This repository was archived by the owner on May 9, 2023. It is now read-only.
Always use InvariantCulture when converting from/to floats#16
Open
benediktwerner wants to merge 1 commit intosinai-dev:mainfrom
Open
Always use InvariantCulture when converting from/to floats#16benediktwerner wants to merge 1 commit intosinai-dev:mainfrom
benediktwerner wants to merge 1 commit intosinai-dev:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15
I'm actually rather confused why the current code doesn't already work and just allows me to use
,everywhere. After looking into it a bit, apparently, during the first call toInteractiveNumber.RefreshUIForValue,CurrentCultureis set tode-DEi.e. German as expected but on later calls to both it andInteractiveNumber.SetValueFromInput, it's unset.CurrentUICultureis always set to German though but it doesn't seem to impact whether a period or comma is used for parsing and printing.So during the initial refresh, the input is set to
3,5but then on all further calls it wants3.5.Not really sure why this is, I guess apparently the culture is set per thread and maybe the other calls run in another thread where the culture isn't set or is reset for some reason?
I guess if you know why this happens, maybe you can find a better fix. Otherwise, the proposed changes work as expected though I guess it's a bit annoying to have to specify the culture everywhere and I guess is also a bit brittle since it's easy to forget but not sure there's a much better solution.