Skip to content

Commit

Permalink
Use optional chaining operator (?.)
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Aug 3, 2023
1 parent f74eae0 commit 2be011d
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("-");
if (country) 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 2be011d

Please sign in to comment.