diff --git a/red/api/locales.js b/red/api/locales.js index 9f49d4bda..84c9eb196 100644 --- a/red/api/locales.js +++ b/red/api/locales.js @@ -19,7 +19,7 @@ module.exports = { get: function(req,res) { var namespace = req.params[0]; namespace = namespace.replace(/\.json$/,""); - var lang = i18n.determineLangFromHeaders(req.acceptedLanguages); + var lang = i18n.determineLangFromHeaders(req.acceptedLanguages || []); var prevLang = i18n.i.lng(); i18n.i.setLng(lang, function(){ var catalog = i18n.catalog(namespace,lang); diff --git a/red/i18n.js b/red/i18n.js index 5a101f348..3e0d50f6d 100644 --- a/red/i18n.js +++ b/red/i18n.js @@ -125,7 +125,7 @@ function determineLangFromHeaders(acceptedLanguages){ lang = acceptedLanguages[i]; break; // check the language without the country code - } else if (supportedLangs.indexOf(acceptedLangs[i].split("-")[0]) !== -1) { + } else if (supportedLangs.indexOf(acceptedLanguages[i].split("-")[0]) !== -1) { lang = acceptedLanguages[i].split("-")[0]; break; }