How/Where does JavaScript detect the default locale? -
today, 11th of september, 2017, javascript's tolocaledatestring() method outputting 9/11/2017 me. in uk, formatting wrong in case. mdn web docs tell me method returns "a formatted string in default locale".
so, where/how javascript detecting default locale? set, or depend on, , (how) can change it?
edited add: i'm using firefox 55.0.3 on windows 10 if makes difference.
to summarize shortly, detecting current locale implementation dependent , may differ environment environment. default language may depend on installer you've used install browser.
the not short version:
following ecmascript spec, conforming browsers (and other environments, such node.js) should implement localization following ecmascript internationalization api (ecma-402), outlines following getting default locale:
the defaultlocale abstract operation returns string value representing [...] language tag host environment’s current locale.
this means getting default locale implementation dependent , can differ browser browser. intentional, allows browser vendors keep current, differing implementations stay conforming without fuss.
while it's true nice have standardized well, it's more beneficial everyone on board broad spec first , work out little kinks later.
most modern browsers allow change current default locale in preferences (chrome shown):

Comments
Post a Comment