TL;DR : just call localizeTags
in your page and all tags marked with 'localize' attribute
will be translated!
npm install just-localize
Note that there's a TypeScript declaration file, too.
This tiny library help you add support for multiple language to your site.
See full example in a single web-page under the example directory. No need for a server to run it.
<html>
<label localize>There are #32# people here</label>
</html>
<script>
const dictionaries = {
en: {
'*': {
'there are #xxx# people here': 'There are #xxx# people here'
}
},
he: {
'*': {
'there are #1# people here': 'יש פה #1# אנשים'
}
}
}
setDictionary(locale, dictionaries['he'])
localizeTags()
</script>
This library provided as-is, with absolutely no guarantee. Enjoy, support, etc, in short, it's ISC.
I'd be happy to receive a star for example, or a little donation....