#57915
12/22/2004 9:33 AM
|
Joined: Jun 2001
Posts: 729
Coder
|
Coder
Joined: Jun 2001
Posts: 729 |
I have been trying to get this working but only seem to be able to get the root of the domain and not UBB itself. Any ideas on how to incorporate this? I have flags so would like to release this as a modification. <table border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td><div align="center"><a href="http://www.YourDomain.com/"><img src="/images/languages/english.gif" ALT="English" border="0"></a></div></td> <td><div align="center"><a href="http://translate.google.com/translate?u=http://www.YourDomain.com/&langpair=en&hl=fr"><img src="/images/languages/french.gif" ALT="French" border="0"></a></div></td> <td><div align="center"><a href="http://translate.google.com/translate?u=http://www.YourDomain.com/&langpair=en&hl=es"><img src="/images/languages/spanish.gif" ALT="Spanish" border="0"></a></div></td> </tr> <tr> <td><div align="center"><a href="http://translate.google.com/translate?u=http://www.YourDomain.com/&langpair=en&hl=de"><img src="/images/languages/german.gif" ALT="German" border="0"></a></div></td> <td><div align="center"><a href="http://translate.google.com/translate?u=http://www.YourDomain.com/&langpair=en&hl=it"><img src="/images/languages/italian.gif" ALT="Italian" border="0"></a></div></td> <td><div align="center"><a href="http://translate.google.com/translate?u=http://www.YourDomain.com/&langpair=en|pt"><img src="/images/languages/portuguese.gif" ALT="Portuguese" border="0"></a></div></td> </tr> </table>
|
|
|
#57916
12/22/2004 1:48 PM
|
Joined: Jan 2003
Posts: 3,456 Likes: 2
Master Hacker
|
Master Hacker
Joined: Jan 2003
Posts: 3,456 Likes: 2 |
<script type="text/javascript"> <!-- //<![CDATA[
// Google Translation Addon for UBB.classic, and technically, any other site.
var language_base = "en"; var images_base = "/images/languages/"; var languages = new Array("english", "french", "spanish", "german", "italian", "portuguese"); var images_alt = new Array("English", "French", "Spanish", "German", "Italian", "Portuguese"); var languages_code = new Array("en", "fr", "es", "de", "it", "pt"); var image_extension = ".gif";
var here = document.location.href ? document.location.href : document.location; var url = here.split("#"); here = url[0];
function makeLink(lang) { // First, make the anchor var a = document.createElement("A"); a.href = "http://translate.google.com/translate?u="; a.href += here; a.href += "&langpaig=" + language_base; a.href += "&hl=" + languages_code[lang]; // No need to translate english to english if(languages_code[lang] == language_base) { a.href = here; } // Now, make the image. var img = document.createElement("IMG"); img.src = images_base + languages[lang] + image_extension; img.alt = images_alt[lang]; a.appendChild(img); document.getElementById("google-" + languages[lang]).appendChild(a); }
//]]> //--> </script>
<table id="google-translate"> <tr> <td><span id="google-english"></span></td> <td><span id="google-french"></span></td> <td><span id="google-spanish"></span></td> </tr> <tr> <td><span id="google-german"></span></td> <td><span id="google-italian"></span></td> <td><span id="google-portuguese"></span></td> </tr> </table> <script type="text/javascript"> <!-- //<![CDATA[
for(x=0;x<languages.length;x++) { makeLink(x); }
//]]> //--> </script> Will do it without any modifications to the actual code. Requires the user to have javascript enable though
|
|
|
#57917
12/29/2004 3:14 PM
|
Joined: Jun 2001
Posts: 729
Coder
|
Coder
Joined: Jun 2001
Posts: 729 |
Neat... How would I get this say to appear just above the login/profile, search, forum home, etc box? I would want text "Translations by Google" and the flags just under that.
I am pretty sure it is in public_common.pl Just no idea how to make it appear.
|
|
|
#57918
12/29/2004 5:08 PM
|
Joined: Jan 2003
Posts: 3,456 Likes: 2
Master Hacker
|
Master Hacker
Joined: Jan 2003
Posts: 3,456 Likes: 2 |
<script type="text/javascript"> <!-- //<![CDATA[
// Google Translation Addon for UBB.classic, and technically, any other site.
var language_base = "en"; var images_base = "/hostboard/images/languages/"; var languages = new Array("english", "french", "spanish", "german", "italian", "portuguese"); var images_alt = new Array("English", "French", "Spanish", "German", "Italian", "Portuguese"); var languages_code = new Array("en", "fr", "es", "de", "it", "pt"); var image_extension = ".gif";
var here = document.location.href ? document.location.href : document.location; var dyn_fix = here.substr(0, here.length - 4); if((dyn_fix + ".php" == here) || (dyn_fix + ".cgi" == here)) { here += "/"; } var url = here.split("#"); here = url[0]; here = here.replace(/\?\//, "/");
function makeLink(lang) { // First, make the anchor var a = document.createElement("A"); a.href = "http://translate.google.com/translate?u="; a.href += here; a.href += "&langpaig=" + language_base; a.href += "&hl=" + languages_code[lang]; // No need to translate english to english if(languages_code[lang] == language_base) { a.href = here; } // Now, make the image. var img = document.createElement("IMG"); img.src = images_base + languages[lang] + image_extension; img.alt = images_alt[lang]; a.appendChild(img); document.getElementById("google-" + languages[lang]).appendChild(a); }
//]]> //--> </script>
<table id="google-translate"> <tr> <td><span id="google-english"></span></td> <td><span id="google-french"></span></td> <td><span id="google-spanish"></span></td> </tr> <tr> <td><span id="google-german"></span></td> <td><span id="google-italian"></span></td> <td><span id="google-portuguese"></span></td> </tr> </table> <script type="text/javascript"> <!-- //<![CDATA[
for(x=0;x<languages.length;x++) { makeLink(x); }
//]]> //--> </script> Updated code to prevent google from not parsing dynamic pages
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 21,079
Joined: March 2000
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|