I want to build a website having its content in two languages. I want to use jQuery for the language switching. My idea is this:
instead of having actual content in the HTML page:
<div>Hello there</div>
I want to use classes:
HTML:
<div class="hello_EN"></div>
JS(I'm not good at JS; i've combined it with some PHP so I can make myself understood):
var EN = new array('hello_EN' => 'Hello there');
foreach($EN as $class => $content)
$(".$class").text("$content"); //this should populate all my HTML classes with its content
Then, I must have my second language array:
var RO = new array('hello_RO' => 'Salut');
Now, the switching:
$("#change_to_RO").click(function() {
$(EN).replaceWith(RO);
});
How should I approach this? Thanks.