Forum Moderators: open

Message Too Old, No Replies

Language of page set at servers?

         

Dexie

9:16 am on Apr 25, 2005 (gmt 0)

10+ Year Member



I may have got this a bit wrong, but is there some way of inputting some code at my servers, so that I don't have to input code into my webpages to identify the language it should be read in please?

Span

10:52 am on Apr 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Dexie, adding this line in your .htaccess:

AddLanguage en .html

will add this to the headers of all .html pages:

Content-Language: en

but I am not sure if that replaces the lang="en" in the html tag below.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

Dexie

1:01 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



Hi Span,

Thanks for the info, in relation to this thread, this is exactly what I have in my html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="Content-Language" content="en">
</head>

So, I assume that I can change things so that it's now:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>

Can you see any other changes, assuming I put the code referred to before in my servers?

Dexie.

Span

5:52 pm on Apr 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



.. but AddLanguage won't replace the charset meta. You need something else. For html pages you can do that in your .htaccess with:
AddType 'text/html; charset=ISO-8859-1' html

For PHP I use:

AddDefaultCharset On

which adds Content-Type: text/html to all the page headers.

So, assuming you use html, to get rid of the metas on your pages you would have to use this:

AddDefaultCharset On
Content-Language: en

tedster

6:15 pm on Apr 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



so that I don't have to input code into my webpages to identify the language it should be read in please?

Using the lang attribute for the html tag within your html document - <html lang="de"> for example - is still a good idea. It is the standard, in fact, although not yet widely implemented.

You cannot tell what signs different search engines will be taking into account. Especially if you have non-English pages I'd suggest covering all the bases for the best results. Many servers give wrong http information and if I were creating any kind of search engine, I would look at everything possible to get an accurate idea of what the language of a page really is.

Dexie

9:17 am on Apr 27, 2005 (gmt 0)

10+ Year Member



<quote>
Using the lang attribute for the html tag within your html document - <html lang="de"> for example - is still a good idea. It is the standard, in fact, although not yet widely implemented.

</quote>

Thanks for the help on this.

Could I avoid this though, by implemtning the codes above by Span, into the .htaccess?

Dexie.

Span

11:08 am on Apr 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Searched W3 for this and found the question:

Should I declare the language of my XHTML document using a language attribute, the Content-Language HTTP header, or a meta element?

[w3.org ]

Dexie

11:24 am on Apr 27, 2005 (gmt 0)

10+ Year Member



Many thanks Span, quite a bit to read there, so will go through it later today. I heard that if you state the language in the .htaccess then whenever someone tried to save your site to their pc, they wouldn't be able to read it?

Span

1:19 pm on Apr 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, there's a lot to read there and no definitive answer.

And about setting the language in the HTTP header and offline reading, well, I think at least 99.99% of all pages on the web have no language specified anywhere. I have never saved a page to disc that I couldn't read because of the absence of a language attribute or meta.