Possible to make ALT tag dynamic??

J

Jib

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...
 
S

SteveSomebody

Jib said:
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"
 
A

Andy Dingley

Jib said:
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.
 
J

Jukka K. Korpela

Jib said:
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.
 
J

Jib

Jukka K. Korpela said:
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...

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".

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.

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.
 
J

Jib

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.
 
J

Jonathan N. Little

Jib said:
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'.
 
H

Harlan Messinger

Jib said:
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?
 
D

Dan

Jib said:
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
 
N

Nikita the Spider

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
 
D

dorayme

<[email protected]
t.rr.com>,
Nikita the Spider said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top