adobe-photoshop / spaces-design

Adobe Photoshop Design Space
http://adobe-photoshop.github.io/
Other
851 stars 74 forks source link

Number localization with os-specified decimal separator #3692

Closed iwehrman closed 8 years ago

iwehrman commented 8 years ago

This PR improves our number localization so that the operating system-specified decimal separator is used, and not just the locale default. This is done by fetch localeInfo from Photoshop before starting the application, and using that to provide util-level information about the correct decimal separator and a decimal-formatting function. I did it this way because a) this setting can't change without restarting Photoshop, and b) it turned out to be extremely challenging to put this into our usual Flux data flow (i.e., it would have required major refactorings, and it just didn't seem to be worth the effort).

To test, manually change your locale's decimal separator this like: image And then restart Photoshop .

Addresses #3136.

mcilroyc commented 8 years ago

reviewed. questions/suggestions, but merge-able as is.

iwehrman commented 8 years ago

I didn't create a parseDecimal function in js/util/nls because that would have required pulling more math into the NLS module than seemed appropriate, so instead I just factored out normalizeDecimalExpr, which replaces , with . as needed in arithmetic decimal expressions. Back to @mcilroyc

iwehrman commented 8 years ago

Fixed. Back to @mcilroyc again.