Jump to content

HTML Lang attribute


a.c.
 Share

Recommended Posts

I'm having a problem with the lang attribute in html. I can't seem to change the language to anything other than English. I've tried the following <html lang="fr"> <meta http-equiv="content-type" content="text/html;charset=UTF-8"/> <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"/> <meta http-equiv="content-language" content="fr"/> but none of them seem to work. Does anyone have a solution to this? Kind regards,a.c.

Link to comment
Share on other sites

Thats not how the lang attribute works. The lang attribute, tells web browsers, search engines, and other marchine, the language of element's content (including attribute's value for web browsers.) If you are exspecting the browser to (for example) translate the english phrase "The Clone" to french "El clone", then you are missing the point. The browser do not translate, it only try its best, to make it look like french (by manipulating it a little). For example, when you use double quotes around a word ("MAN"), the browser will try to make it look like french, by converting double quotes to e.g: guillemets («MAN»). It also helps screen readers, when pronouncing words.

Link to comment
Share on other sites

Like I said earlier, the "lang" attribute is purely to tell people and machines what language you have used in the element. If you want your site in french then hire a french translator.

Thats not how the lang attribute works. The lang attribute, tells web browsers, search engines, and other marchine, the language of element's content (including attribute's value for web browsers.) If you are exspecting the browser to (for example) translate the english phrase "The Clone" to french "El clone", then you are missing the point. The browser do not translate, it only try its best, to make it look like french (by manipulating it a little). For example, when you use double quotes around a word ("MAN"), the browser will try to make it look like french, by converting double quotes to e.g: guillemets («MAN»). It also helps screen readers, when pronouncing words.
I don't believe the browser should do anything at all with the content. I wouldn't want my quotation marks modified by the browser.
Link to comment
Share on other sites

Well, i have tried it so many times though, but i hardly see any change(s), except for IE8, when you do something like this:

<q lang="fr">FRENCH</q>

Output: «FRENCH»

<q lang="en">ENGLISH</q>

Output: "ENGLISH"

Edited by CodeName
Link to comment
Share on other sites

Well, i have tried it so many times though, but i hardly see any change(s), except for IE8, when you do something like this:
<q lang="fr">FRENCH</q>

Output: «FRENCH»

<q lang="en">ENGLISH</q>

Output: "ENGLISH"

There aren't any quotation marks in the code, though. I thought you were referring to something like this:
<p lang="fr">Some "quoted" text.</p>

Remember old versions Internet Explorer don't actually put any quotation marks on the <q> element. I know all other browsers have supported it forever.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...