Forum Moderators: open

Message Too Old, No Replies

Doctype language // EN

what other languages are available

         

OddDog

11:55 am on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a site in multiple languages adn want to place the coorect language in each section, but am unable to find language codes.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

for spanish it would be

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//ES"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

is there a list out there somewere to get the other language codes?

Rumbas

12:39 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



The language codes pretty much follow the ccTLd's:
[iana.org...]

encyclo

2:58 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your Spanish doctype is incorrect: the language as specified in the doctype is not the document language, just the language of the DTD. As the W3C HTML and XHTML DTDs are all written in English, then the "EN" part always stays the same.

To specify the language of the document, you can use the

lang
attribute on the
html
element, or send it as an HTTP header.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="es">
<head> ...etc.

Robin_reala

3:04 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The language of the site is determined with the lang or xml:lang attribute on the html element, not in the DOCTYPE.

OddDog

3:14 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thats great people.

thank you very much.

I am hoping this new code will help the spiders classify language content correctly.

thanks agina.

My original problem is a turist web site in 7 languages.

A hotel will have 7 different urles depending on the language. But I get the english site served to google.it searchers ...

Dexie

3:30 pm on Feb 25, 2005 (gmt 0)

10+ Year Member



Just learnt something there - I didn't know you could specify the language underneath the doctype - so does that mean that if you have:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>

That you absolutely don't need:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Content-Language" content="en" />

?

Any ideas appreciated.

Sev.

encyclo

3:38 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

You do absolutely have to specify the charset, but you are right in saying that the language meta tag can be replaced by the

lang
attribute on the
html
element. However, the charset meta tag can be replaced by an HTTP header if you are generating dynamic pages, or you can specify the charset header in the server configuration. If neither of those options are available to you, then you must use the meta tag.

Gusgsm

3:49 pm on Feb 25, 2005 (gmt 0)

10+ Year Member



<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">

<head>
<title>The title</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=ISO-8859-1" />
</head>

<body>

This above would server for a Spanish site. The first <xml...> declaration is arguable, I know. And I should have used utf-8 encoding, perhaps... ;)

encyclo

4:17 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A couple more corrections! It's surprising how many errors creep into basic templates nowadays, so it is good to try to get things right from the start

<?xml version="1.0" encoding="ISO-8859-1"?>

You should avoid using an XML declaration as it triggers quirks mode rendering in IE6. It is not required anyway for an XML 1.0 document, and certainly not for an XHTML document served as

text/html
(as 99.9999% are).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

I've argued over this before in other threads, but in short XHTML 1.1 is an inappropriate version of XHTML for general use, and anyway XHTML 1.0 Second Edition was released after 1.1 and includes improvements to the specification not present in 1.1. If you want to use XHTML, use 1.0.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">

You should use the plain

lang
attribute as well for better browser/search-engine compatibility. This is permitted in XHTML 1.0 (but not 1.1).

<meta http-equiv="content-type" content="application/xhtml+xml; charset=ISO-8859-1" />

If you want to send your document with the mine-type

application/xhtml+xml
, specifying it in a meta tag alone isn't sufficient. In almost all case, you don't want
application/xhtml+xml
anyway - for one thing, IE doesn't understand it, nor do any major search engines. You should be specifying
text/html
instead.

To recap, here is a basic template for an XHTML 1.0 Strict document where the document language is in Spanish:

<!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" [b]xml:lang="es" lang="es"[/b]>
<head>
<title>XHTML 1.0 Strict template</title>
<meta http-equiv="Content-Type" content="[b]text/html[/b]; charset=iso-8859-1" />
</head>
<body>
<p>Hola!</p>
</body>
</html>

OddDog

5:06 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just book marked this post.

thanks again people.