Forum Moderators: phranque
I’m beginning to step into projects that require the display of various languages.
So far, to accommodate this, I’ve got the http-equiv meta tag set to:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
But what about the language attributes of the DOCTYPE? Previously – before the possibility of multi-language projects, it was set as follows:
<!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">
Now that I’m going to have to be dealing with Japanese and German text, should these be dynamically altered depending upon the langugage chosen?
I.e.: xml:lang="ja" lang="ja" if the site language is Japanese, or xml:lang="de" lang="de" if the site language is German?
All insight greatly appreciated!
Neophyte
From those links I'm going with simply the following for Japanese:
<!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="ja" lang="ja">
This for English:
<!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">
...and so on.
Meta/Content-Type will always reflect:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I am BRAND NEW at this multi-language stuff, so if anyone sees that I'm not being comprehensive enough, please DO sound off.
Neophyte
Thanks for the add-on; I've read the same things in different locations (sending the language as a header) as well but haven't investigated it as of yet.
Strange though: when testing the output of Japanese text from a database I'm getting these darn question marks instead of the correct Japanese characters. I've done EVERYTHING as indicated above and check and re-checked when rendering as Japanese but the question marks remain.
Hummm... really got me scratching my head!
Maybe it's a php issue so I've posted the follow on in that forum.
Thank YOU though for following up!
Neophyte