View Full Version : change image or flash based on Language
queerfm
01-28-2007, 05:54 PM
Hi i am using Google.com Language Translation to let people that don't read English to read my site in there Language. Is there a way i can make it when they view my page in chines they get the chines image instead of the English text.
Thanks
Not when using automatic translation, no. You have to translate the images manually, and you'd then have to set up manually-translated versions of the pages, too.
mburt
01-28-2007, 06:18 PM
I can see this being easily done with PHP:
Write this to your URL once you convert to chinese:
yourPage.php?lang=chinese
Use this php script on every page you need to replacing the <img> tag:
<?php
$lang = $_GET["lang"];
if ($lang == "chinese") {
echo "<img src=\"chinese replacement\">";
}
else {
echo "<img src=\"original image\">";
}
?>
queerfm
01-30-2007, 02:11 PM
any way to do this in html
No. You can use Apache's content negotiation (http://httpd.apache.org/docs/2.2/content-negotiation.html) to serve up appropriate versions, but again you'd have to manually translate all your pages.
djr33
01-31-2007, 01:50 AM
I have a theory. Might not work. And somewhat complex.
Impliment javascript on the page to get the current URI. When google translates a page, it has, as a get variable (like page.php?lang=EN, etc) the language code. You could dynamically change the source of the image based on this, to, for example, EN.jpg
However, I see problems that could happen from it as well.
Yeah, starting with:
Impliment javascript on the page to get the current URI.
queerfm
01-31-2007, 09:16 PM
kool i will have to think about all this it may be easyer to translate each page one by one and do it myself. like let google translate the page but if some one is from china they see the chinese images. they would have to click on there flag or something.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.