E-mail List Archives

Re: webaim-forum-d Digest V2004 #76

for

From: Kurt M Bendl
Date: Apr 23, 2004 10:53AM


Patrizia:

If you are using something such as PHP, you "could" detect the language, and do conditionals inside your img tag to echo the appropriate content::

Stuff I found and put together...

<?
/*
////////////////////////////
// this will detect the Browser Language
// This can be hidden in the <head> or even called as a separate file
// with: <?php include ("footer.php"); ?>
//
////////////////////////////
*/

function BrowserLanguage(){

global $HTTP_SERVER_VARS;

if(isset($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"])) {

if(strpos($HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"],"-") === false){
$browserlang = $HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"];
}else {
list($browserlang) = explode ("-", $HTTP_SERVER_VARS["HTTP_ACCEPT_LANGUAGE"]);
}
}

return $browserlang;

} // BrowserLanguage

$bl=BrowserLanguage();
?>


This Next part can go before your image, I suppose....

<?php
if (!$bl) $LocalContent="";
elseif ($bl=="it") $LocalContent="Italian words";
elseif ($bl=="en") $LocalContent="English wordage";
elseif ($bl=="de") $LocalContent="German words";
else $LocalContent="";
?>

And finally, you can use it in the image tag like this....

<img src="something.gif" width="20" height="20" alt="<? echo $LocalContent;?>">


OKay, okay... I know there are many better ways to do this. I'm not much of a coder. But the server does all the work, and your CSS and html are still clean on the client side.

I've also just started working with Plone (plone.org). I bet there's a data that can be added to a modified Image content type to supply alternate ALT lang data. hmmm...??? Those Plone guys are smarter than me, maybe ask them.


my $0.02

Kurt



========================================
Kurt Bendl, Web Team Lead / Web Master
Information Technology
Miller IT Center, Room 109
University of Louisville
Louisville, KY 40292

502-852-5619 desk
1-800-334-UofL
kurt.bendl
@louisville.edu


>>> <EMAIL REMOVED> 4/22/2004 4:00:39 AM >>>
Patrizia:
the only way I know for handling multilingual text equivalents for
images is to use the OBJECT element. Adapted from the w3c document on
HTML 4.01:

<OBJECT data="canyon.png" type="image/png" lang="it">
Un inquadramento suggestivo del <span lang="en">Grand Canyon</span>.
</OBJECT>

Regards,
--
Giorgio Brajnik
______________________________________________________________________
Dip. di Matematica e Informatica | voice: +39 (0432) 55.8445
Universit