Reputation: 31
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?
Upvotes: 3
Views: 14706
Reputation: 829
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);
Upvotes: 3
Reputation: 2365
You will need to get your pages translated into whatever languages you want.
Duplicate your entire web structure per language so you end up with
www.example.com/en/.. www.example.com/fr/..
etc
Generally people give use a flag to indicate the language and redirect to the corresponding language page.
Upvotes: 2
Reputation: 635
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/....).
Upvotes: 2
Reputation: 943100
No.
HTML allows you to specify the language you are working in with lang
attributes, but it provides no specific features for (manually or automatically) translation.
Upvotes: 1