homepage Welcome to WebmasterWorld Guest from 54.227.141.230
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

    
DocType alteration for different site langugages
Is it necessary?
neophyte




msg:3735682
 1:22 am on Sep 1, 2008 (gmt 0)

Hello All

Im beginning to step into projects that require the display of various languages.

So far, to accommodate this, Ive 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 Im 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

 

bill




msg:3735736
 4:00 am on Sep 1, 2008 (gmt 0)

You've got the right idea. Here are a few older threads that dealt with this topic:
  • indicating LANG to Search Engines [webmasterworld.com]
  • character encoding labeling [webmasterworld.com]
  • neophyte




    msg:3735872
     9:44 am on Sep 1, 2008 (gmt 0)

    Thanks Bill - Appreciate the links! Very informative.

    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

    bill




    msg:3737112
     7:19 am on Sep 3, 2008 (gmt 0)

    I've heard it said that the ideal way of setting the charset is to send it as an HTTP header before the page is served. However, I've always relied on setting the language in the <html> tag and setting the charset via the <meta>. That covers all modern browsers I've tested.

    neophyte




    msg:3737166
     9:19 am on Sep 3, 2008 (gmt 0)

    Bill -

    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

    bill




    msg:3737169
     9:28 am on Sep 3, 2008 (gmt 0)

    Sounds like you may be serving Japanese that's not UTF-8 encoded. Your database has to have the content encoded correctly. Simply changing the language in the HTML won't be enough. As you said, you may need another thread for that topic though. ;)

    Global Options:
     top home search open messages active posts  
     

    Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
    rss feed

    All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
    Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
    © Webmaster World 1996-2014 all rights reserved