What Lang to use in a bi-lingual website?

DesigntheWorld

New Member
Question1:

If my website is written using about 50% English and 50% Japanese, what lang attribute do I specify in my html tag?



*I also read somewhere that I would have to specify the lang="jp" for every element that contains Japanese..I hope this is not true..if it is true does that mean that I will have to place the lang attribute inside each element that contains Japanese.

ex:

HTML:
<p lang="jp">猫が好き</p>
<p> English translation: I like cats</p>

Question 2:
In the above example is it acceptable to use the lang attribute inside a paragraph tag? Or is that just plain wrong?lol.


Question 3:
Is it required to specify a lang attribute at all in the html of a website that is written in 100% English? Or can you leave it off since the browser will assume it is all English because of the charset or something like that?


-Thanks for reading!:)
 

DesigntheWorld

New Member
Deciphering the w3c recommendations..

Thanks for pinpointing the link.

I came across this part:

In this example, the primary language of the document is French ("fr"). One paragraph is declared to be in Spanish ("es"), after which the primary language returns to French. The following paragraph includes an embedded Japanese ("ja") phrase, after which the primary language returns to French.
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<HTML lang="fr">
<HEAD>
<TITLE>Un document multilingue</TITLE>
</HEAD>
<BODY>
...Interpreted as French...
<P lang="es">...Interpreted as Spanish...
<P>...Interpreted as French again...
<P>...French text interrupted by<EM lang="ja">some
         Japanese</EM>French begins here again...
</BODY>
</HTML>

*Okay so from what I understood, the lang must be set to whatever language the site is mostly written in. However in my case it's about half English and half Japanese....What common sense tells me though(and I may be wrong) is that if my site is geared at English speakers then I should put en for the primary lang up at the top, like so:
HTML:
<html lang="en">
<title>website title in English</title>
<p>mixed english and japanese text</p>


what becomes tedious is having to put lang=jp everytime there is a japanese sentence...

Which brings me to another question:

If I have just one Japanese word in between an English paragraph like in the example below, is my only choice to wrap the one Japanese word inside an em tag? Also since it is just one word, do I have to specify the lang attribute, or is it wrong to do that?

ex:
HTML:
<p>This paragraph is mostly in English.<br>
 Except for the last word of this sentence <em lang="jp">日本</em>.</p>


Thanks again, and please forgive my never ending stream of questions.:eek:
 

Edge

Member
If I have just one Japanese word in between an English paragraph like in the example below, is my only choice to wrap the one Japanese word inside an em tag? Also since it is just one word, do I have to specify the lang attribute, or is it wrong to do that?[/COLOR]

ex:
HTML:
<p>This paragraph is mostly in English.<br>
 Except for the last word of this sentence <em lang="jp">日本</em>.</p>
Short answer is yes - that would be the right way to do it. If the charset is uTF 8 the characters will get rendered but as W3C says, doing it the right is good for:

Assisting search engines
Assisting speech synthesizers
Helping a user agent select glyph variants for high quality typography
Helping a user agent choose a set of quotation marks
Helping a user agent make decisions about hyphenation, ligatures, and spacing
Assisting spell checkers and grammar checkers
 
Top