Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
What/where is the locale stored in chrome browser?

There exist the function Number.toLocaleString, where the first argument (locale) can be omitted to provide the current host locale.

Described as (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString):

// Use the host default language with options for number formatting
var num = 30000.65;
console.log(num.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}));
// → "30,000.65" where English is the default language, or
// → "30.000,65" where German is the default language, or
// → "30 000,65" where French is the default language

Now I changed in my browser the languages and selected "dutch" to the top (under chrome://settings/languages). This made navigator.languages return ["nl", "en-NL", "en-GB", "nl-NL", "en-US", "en"]

However when I then use:

var num = 30000.65;
console.log(num.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}));

The result is 30,000.65 - using still the english locale. If I use navigator.languages instead of undefined the result is as expected. (30.000,65).

Where does javascript get the locale from? How can I change the current of my browser? Even my OS (ubuntu) is set to dutch locale.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!