Skip to content

Commit

Permalink
Fix JS localization: msgstr is an array (pypi#17424)
Browse files Browse the repository at this point in the history
  • Loading branch information
di authored Jan 16, 2025
1 parent ba6d7bd commit 84205d6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions webpack.plugin.localize.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ const allLocaleData = KNOWN_LOCALES
if (refs.every(refLine => !refLine.includes(".js:"))) {
continue;
}
result[value.msgid] = value.msgstr
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
result[value.msgid] = value.msgstr.map(function(str) {
return str
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
});
}
return result;
} catch (e) {
Expand Down

0 comments on commit 84205d6

Please sign in to comment.