- Add references i18njs into last line body tag.
<script src="js/i18n.js"></script>
- Add "lang" class to the element you want to translate and the key with which you want to identify it.
<h1 class="lang" key="key1">Hola</h1>
- Create your custom translate dictionary defined key/value translates, replacing "translation.js".
var languages = {
'es': {
"key1": "Hola",
"key2": "Hola2"
//etc
}
, 'en': {
"key1": "Hello",
"key2": "Hello2"
//etc
}
};
**It is very important that you keep the folder structure.
Thanks!