One of the greatest things about the internet is the international audience. One the weakest links is the adoption of language translation. So I set out to fix this for one of my websites.
I was able to modify the translate website frame on Google to place this into a website. I was able to remove the text field by manually entering the url inside the code. The result is nothing more then a drop down list with a submit button. Very clean and easy to use. It is an on-page "complete" Google Translate tool! Upon clicking submit it works.
However, I don't want to have to change this on every page if I can avoid it. Is there a javascript that can enter the current page url into the value of a form tag? from what I can tell it must go into the exact feild that has <input type="hidden" name="u" value="INSERT URL HERE" />
Thanks for your help if you can!!!!!
Disclaimer: I do not know any java, so assume I know nothing about where to place the parts. can you provide a complete code solution? I am trying to be xhtml valid, thanks!![]()
Here is the code: please fell free to do with it what you want
<!--begin translation, insert into body where you want it to show -->
<table width="100%" cellpadding="3" cellspacing="0" border="0" align="left">
<tr bgcolor="#ffffff">
<td>
<form name="translateForm" target="_translate" action="http://www.google.com/translate?u=" method="get">
<table>
<tr bgcolor="#ffffff">
<td><form name="translateForm" form action="http://www.google.com/translate?" >
<input type="hidden" name="u" value="INSERT URL HERE" />
<select name="langpair">
<option value="en|de" selected="selected">English to German</option>
<option value="en|es">English to Spanish</option>
<option value="en|fr">English to French</option>
<option value="en|it">English to Italian</option>
<option value="en|pt">English to Portuguese</option>
<option value="en|ar">English to Arabic</option>
<option value="en|ja">English to Japanese</option>
<option value="en|ko">English to Korean</option>
<option value="en|zh-CN">English to Chinese (Simple)</option>
<option value="de|en">German to English</option>
<option value="de|fr">German to French</option>
<option value="es|en">Spanish to English</option>
<option value="fr|en">French to English</option>
<option value="fr|de">French to German</option>
<option value="it|en">Italian to English</option>
<option value="pt|en">Portuguese to English</option>
<option value="ar|en">Arabic to English/option>
<option value="ja|en">Japanese to English</option>
<option value="ko|en">Korean to English</option>
<option value="zh-CN|en">Chinese (Simple) to English</option>
</select>
<input type="hidden" name="hl" value="en" />
<input type="hidden" name="ie" value="UTF8" />
<br />
<input type="submit" value="Translate" />
</form>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<!-- end translation-->



Reply With Quote

Bookmarks