 |
 |
 |
 |
#57915 - 12/22/04 08:33 AM
UBB Translations by Google
|
Coder
Registered: 06/10/01
Posts: 705
Loc: CT
|
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>
_________________________
...Steven Hostboard.com Running UBB v6.1.0.4 Doing what NO other UBB in the world is doing. The first & only production UBB powered by MySQL.
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#57916 - 12/22/04 12:48 PM
Re: UBB Translations by Google
|
Master Hacker
Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
|
<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
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#57917 - 12/29/04 02:14 PM
Re: UBB Translations by Google
|
Coder
Registered: 06/10/01
Posts: 705
Loc: CT
|
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.
_________________________
...Steven Hostboard.com Running UBB v6.1.0.4 Doing what NO other UBB in the world is doing. The first & only production UBB powered by MySQL.
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#57918 - 12/29/04 04:08 PM
Re: UBB Translations by Google
|
Master Hacker
Registered: 01/25/03
Posts: 3765
Loc: Saint Johns, PA
|
<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
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|