Step 1. Include vavilon.js in your webpage
You can also get the bundle via npm or GitHub Releases.
Say goodbye to duplicate html files
vavilon.js makes i18n for static sites easy to setup and maintain
vavilon.js weighs only 2.4 KB — less than 1000 bytes gzipped!
Edit translations without editing the website source code
Translate string by string while keeping the site functional
Use and change vavilon.js in whichever way you desire
You can also get the bundle via npm or GitHub Releases.
Think of a unique ID for every string and add it using
vavilon
class and
data-vavilon
attribute.
Create a JSON file with an object where keys are the string IDs and the values are the translated strings.
Just before you load the vavilon.js, insert the links to your
dictionaries and specify their language. Don't forget about
<html>
tag!
The automatic language switching is already up and running! If
you want your user to be able to switch languages, use the
setLang
function.