How can I change Chrome settings to test using navigator.language

Max Heiber picture Max Heiber · Mar 17, 2016 · Viewed 15.9k times · Source

I'm trying to internationalize an app and need to test how it behaves in other locales.

However, navigator.language always returns en-US, even if I change language settings in both Chrome and OS X.

What can I do to the browser to force navigator.language to return something like es-MX?

Clarification

I'm trying to make the change as a user, through the GUI, not with code.

Answer

Tracysss picture Tracysss · Mar 18, 2016

Use chrome://settings/languages#lang and (important) make sure that the language you selected is the top choice (the preferred language).

More information: https://alicoding.com/detect-browser-language-preference-in-firefox-and-chrome-using-javascript/