Possible to make ALT tag dynamic??

Discussion in 'HTML' started by Jib, Sep 16, 2006.

  1. Jib

    Jib Guest

    My site caters to different languages and the site has directories
    segregated by country, however some of my images are in shared folders. I
    can't (or shouldn't) use 'one language fit all' approach for my alt tags and
    the site structure is a bit complex to re-configuring it. I really want to
    use alt text, so is there any solution that anyone knows about that I can
    use? Maybe javascript mouse over which shows the appropriate text depending
    on which country the user is browsing?? I'm grasping here...
     
    Jib, Sep 16, 2006
    #1
    1. Advertising

  2. Jib wrote:
    > My site caters to different languages and the site has directories
    > segregated by country, however some of my images are in shared folders. I
    > can't (or shouldn't) use 'one language fit all' approach for my alt tags and
    > the site structure is a bit complex to re-configuring it. I really want to
    > use alt text, so is there any solution that anyone knows about that I can
    > use? Maybe javascript mouse over which shows the appropriate text depending
    > on which country the user is browsing?? I'm grasping here...


    Steve replied;
    not familiar enough with Javascript to comment, but I'm certain you
    could do it with JS. (although you would exclude users who didn't have
    JS turned enabled).

    How you do this depends on how your site is set up. If your site has
    separate content in different languages then you can simply put your
    alt = within the content using a different tag for each language.

    Alternatively, you could use a server side language such as PHP or ASP
    to generate the tag depending on the language defined in
    HTTP_ACCEPT_LANGUAGE.

    Come back if this isn't clear!

    Steve
    www.fontmadness.com
    "How much can one body take? The concrete shoes, the hungry lake"
     
    SteveSomebody, Sep 16, 2006
    #2
    1. Advertising

  3. Jib

    Andy Dingley Guest

    Jib wrote:

    > My site caters to different languages and the site has directories
    > segregated by country, however some of my images are in shared folders.


    Alt text is stored in the HTML, not the image itself. Just use
    multiple language versions, same as the page text.
     
    Andy Dingley, Sep 16, 2006
    #3
  4. Jib wrote:

    > My site caters to different languages


    That would be easier to believe if you had posted a URL.

    > and the site has directories
    > segregated by country,


    I thought you mentioned languages. Please do not try to get any further in
    multilingualism before you understand the difference between language and
    country.

    > however some of my images are in shared folders.


    That's really irrelevant to anything but your web site management, and it
    has nothing particular to do with multilingualism or alt texts.

    > I can't (or shouldn't) use 'one language fit all' approach
    > for my alt tags


    Just as you shouldn't use 'one language fit all' approach for your textual
    content. The alt text (called "alt tag" by people who don't know the basic
    concepts of markup) _is_ logically part of textual content, though you need
    to write it as an attribute value, due to an old mistake in the design of
    HTML.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Sep 16, 2006
    #4
  5. Jib

    Jib Guest

    "Jukka K. Korpela" <> wrote in message
    news:0aROg.13106$...
    > Jib wrote:
    >
    >> My site caters to different languages

    >
    > That would be easier to believe if you had posted a URL.


    Your right! I actually made the whole story up! See kids what can happen
    when you're bored...


    >> and the site has directories
    >> segregated by country,

    >
    > I thought you mentioned languages. Please do not try to get any further in
    > multilingualism before you understand the difference between language and
    > country.


    Boy testy, aren't we? You are bordering on arrogance "Yucca".


    >> however some of my images are in shared folders.

    >
    > That's really irrelevant to anything but your web site management, and it
    > has nothing particular to do with multilingualism or alt texts.


    You are trying to read way too far into this. You just don't get it.


    >> I can't (or shouldn't) use 'one language fit all' approach
    >> for my alt tags

    >
    > Just as you shouldn't use 'one language fit all' approach for your textual
    > content. The alt text (called "alt tag" by people who don't know the basic
    > concepts of markup) ...


    Got me again! :)
    I knew I should have posted a seperate thread to your attention inquiring
    about the proper usage of HTML terminology before trying to bluff my way
    through this one.
    I hope I didn't confuse anyone else and didn't lose anyone in my obvious and
    inexcusable blunder. I am so sorry folks. :(

    >_is_ logically part of textual content, though you need to write it as an
    >attribute value, due to an old mistake in the design of HTML.


    You totally lost me by this time pal, I stopped reading your post after your
    second insult. Go "help" someone that really needs it.

    >
    > --
    > Jukka K. Korpela ("Yucca")
    > http://www.cs.tut.fi/~jkorpela/
     
    Jib, Sep 16, 2006
    #5
  6. Jib

    Jib Guest


    > Alternatively, you could use a server side language such as PHP or ASP
    > to generate the tag depending on the language defined in
    > HTTP_ACCEPT_LANGUAGE.
    >
    > Come back if this isn't clear!


    Thanks, I 'll give the ASP option a try.


    > Steve
    > www.fontmadness.com
    > "How much can one body take? The concrete shoes, the hungry lake"
    >
     
    Jib, Sep 16, 2006
    #6
  7. Jib wrote:
    > My site caters to different languages and the site has directories
    > segregated by country, however some of my images are in shared folders. I
    > can't (or shouldn't) use 'one language fit all' approach for my alt tags and
    > the site structure is a bit complex to re-configuring it. I really want to
    > use alt text, so is there any solution that anyone knows about that I can
    > use? Maybe javascript mouse over which shows the appropriate text depending
    > on which country the user is browsing?? I'm grasping here...
    >
    >

    If you are hoping for the little 'tooltip' mouse over images, then you
    are using the wrong attribute it should be the 'title' not the 'alt'.
    The 'alt' is for when that image is not displayed (for text browser or
    when images are disable or missing on the server) Only old MSIE and the
    ancient Netscape 4.x incorrectly use the 'alt'.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Sep 16, 2006
    #7
  8. Jib wrote:
    > My site caters to different languages and the site has directories
    > segregated by country, however some of my images are in shared folders. I
    > can't (or shouldn't) use 'one language fit all' approach for my alt tags and
    > the site structure is a bit complex to re-configuring it. I really want to
    > use alt text


    That's good, since alt tags don't exist (unless you define them in your
    own DTD)!

    , so is there any solution that anyone knows about that I can
    > use? Maybe javascript mouse over which shows the appropriate text depending
    > on which country the user is browsing?? I'm grasping here...


    I don't understand--if you have a different page for each language, then
    what's preventing you from also having a different value for a given
    image's ALT attribute on each of them?
     
    Harlan Messinger, Sep 16, 2006
    #8
  9. Jib

    Dan Guest

    Jib wrote:
    > Boy testy, aren't we? You are bordering on arrogance "Yucca".


    Maybe he is... some of the "techie"-types on newsgroups like this tend
    to a bit of snappiness in their style, but their advice is generally
    sound nevertheless. You do need to remember that this is a discussion
    group, not a free helpdesk.

    Anyway, what he said is right. ALT attributes (not "tags") are part of
    the HTML code along with the text content of the page, and are not part
    of the image itself, and hence the fact that you store images in a
    common subdirectory for use in multiple language versions of your site
    is irrelevant to the possible use of different-language ALT text in the
    HTML of the different versions.

    More on languages on the Web:
    http://webtips.dan.info/language.html

    More on images and ALT attributes:
    http://webtips.dan.info/images.html

    --
    Dan
     
    Dan, Sep 16, 2006
    #9
  10. In article <byLOg.46$ht6.39@trndny06>, "Jib" <> wrote:

    > My site caters to different languages and the site has directories
    > segregated by country, however some of my images are in shared folders. I
    > can't (or shouldn't) use 'one language fit all' approach for my alt tags and
    > the site structure is a bit complex to re-configuring it. I really want to
    > use alt text, so is there any solution that anyone knows about that I can
    > use? Maybe javascript mouse over which shows the appropriate text depending
    > on which country the user is browsing?? I'm grasping here...


    Hi Jib,
    You're already using some technique to serve content in different
    languages. Why can't you apply the same technique to the <img> tags? So,
    if you're using PHP or ASP to write your site's content from a database,
    use the same to write the <img> tags with the value of the alt attribute
    coming from the database, too. Or if you have static HTML files divided
    into language-specific directories (/en/contact.html, /uk/contact.html,
    /pl/contact.html, etc.) then use different alt tags in each.

    Regardless of whether you're using one of my examples above or something
    else, I don't see why the alt text is much different from the rest of
    the HTML. But maybe I'm missing something.

    BTW I'd steer clear of the Javascript solution. You'll penalize visitors
    without JS turned on as well as search engines and other spiders.

    HTH

    --
    Philip
    http://NikitaTheSpider.com/
    Whole-site HTML validation, link checking and more
     
    Nikita the Spider, Sep 16, 2006
    #10
  11. Jib

    dorayme Guest

    In article
    <
    t.rr.com>,
    Nikita the Spider <> wrote:

    > Regardless of whether you're using one of my examples above or something
    > else, I don't see why the alt text is much different from the rest of
    > the HTML. But maybe I'm missing something.


    Perhaps this is wrong, but I got the impression the OP may have
    been using the (English?) names of the img files (or part of
    them) as a quick way of decking out his alt text.

    This might explain why he was bringing in the business of these
    files.

    I once did something like this (I am not saying these days it is
    a good thing to do):

    Using GREP Search and Replace, I decked out a website in one go
    with alt attributes by telling the text editor to stick in
    alt="\1" where \1 captured the file name. And sometimes fancier
    still by specifying only the bit of the file name before the
    ".jpg" or ".gif". And sometimes fancier still by adding words
    that I thought seemed natural like "This is a picture of ..." Or
    "This is a picture called ...". All this depended on the files
    being descriptively named like "redApple". One could get quite
    complicated if the naming was along certain principled lines,
    even separating the "red" and "Apple" bits, and lower-casing the
    "A" etc.

    --
    dorayme
     
    dorayme, Sep 16, 2006
    #11
    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. Do
    Replies:
    1
    Views:
    3,036
    Ken Cox [Microsoft MVP]
    Nov 23, 2003
  2. shruds
    Replies:
    1
    Views:
    957
    John C. Bollinger
    Jan 27, 2006
  3. =?iso-8859-1?Q?Marcel_St=F6r?=

    alt attribute for input tag

    =?iso-8859-1?Q?Marcel_St=F6r?=, Nov 28, 2003, in forum: HTML
    Replies:
    10
    Views:
    11,053
    Sid Ismail
    Nov 28, 2003
  4. Paul Furman

    alt tag for an anchor link?

    Paul Furman, Feb 12, 2004, in forum: HTML
    Replies:
    13
    Views:
    44,012
    JohnNotion
    Apr 13, 2012
  5. Eric Peterson

    make dynamic sized iframe work? or alt ideas?

    Eric Peterson, Jan 24, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    110
    Eric Peterson
    Jan 24, 2006
Loading...

Share This Page