diff --git a/web/src/lib/webpack-po-handler.js b/web/src/lib/webpack-po-handler.js index e14a1b59f6..78a26f216a 100644 --- a/web/src/lib/webpack-po-handler.js +++ b/web/src/lib/webpack-po-handler.js @@ -14,7 +14,7 @@ module.exports = function (req, res) { const language = req.headers.cookie.replace(/(?:(?:^|.*;\s*)CockpitLang\s*=\s*([^;]*).*$)|^.*$/, "$1") || ""; // the cookie uses "pt-br" format while the PO file is "pt_BR" :-/ let [lang, country] = language.split("-"); - country = country.toUpperCase(); + country = country?.toUpperCase(); // first check the full locale ("pt_BR") PO file if (fs.existsSync(path.join(__dirname, "..", "..", "po", `${lang}_${country}.po`))) {