homepage Welcome to WebmasterWorld Guest from 50.19.172.0
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

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

10+ Year Member



 
Msg#: 3735680 posted 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

WebmasterWorld Administrator bill us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3735680 posted 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

    10+ Year Member



     
    Msg#: 3735680 posted 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

    WebmasterWorld Administrator bill us a WebmasterWorld Top Contributor of All Time 10+ Year Member



     
    Msg#: 3735680 posted 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

    10+ Year Member



     
    Msg#: 3735680 posted 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

    WebmasterWorld Administrator bill us a WebmasterWorld Top Contributor of All Time 10+ Year Member



     
    Msg#: 3735680 posted 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.
    Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
    WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
    © Webmaster World 1996-2014 all rights reserved