September 2017
Intermediate to advanced
450 pages
11h 24m
English
Many browsers have differences in the way they return browser language configurations. For example, Safari returns the browser language locale as en-us instead of en-US like other browsers. Browsers such as IE 9 and 10 don't even provide navigation.language and instead rely on their own navigation.browserLanguage property. An easy fix to this problem is to normalize both options into your document.locale value in lowercase format, as follows:
document.locale = (navigator.language || navigator.browserLanguage).toLowerCase();
Angular will still recognize these as valid locale properties for our date localization.
You can learn more about how these language configurations are provided in the browser and their various compatibility ...
Read now
Unlock full access