lang= tag - what's it for?

Discussion in 'HTML' started by Ben Bullock, Jul 21, 2005.

  1. Ben Bullock

    Ben Bullock Guest

    On an anchor, I can write

    <a lang=jp href="http://http://aor.ktplan.jp/">Site name</a>

    but I'm wondering how much I can do with the "lang=jp" tag. I can make the
    link colours come out as different, but unless the user knows what meaning
    I've attached to the colours that won't help.

    In this case, "jp" means "Japanese", so is there a way to use the "lang=jp"
    tag to, for example, make an image of a Japanese flag or text explaining
    that the link is in Japanese come up?

    Or, if not, what is the "lang=jp" tag for?
    Ben Bullock, Jul 21, 2005
    #1
    1. Advertising

  2. Ben Bullock

    Adrienne Guest

    Gazing into my crystal ball I observed "Ben Bullock" <>
    writing in news:dbn5at$2kh$-u.ac.jp:

    > On an anchor, I can write
    >
    ><a lang=jp href="http://http://aor.ktplan.jp/">Site name</a>
    >
    > but I'm wondering how much I can do with the "lang=jp" tag. I can make
    > the link colours come out as different, but unless the user knows what
    > meaning I've attached to the colours that won't help.
    >
    > In this case, "jp" means "Japanese", so is there a way to use the
    > "lang=jp" tag to, for example, make an image of a Japanese flag or text
    > explaining that the link is in Japanese come up?
    >
    > Or, if not, what is the "lang=jp" tag for?


    http://www.w3.org/TR/html4/struct/dirlang.html#adef-lang

    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
    Adrienne, Jul 21, 2005
    #2
    1. Advertising

  3. Ben Bullock

    Ben Bullock Guest

    "Adrienne" <> wrote in message
    news:Xns9699DA6297088arbpenyahoocom@207.115.63.158...
    > Gazing into my crystal ball I observed "Ben Bullock" <>
    > writing in news:dbn5at$2kh$-u.ac.jp:
    >
    >> On an anchor, I can write
    >>
    >><a lang=jp href="http://http://aor.ktplan.jp/">Site name</a>
    >>
    >> but I'm wondering how much I can do with the "lang=jp" tag. I can make
    >> the link colours come out as different, but unless the user knows what
    >> meaning I've attached to the colours that won't help.
    >>
    >> In this case, "jp" means "Japanese", so is there a way to use the
    >> "lang=jp" tag to, for example, make an image of a Japanese flag or text
    >> explaining that the link is in Japanese come up?
    >>
    >> Or, if not, what is the "lang=jp" tag for?

    >
    > http://www.w3.org/TR/html4/struct/dirlang.html#adef-lang


    Thanks for the link Adrienne. I had a look at it, and I can see why "lang="
    would be useful in a quoted piece of text, as in the example given. My
    question is specifically what the use of "lang=" is in an anchor statement.
    Does the "lang=jp" in <a lang=jp href=...> </a> refer to the text between >
    and < only? Was I mistaken in thinking it was meant to indicate that the
    link goes to a site which is in a foreign language?

    Thanks for any more advice.
    Ben Bullock, Jul 21, 2005
    #3
  4. Ben Bullock wrote:

    > Does the "lang=jp" in <a lang=jp href=...> </a> refer to the
    > text between > and < only? Was I mistaken in thinking it was meant to
    > indicate that the link goes to a site which is in a foreign language?


    http://www.w3.org/TR/html4/struct/links.html#adef-hreflang

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Jul 21, 2005
    #4
  5. Ben Bullock

    Philip Ronan Guest

    "Ben Bullock" wrote:

    > [Re. "lang" attribute in A tags]
    > Was I mistaken in thinking it was meant to indicate that the
    > link goes to a site which is in a foreign language?


    Yes you were. That's what the "hreflang" attribute is for. In an <A>
    element, "lang" indicates the language of the anchor text (i.e., the text
    between "<A>" and "</A>"). So for example:

    <UL>
    <LI><A href="index.fr.html" hreflang="fr" lang="fr">Lisez cet article en
    fran├žais.</A>
    <LI><A href="index.de.html" hreflang="de" lang="de">Lesen Sie diesen
    Artikel auf Deutsch.</A>
    </UL>

    This information is particularly useful to speech synthesizers, but you
    could use CSS to represent it visually in (some) graphical browsers if you
    like. For example:

    A[hreflang=fr] { font-family: "Lucida Blackletter", cursive; }
    A[hreflang=de] { font-family: "Lucida Calligraphy", cursive; }

    Try to avoid flag icons -- they're generally a bad idea.

    --
    phil [dot] ronan @ virgin [dot] net
    http://vzone.virgin.net/phil.ronan/
    Philip Ronan, Jul 21, 2005
    #5
  6. Ben Bullock

    Ben Bullock Guest

    "Philip Ronan" <> wrote in message
    news:BF051B3E.34E99%...
    > "Ben Bullock" wrote:
    >
    >> [Re. "lang" attribute in A tags]
    >> Was I mistaken in thinking it was meant to indicate that the
    >> link goes to a site which is in a foreign language?

    >
    > Yes you were. That's what the "hreflang" attribute is for. In an <A>
    > element, "lang" indicates the language of the anchor text (i.e., the text
    > between "<A>" and "</A>"). So for example:


    Thanks for sorting that out, and thanks to David Dorward for the link too.

    > <UL>
    > <LI><A href="index.fr.html" hreflang="fr" lang="fr">Lisez cet article en
    > fran├žais.</A>
    > <LI><A href="index.de.html" hreflang="de" lang="de">Lesen Sie diesen
    > Artikel auf Deutsch.</A>
    > </UL>
    >
    > This information is particularly useful to speech synthesizers, but you
    > could use CSS to represent it visually in (some) graphical browsers if you
    > like. For example:
    >
    > A[hreflang=fr] { font-family: "Lucida Blackletter", cursive; }
    > A[hreflang=de] { font-family: "Lucida Calligraphy", cursive; }
    >
    > Try to avoid flag icons -- they're generally a bad idea.


    Flag icons may be a bad idea, but using different fonts or colours to
    indicate that the link is in one language or another is non-intuitive and
    will not make things easier to understand. After all, there is no font or
    colour associated with "English" or "Japanese".

    Anyway, does "hreflang" give me any way to add some fixed text or an icon to
    the link? David's link says it is for "user agents", i.e. web browsers.
    Assuming it doesn't, I'll try to find some way to sort out indicating the
    end language at the preprocessor level.

    Thanks again for the help.

    Ben.
    Ben Bullock, Jul 21, 2005
    #6
  7. Ben Bullock

    Ben Bullock Guest

    "David Dorward" <> wrote in message
    news:dbnhc6$q8q$1$...
    > Ben Bullock wrote:
    >
    >> Does the "lang=jp" in <a lang=jp href=...> </a> refer to the
    >> text between > and < only? Was I mistaken in thinking it was meant to
    >> indicate that the link goes to a site which is in a foreign language?

    >
    > http://www.w3.org/TR/html4/struct/links.html#adef-hreflang


    Thanks for the link. That is useful.

    Ben.
    Ben Bullock, Jul 21, 2005
    #7
  8. Ben Bullock

    Philip Ronan Guest

    "Ben Bullock" wrote:

    > Flag icons may be a bad idea, but using different fonts or colours to
    > indicate that the link is in one language or another is non-intuitive and
    > will not make things easier to understand.


    I'm not going to disagree with that. :)

    > Anyway, does "hreflang" give me any way to add some fixed text or an icon to
    > the link?


    Yes of course. That's why I gave you an example of CSS in my last post. Take
    a look at this: http://www.w3.org/TR/REC-CSS2/selector.html#before-and-after

    --
    phil [dot] ronan @ virgin [dot] net
    http://vzone.virgin.net/phil.ronan/
    Philip Ronan, Jul 21, 2005
    #8
  9. Ben Bullock

    Ben Bullock Guest

    "Philip Ronan" <> wrote in message
    news:BF053585.34EB3%...
    > "Ben Bullock" wrote:
    >
    >> Flag icons may be a bad idea, but using different fonts or colours to
    >> indicate that the link is in one language or another is non-intuitive and
    >> will not make things easier to understand.

    >
    > I'm not going to disagree with that. :)
    >
    >> Anyway, does "hreflang" give me any way to add some fixed text or an icon
    >> to
    >> the link?

    >
    > Yes of course. That's why I gave you an example of CSS in my last post.
    > Take
    > a look at this:
    > http://www.w3.org/TR/REC-CSS2/selector.html#before-and-after


    Thanks, that is really great and so useful. I'm going to bury my head in the
    www.w3.org pages and my CSS and HTML books and hope I don't get "linked"
    again so easily.

    Thanks again,

    Ben.
    Ben Bullock, Jul 21, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Harald Kirsch
    Replies:
    4
    Views:
    2,833
    Harald Kirsch
    Aug 31, 2004
  2. Maneesh
    Replies:
    2
    Views:
    10,640
  3. shruds
    Replies:
    1
    Views:
    788
    John C. Bollinger
    Jan 27, 2006
  4. JPractitioner
    Replies:
    13
    Views:
    20,152
    Roedy Green
    Feb 24, 2006
  5. Replies:
    1
    Views:
    2,139
    Irmen de Jong
    Jun 22, 2004
Loading...

Share This Page