default to pt-br if browser is set to pt

If the user has not yet set their own language, but has pt in their browser, use pt-br for now, to accommodate for our large Brasilian base. Fixes #273.
This commit is contained in:
Matthew Taylor 2016-01-04 14:18:47 -05:00
parent 0e82f99515
commit 0a313ad29b

View file

@ -64,6 +64,9 @@ var translations = require('../locales/translations.json');
var obj = jar.get('scratchlanguage');
if (typeof obj === 'undefined') {
obj = window.navigator.userLanguage || window.navigator.language;
if (['pt','pt-pt','PT','PT-PT'].indexOf(obj) !== -1) {
obj = 'pt-br'; // default Portuguese users to Brazilian Portuguese due to our user base. Added in 2.2.5.
}
}
if (typeof translations[obj] === 'undefined') {
// Fall back on the split