Multilang
A quick XMLHTTP solution for multiple languages on one page.
Setting up
Firstly, import the MutiLang class.
Then create the object:
var multilang = /* Array to Language files */
Your language files should be JSON parse-able.
Let's take this english.json
as an example.
Now if you have - somewhere in your DOM:
Then MultiLang will happily fetch your title and put it into your <h1>
element.
You can change the language later using:
multilang
You can also nest your language files:
Then you can load them like this:
Easy peasy.