I have developed the website in html5. In this I have an language selection option, now it is in English. If I select any other language, then it should show the contents in that language. I don't want to use the Google translator to translate the content. I have the content in all languages. If any tags or methods in html5 or HTML to get and display the contents specific to that language?
You can use Javascript localization (this is one of your tags, so I guess you'd use it).
What you can do is a quick-check for the locale of the user, thus filling the page with a matching localization of your contents.
Here's a quick and dirty example. (note: this is purely dynamic)
locale = (navigator["language"] || "en").split("-")[0];
localization = {
"de": "Hallo Benutzer!",
"en": "Hey user!"
};
text = localization[locale] || localization["en"];
e = document.createElement("span");
e.innerHTML = text;
document.body.appendChild(e);
If your website is a static one, then you can clone your site for each language, by using language specific content, and access each version with a different base url ( domain/en/..., domain/es/....).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With