I am trying to implement a very simple MUI with jQuery. Tried a few plugins but all of them are changing a language inside tags with specific ID, class name or data attribute. I need to translate an interface by shortcodes like {%translateme%}.
The HTML code I am using is:
<div>{%projects%}</div>
<input type="text" placeholder="{%tasks%}"/>
<div><a href="#" id="en">English</a> | <a href="#" id="fr">French</a></div>
And my jQuery is:
var english = {
"projects": "Projects",
"tasks": "Tasks",
};
var french = {
"projects": "Projets",
"tasks": "Tâches",
};
$(document).ready(function() {
$("#en").click(function(){
console.log('changeLanguage English');
//changeLanguage function
});
});
$(document).ready(function() {
$("#fr").click(function(){
console.log('changeLanguage French');
//changeLanguage function
});
});
By default I need to load English if possible.
Please find the example on jsFiddle here: https://jsfiddle.net/g1hpkphg/2/
Many thanks for your help in advance.