Gossamer Forum
Home : Products : Links 2.0 : Customization :

Automatic Language Translation?

(Page 1 of 5)
> >
Quote Reply
Automatic Language Translation?
Hello everyone,

I know I can add a "translate link" to each of my links in the database. However, you have to go to Altavista's page first, then hit the translate button. Then when you click on a link on the Altavista translated site, you have to go back to altavista to translate it again.

Here's what I was thinking, maybe you can tellme if it is possible or if you have a different idea:
I want to automate this translation by maybe using a spider to automatically go back and forth between my site and Altavistas and translate every page undermy domain. It would then save the pages in a database. A user woud choose lets say french, and the Links system would pull the pages from the french database.

What do you think?

------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com


Quote Reply
Re: Automatic Language Translation? In reply to
James,

I hope that you have large disk storage units. I am sure that it is technologically possible. However, it would consume tons of disk space. Also, you would have to add a counter routine or set the translation spider to execute via cron, so that you can get updated information.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Automatic Language Translation? In reply to
Eliot,

I host with Communitech.net

I get 350 megs and unlimited bandwidth. I could just open a new account for each database if would to go over 350, but I doubt it will.

Everytime I update the database, I would hope that it would just overwrite the past files.


------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com


Quote Reply
Re: Automatic Language Translation? In reply to
nobody can give you unlimited bandwidth. even though some claim they would , once you go over the limit you will get an e-mail from them.
how long you been using them?
Quote Reply
Re: Automatic Language Translation? In reply to
For sometime now. Even if that is true, its ok for now. They give me what I need. I have a dedicated server, but I haven't sent the site over tothat. I might need to save it for another project. Smile

------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com


Quote Reply
Re: Automatic Language Translation? In reply to
unlimited bandwidth.. is practically unlimited now.. (unlimited equals alot..)

fiber optic connections make it possible.. they can host alot of bandwidth.. but if they say they can't.. they are BSING about it Smile

ok.. i made translate.cgi.. but it seems altavista is doing alot of editing.. and it gives errors every once in awhile..

http://www.pdamania.com/sql/category.cgi

to test the translate.. (plus the category.cgi is just a sql version of links2 i am making)

jerry
Quote Reply
Re: Automatic Language Translation? In reply to
there is a problem.. but it is with how i make it work with category.cgi

nothing to do with translate.cgi

i'll fix it..

jerry
Quote Reply
Re: Automatic Language Translation? In reply to
ok.. this is really annoying Smile

the error is when you translate a page.. the links to the other languages.. are also translated.. Smile

so it is trying to translate a portuguese site into french.. get it? Smile

well.. i am gonna see what i can do to parse this..

jerry
Quote Reply
Re: Automatic Language Translation? In reply to
This is really cool, are you just doing this with lwp, or standard perl that just hides the url of altavista, but uses their forms?
Quote Reply
Re: Automatic Language Translation? In reply to
this is a explanation of what the script is doing..

1. gets all the forum inputs.. translates french into en_fr (meaning english to french.. in altavista)..

2. then it goes to the url..

http://babelfish.altavista.com/cgi-bin/translate?doit=done&urltext=(url)&language=en_fr

and then it parses out all the urls that altavista put in...

the problem right now is parsing the links to the other languages.. while you are already using a different language.. the only way to switch languages at the moment is going back to the original english page..

tommorrow.. i'm going to parse it.. i tried for like 3 minutes today.. but it's too complicated.. especially since the url is encoded.. i do not think you can decode.. maybe you can.. but slowly Smile

i was thinking.. encoding the url to translate.cgi and just parsing to see if it matches the url.. but it was a little buggy..

jerry

code is at: http://www.pdamania.com/sql/translate.txt

it's not a big script.. most of it is just the parse_form subroutine..

parsing the script itself would probably be a minimum of 4 more lines.. at most.. 10..

jerry
Quote Reply
Re: Automatic Language Translation? In reply to
this is what i call good usuage Wink

spanish.pdamania.com/
french.pdamania.com/
german.pdamania.com/
portuguese.pdamania.com/
italian.pdamania.com/

about the server errors.. let it be for now.. altavista is having problems with their thing.. it's not my script.. it's altavista..

hehe..
jerry

[This message has been edited by widgetz (edited September 19, 1999).]
Quote Reply
Re: Automatic Language Translation? In reply to
Great job, Jerry!

How do you call the script from the browser?

I tried using a combination of different arguements, but I keep getting Invalid URL!

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Automatic Language Translation? In reply to
the url has to start with

http://

that's all it cares about. .but then in altavista.. it needs your whole url.. so basically..

put

http://www.anthrotech.com/

you might have to umm....... (urlencode it).. i made a simple script to do it..

http://www.pdamania.com/encode.cgi

it tells you what to do.. just add your url behind it.. like

www.pdamania.com/encode.cgi?http://www.anthrotech.com/

basically...

translate.cgi?url=(url.. encoded)&language=(language)

language can be french, spanish, portuguese, italian, or german

[This message has been edited by widgetz (edited September 19, 1999).]
Quote Reply
Re: Automatic Language Translation? In reply to
Great! It works wonderfully!

The only thing now is to get it to work with a form from a link from the directory. I will play around with it and see what I come up with.

Thanks again for this wonderful script.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Automatic Language Translation? In reply to
Jerry,

I am in the process of adding sub-routines and library configurations from the rate.cgi file to the translate.cgi file (along with adding codes from add.cgi, such as db_referrer variable). Am I in the correct direction for integrating your translation.cgi file with templates?

I have also created two sub-routines in the site_html_templates.pl file:

site_translation_form
site_translation_failure

(Based on the site_rate_form and site_rate_failure sub-routines.)

I have also added two template files:

translate.html
translate_error.html

(Based on the rate.html and rate_error.html templates. I have also added a form in these template files based on the Babelfish forms at Altavista.)

Any other suggestions?

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited September 19, 1999).]

[This message has been edited by Eliot (edited September 19, 1999).]
Quote Reply
Re: Automatic Language Translation? In reply to
That should work Eliot. Just got it up for me, good job widgetz. I have to try the same when i get home, i mean making a form and stuff.
Quote Reply
Re: Automatic Language Translation? In reply to
Well, I have created the templates and routines in the site_html_templates.pl file. It seems to work, at least pulling up the form. However, I think I may be missing
some steps.

I modelled the translate.cgi file after the rate.cgi, which pulls the id (db_key) of the link and brings up the translate form with language options. The problem is that when I submit the form, I get an Internal Server Error. Also, when the URL does not appear in the text box. I have added the following code in the textarea codes:

Code:
<textarea name="url" value="<%URL%>"></textarea>

If anyone can help with modifying the translate.cgi script to pull up the correct arguments, I would greatly appreciate it. However, I did notice that Altavista has changed its translate script. The
arguments do not appear when you submit the form. The only thing that appears is the following:

Code:
http://bablefish.altavista.com/cgi-bin/translate.cgi

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited September 20, 1999).]
Quote Reply
Re: Automatic Language Translation? In reply to
Eliot,

Search.cgi does not work with translate.cgi.

Also, are you going to allow your users to add to your site using another language. Altavista's translator is not perfect, and the additionmight translate funny. I was speaking to Jerry last night ans was thinking that maybe ti would be better, for now, to not allow users to add a link, if the user is in another language beside english.

Are you going to post your additions to jerrys mod? That would be great! Smile

I think we have a great mod here. However, I think we are going to run into plenty of bugs. Lets all help each other on the way. Smile

------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com


Quote Reply
Re: Automatic Language Translation? In reply to
I get it to translate, from the form, but when i try to call it from the search results, i get an invalid language, of course, I could say the language but i want it to go to the form, so they can do it in any language, but i want it to print the url too.

[This message has been edited by Bmxer (edited September 20, 1999).]
Quote Reply
Re: Automatic Language Translation? In reply to
Bmxer,

I am still stuck with passing the variables from the translate form. How have you modified the translate.cgi file?

Ground Zero,

I don't know why the translate.cgi won't work with the search.cgi. You should put the link to the translate.cgi in your link.html file. With regards to adding languages, that would take a lot of work. The best suggestion I have is to download the software that Altavista uses:

http://www.systransoft.com/

and see what can be done with that software.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Automatic Language Translation? In reply to
Eliot,

For adding a link to translate.cgi in link.html, does the url for the links web site need to be encoded using widgetz url encoder?

For osme reason, I think jerry told me, the link needs to be encoded for Netscape.

Smile


------------------
James L. Murray
VirtueTech, Inc.
www.virtuetech.com


Quote Reply
Re: Automatic Language Translation? In reply to
doodle dum deedle dum.... (not dumb..)

ok.. this mod is just a simple mod.. when i started making it.. i didn't expect it to do more than translate one page.. when i found out the links would work also.. i was like

"COOL" Smile

the problems are the language support for search.cgi.. this COULD be fixed..

an example is..

http://www.domain.com/translate.cgi?url=http://www.url.com/to/search.cgi?query=haha&language=blah

the problem is.. their query has to be in english.. or you could make a mod to tranlate it to english.. but i don't think the tranlations are THAT perfect Wink

everything is possible.. just with altavista.. i do not think translating other languages into english is a good idea.. i have tried translating an english term to spanish.. and then spanish to english and i get this really strange sentence Smile

think of all the possibilies.. this can't be hard at all..

jerry
Quote Reply
Re: Automatic Language Translation? In reply to
I agree Jerry, i don't think this will take much work. Just a little effort.

Eliot,
I use this in translate.cgi above the the beginning

Code:
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}

local (%in) = &parse_form;

# Display the form if called with no input.
(keys %in 0) and &site_html_translate_form and return;

Then i made trans.html, the template, and put a field for the url, its name is url , not urltext so if you have that change it, and I made a drop down menu, and its name was language. I put names, and the values, french => french , spanish => spanish, etc..., and that works fine. I don't know what it is you guys are trying to do, are you trying to make it so you can put it in link.html, then put translate, point it to yours, and while taking the url, it'll still go to translate.html and print the url in the url spot. Me too, i'll tell you if i get it.
Quote Reply
Re: Automatic Language Translation? In reply to
ok.. if you want to use this translate.cgi..

(i'll put this in the source)..

but you are using it under your own risk.. Smile

you may not call this script your own..

you are allowed to edit it.. but you must make the code free to all (if somebody wants it.. like an exchange.. plus it saves me time and effort..)

if you use this and you are not a programmer you must..

NOT COMPLAIN ABOUT ANYTHING!

IF YOU WANT AN ENHANCEMENT YOU MUST GET HELP FROM SOMEONE ELSE.. NOT ME!! (dude.. that times 2!)

BE AWARE THAT THIS SCRIPT HAS NOT YET BEEN DEVELOPED TO THE EXTENT THAT IT WILL WORK ON YOUR ENTIRE SITE.. (partially altavista's incapabilities.. but yea.. we can't blame them..)

jerry
Quote Reply
Re: Automatic Language Translation? In reply to
I'm cool with that man, write it up.
> >