1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 23:28:06 +02:00

Merge pull request #5692 from Rob--W/webl10n-fix

[l10n] Treat language as case-insensitive
This commit is contained in:
Yury Delendik 2015-03-09 23:24:57 -05:00
commit da258f8972
2 changed files with 26 additions and 16 deletions

View file

@ -447,20 +447,10 @@ if (typeof PDFJS === 'undefined') {
// Checks if navigator.language is supported
(function checkNavigatorLanguage() {
if ('language' in navigator &&
/^[a-z]+(-[A-Z]+)?$/.test(navigator.language)) {
if ('language' in navigator) {
return;
}
function formatLocale(locale) {
var split = locale.split(/[-_]/);
split[0] = split[0].toLowerCase();
if (split.length > 1) {
split[1] = split[1].toUpperCase();
}
return split.join('-');
}
var language = navigator.language || navigator.userLanguage || 'en-US';
PDFJS.locale = formatLocale(language);
PDFJS.locale = navigator.userLanguage || 'en-US';
})();
(function checkRangeRequests() {