Languager is ease to use JavaScript program that will make ease to create websites with multiple languages
Download module.js and add the script to your webpage.
<script src='module.js'></script>
First you need to initialize a class.
var languager = new Languager({
element: document.body,
pageTitle: "homepage"
})
You need to set element which will be your main element where is your website located. If you have #root div, you can put it there.
Now you just run this command to load strings from json file that will be generated by editor.
Pagetitle is setting that is used to select string that should be in title. In this case it will select title with key "homepage".
languager.load("/strings.json")
<h1>[titleMyWebsite]</h1>
This will add h1 with titleMyWebsite text from json that you loaded.
If you want to add language change button you just put this button inside your html:
<button onclick="languager.changeLanguage('en')">English</button>
This button will change language to English.
You can visit JSON Editor written in HTML, CSS and JavaScript here
Editor is python program that will help you create your json file easily.
To start editor you download editor.py file and run this command:
python3 editor.py