The simplest way to make a multilingual site (=localization) with tiny javascript code.
###How to use: load multilingualizer.js like
<script src="multilingualizer.js"></script>
and write multilingual text
<span>[[ja]]これは日本語です[[en]]This is English</span>
If you want to use any html in multilingual text, please use escaped html like this:
<div>
[[en]]email:<a href=mailto:[email protected]>[email protected]</a>
[[ja]]Eメール:<a href=mailto:[email protected]>[email protected]</a>
</div>
###How does this library assign a language at first?
- OS locale language (default)
- URL parameter "lang" ex.
http://[url]?key=value&lang=en
###Can this library memorise the selected language after user leaves the page?
Yes. Once user choose a language, this library keeps it in memory(LocalStorage of HTML5). The selected language kept in memory is priored to URL parameter lang.
###Demo:
http://hitokun-s.github.io/multilingualizer.js/demo.html