vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=134)
-   -   Translate Your Pages Via Google (https://vborg.vbsupport.ru/showthread.php?t=88508)

AN-net 02-21-2004 10:00 PM

Translate Your Pages Via Google
 
Description:
Instantly translate all vb pages that include a footer from English to german,french,italian,and spanish.

Authors:
Sweet22 and Antonbomb22

Credits:
To google for its translation service

Tested only on Vb3 Rc3 and Rc4. There may have been code changes since betas and gamma to the templates that need to be edited by this hack. If you experience difference in code please post it and ill tell you what to do;)

**PLZ NOTE THAT WHEN TRANSLATING IT LOGS YOU OUT AND YOU CAN NOT LOG IN ON A TRANSLATED PAGE!** I hope to fix this issue sometime in the future, if anyone has a fix or suggestion on how to fix it is welcome;).

Vb-Hispano 02-23-2004 05:41 PM

spainish a english? is possible?

AN-net 02-23-2004 10:22 PM

yes it is, since you requested it here it is:
Code:

<option value="es|en">Spanish to English</option>
add that after the english to german option in the footer;)

MGM 02-24-2004 01:45 AM

not bad! will install myself

MGM out

Natch 02-24-2004 10:30 AM

Awesome bit of lateral thinking :) I love it

[high]* Natch clicks install :) :)[/high]

imported_chuanse 02-25-2004 06:39 AM

can someone tell me what ALL possible languages are to translate to (with their code)?

thx 1000 times :D

REAL COOL MOD!!!

gmarik 02-28-2004 08:16 AM

No Russian there, guys?>

AN-net 02-28-2004 04:15 PM

sorry, google doesnt support russian at the moment but you can email them and ask them to consider it.

Dan 02-28-2004 08:07 PM

Nice mod :D but I don't get many foriegners to my boards.

imported_uber 02-28-2004 09:13 PM

Great mod Sweet!

I've integrated your code into a drop down menu on my showthread template.

While doing this, I noticed that there's a little bug you code. Even on your site, when you translate the the site from the showthread or forumdisplay template, the threadid and forumid variables aren't passed.

if you change this

<input type="hidden"name="u" value="http://www.yoursite.com$translationurl">

to

<input type="hidden"name="u" value="http://www.yoursite.com$translationurl?t=$threadid&f=$for uminfo[forumid]">

when you click the translation link from either pages, it will get the proper variables.

Clicks install

AN-net 02-28-2004 09:22 PM

here are other translations not included in the instruct file:
To translate german to english add this code after the last </option> tag in your footer:
Code:

<option value="de|en" selected>German to English</option>
If you want to translate from German to French then add this code after the last </option> tag in your footer:
Code:

<option value="de|fr">German to French</option>
if you want to translate from spanish to english then add this code after your last </option tag in your footer:
Code:

<option value="es|en">Spanish to English</option>
if you want to translate from french to english then add this code after your last </option> tag in your footer:
Code:

<option value="fr|en">French to English</option>
if you want to translate from french to german then add this after your last </option tag in your footer:
Code:

<option value="fr|de">French to German</option>
if you want to translate from italian to english then add this code after your last </option> tag in your footer:
Code:

<option value="it|en">Italian to English</option>
if you want to translate from portuguese to english then add this code after your last </option> tag in your footer:
Code:

<option value="pt|en">Portuguese to English</option></select>

AN-net 02-28-2004 09:24 PM

Quote:

Originally Posted by uber
Great mod Sweet!

I've integrated your code into a drop down menu on my showthread template.

While doing this, I noticed that there's a little bug you code. Even on your site, when you translate the the site from the showthread or forumdisplay template, the threadid and forumid variables aren't passed.

if you change this

<input type="hidden"name="u" value="http://www.yoursite.com$translationurl">

to

<input type="hidden"name="u" value="http://www.yoursite.com$translationurl?t=$threadid&f=$for uminfo[forumid]">

when you click the translation link from either pages, it will get the proper variables.

Clicks install

thanks for fixing that, in a lil bit ill make an addon for showthread so if the file is showthread.php it will add that on;)

AN-net 02-28-2004 09:36 PM

credit:
uber

find in footer:
Code:

<input type="hidden"name="u" value="http://www.animationation.net$translationurl">
replace with(change /community/ to what ever folder your forums are under, if forums are in the public_html folder remove /community/ completely!):
Code:

<input type="hidden"name="u" <if condition="$translationurl=='/community/showthread.php'">value="http://www.animationation.net$translationurl?t=$threadid&f=$foruminfo[forumid]"<else />value="http://www.animationation.net$translationurl"</if>>
ta da it will translate all your threads;)

AN-net 02-28-2004 10:17 PM

Ok since there are several files that require variables i will not support problems with translating beyond index.php for now. when i release version 2 of this hack i will most likely have every .php in the forum root folder with condition until then i will not support problems with translation other than index.php.

Natch 03-04-2004 12:09 AM

Can't you just make a phpinclude hack to make new vars for the scriptname and stringvars globals, and then use those in your translationurl ?

Natch 03-04-2004 10:24 AM

Like this eg:

Change php_include to match this:
Code:

$translationurl=$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];

This will pass all query strings to the translator ...

Mr. Brian 04-01-2004 04:46 PM

Sweet!

lange2 04-03-2004 12:22 PM

Quote:

Originally Posted by sweet22
**PLZ NOTE THAT WHEN TRANSLATING IT LOGS YOU OUT AND YOU CAN NOT LOG IN ON A TRANSLATED PAGE!** I hope to fix this issue sometime in the future, if anyone has a fix or suggestion on how to fix it is welcome;).

How Can I Fix the Problem? Any fix available?

Bryan Ex 09-18-2004 03:10 PM

Thanks very much for your efforts on this as it's very much needed on my board. As far as the log out problem goes, just hitting the "Back" button brings you back to a logged in page so not that big of a deal for me. A bigger problem is that it only works on pages available for guests otherwise they get a nicely translated "No permissions" page...lol Google uses frames for the translation which I suspect is part of the problem but there must be a way to pass either cookie or session info to their main frame window. I'm experimenting with it now but not overly hopeful I'll be able to figure it out. This is a good addition to my site but so close to being an excellent one.

58sniper 10-02-2004 01:16 PM

Quote:

Originally Posted by Natch
Like this eg:

Change php_include to match this:
Code:

$translationurl=$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];

This will pass all query strings to the translator ...

I'll make this even easier....

PHP Code:

$translationurl $_SERVER['REQUEST_URI']; 

Will get you everything. And, change
HTML Code:

<input type="hidden"name="u" value="http://www.yoursite.com$translationurl">
to
HTML Code:

<input type="hidden" name="u" value="$vboptions[homeurl]$translationurl" />
to make this totally plug and play. Here is the template part that I use, which is 100% valid XHTML:

Code:

<div align="center">
Translate this page:<br />
<form action="http://translate.google.com/translate" method="post">
<input type="hidden" name="u" value="$vboptions[bburl]$translationurl" />
<select name="langpair" onchange="this.form.submit();">
<option value="en|de">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>
</select>
<input type="hidden" name="hl" value="en" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="hidden" name="oe" value="UTF-8" />
<input type="hidden" name="safe" value="active" />
<input type="hidden" name="prev" value="/language_tools" />
<input type="submit" value="Translate" />
</form>
</div>
<br/>


Bryan Ex 10-02-2004 08:38 PM

I get a syntax error if I try to use the XHTML portion but the big issue for me is only being about to use translation on pages not requiring a login to view (guest access). I may have to go to a commercial script in this one I guess...

58sniper 10-02-2004 09:25 PM

Do you get the error when the page with the code loads, or when you attempt to submit it?

I just checked my code again, and it worked fine. Let me know, and we'll see if we can't work it out.

Bryan Ex 10-02-2004 09:51 PM

It's when the page loads. The pop up error notice indicates a link to my forum directory and the line specified is the onsubmit function

Bryan Ex 10-02-2004 09:53 PM

LOL... I get an error on this page too actually (nothing to do with translation). Something about "null" is not a valid object. :confused:

tomshawk 10-02-2004 11:47 PM

It doesn't work for me either.

I get no translation at all

http://www.tech-unity.com

I just get errors

Actually with the old code or the new

I tryed the new code first, and right now I have the old code

Still nothing

Any help would be greatly appriciated

58sniper 10-03-2004 01:01 PM

Okay - are the errors on the resulting Google page? If so, go to YOUR site, get the source code for the page, and post the resulting code for this hack and we'll take a look (or gimme a link). It sounds like the action variable for the form might be getting set correctly.

58sniper 10-03-2004 01:06 PM

tomshawk -

I looked at yours, and the code is correct, but I notice that right after the code is another </form>.

When I copied just the code for this hack to a new document, it worked fine. I would say figure out why that extra </form> is in there.

edit: BTW - validator.w3.org reports that as a extra </form> as well, and that there isn't an open form. I'd say comment it out and see if that fixes the problem.

58sniper 10-03-2004 09:40 PM

Okay - seems there was a missing closing quote in the code I posted (which is interesting, because in the code I have in my forums, it's there).

Anyways, I updated the code above.

tomshawk 10-04-2004 10:31 AM

Quote:

Originally Posted by 58sniper
tomshawk -

I looked at yours, and the code is correct, but I notice that right after the code is another </form>.

When I copied just the code for this hack to a new document, it worked fine. I would say figure out why that extra </form> is in there.

edit: BTW - validator.w3.org reports that as a extra </form> as well, and that there isn't an open form. I'd say comment it out and see if that fixes the problem.

I think it was the </form> comment, but I did use your corrected code too, so.

Thank you, it works perfectly now ;)

imported_chuanse 12-09-2004 01:37 PM

Works perfect to me :D

oldfan 01-16-2005 03:36 AM

/me installs
Is it possible to add this as a cmps module?

oldfan 01-19-2005 01:36 PM

[high]
Quote:

Originally Posted by oldfan
* oldfan installs
[/high]
Is it possible to add this as a cmps module?

bump?
:D

oldfan 01-22-2005 05:02 AM

help ?

ThomasR 07-06-2005 03:37 PM

Nothing new on this hack ? Does it runs on vb 3.0.7 ?

sinana 07-08-2005 08:32 PM

which languages?
list pls.

ThomasR 07-23-2005 03:44 PM

I install the hack and it works for me on 3.0.7. I just do the correction added by 58sniper.

agiacosa 02-06-2006 10:33 AM

Anyone use this with 3.5?

ThomasR 10-06-2006 10:38 AM

Can be used in 3.6.1 without any problems. You only have to create a plugin with the php code to insert in the php_global hook, if it can help someone :)
I prefer the google translation a lot more than altavista one :)

Kanustep 10-10-2006 09:27 PM

Can you explain it better ThomasR? I can't find php_global hook on adding the plug-in

ThomasR 10-31-2006 12:06 PM

I add in attachment my plugin for Google. This is very simple, it comes from the babelfish translation hack if I remember.
It works under 3.6.1, I think it will work the same under 3.6.2


All times are GMT. The time now is 09:27 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02179 seconds
  • Memory Usage 1,829KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (13)bbcode_code_printable
  • (2)bbcode_html_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete