Skip to content

Commit

Permalink
Merge pull request #685 from openSUSE/webpack_locale_fix
Browse files Browse the repository at this point in the history
Webpack dev server: Fixed locale handling (null check)
  • Loading branch information
lslezak authored Aug 3, 2023
2 parents fa00c19 + 2be011d commit 57d328b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion web/src/lib/webpack-po-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`))) {
Expand Down

0 comments on commit 57d328b

Please sign in to comment.