Simple multilanguage with jQuery
https://github.com/dakk/jquery-multilang a simple and fast multilanguage lib for jQuery.
- Put the attribute tkey in each element you want to translate:
<p tkey="string-key-example"></p>
- Modify the lang json files, having one translated string for each tkey in each language file:
"string-key-example" : "Example string in English"
- Load jquery.js and lang.js at the end of the HTML file:
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="lang.js"></script>Written by Davide Gessa
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Jquery
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#