In MacOS, Windows and Linux you can set your preferred language, e.g. en-US
but also choose a region for formatting.
For example, I’ve set my MacOS to en-US
but with German formatting.
In JavaScript there’s no possibility to get both OS settings.
navigator.language
returnsen-US
.Intl.DateTimeFormat().resolvedOptions().locale
returnsen-GB
(for whatever reason? Chrome’s language setting isen-US
)
I’ve also noticed that MacOS is doing it wrong. In its menu bar it currently shows “Wed Sep 4” which is not in German formatting. When changing the OS language to “en-GB” it changes to “Wed 4. Sep” – so it’s clearly using the language setting and not my regional preference for formatting. Also, shouldn’t it be Mi 4. Sept.
which would be the real German formatting?
Now, when it comes to using components, most of them only offer a locale, so any formatting is derived from the language.
Why do most components (or even apps) not allow you to set preferences for formatting? Is it uncommon for most people to use a language with a different regional formatting?
Or is my understanding of how it should work wrong?