I am using the pelican site generator, and inside the theme there I use is a script which loads and displays search results on a HTML page. Some of the strings are hardcoded inside the JavaScript code (the heading text, "There are ${x} results", etc.), but I need them localized.
I researched mani I18N options for JavaScript, but didn't find one which works with .po files. It's a relatively simple blog built with a static site generator written in Python, so I don't want to mess things including NodeJS staff.
Is there a library which could be used similar to the next example?
index.html
<!DOCTYPE html>
<html lang="LANG_CODE_HERE">
<head>
<meta charset="utf-8" />
<!-- ... -->
<title>PAGE TITLE GOES HERE</title>
<!-- load the library -->
<script src="js/library.js" type="text/javascript"></script>
<!-- load the script which contains the strings -->
<script src="js/script.js" type="text/javascript"></script>
</head>
<body>
<!-- ... -->
</body>
</html>
js/script.js
const urlParams = new URLSearchParams(window.location.search);
var searchTerm = urlParams.get("q");
document.getElementById("searchHeading").innerHTML = '<h1>' + gettext("Search results for <kbd>%(search_term)s</kbd>", search_term=searchTerm) + '</h1>';