SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    US
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to mark up paragraphs that are in a different language?

    I have an English language website, but one page in particular will have 2 or 3 paragraphs of Welsh text in addition to the English text on the same page.

    What would be the correct way to mark these Welsh paragraphs up? Is it sufficient to just stick the text in <p> tags, or should the language change be flagged up explicitly in some other way?

    The only reference to language I have in the code at the moment is in the header...

    Code:
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB">
    Is there anything I should add to this, or is there something I should put inline in the <p> tags (e.g. lang="CY" or something similar?)

    Thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    US
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should probably just add that the doctype I'm using is XHTML 1.0 Transitional.

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

  3. #3
    Guru Meditation Error gnarly's Avatar
    Join Date
    Dec 2003
    Location
    Cheltenham, United Kingdom
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aye, use the lang attribute on whatever HTML elements are in another language, e.g.

    HTML Code:
    <p lang="fr"></p>
    <span lang="en-cockney"></span>
    <h4 lang="x-klingon"></h4>
    Olly Hodgson
    thinkdrastic.net

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    US
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great, thanks a lot.

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 5tevooo
    Should probably just add that the doctype I'm using is XHTML 1.0 Transitional.
    In that case, you should use both lang and xml:lang to specify the language (unless you're actually serving the document as XHTML, in which case you only need to use xml:lang).
    HTML Code:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •