|
Posted by Stephen Kay on 03/21/06 23:57
I'm trying to run pages of my site through an automatic translation program
such as babelfish.
I've written a code module translate.php, that gets the URL of the current
page, formats the query string etc. correctly to call babelfish, and then
calls the babelfish translation page using curl.
This actually works, and returns my page, all nicely translated into some
other language.
The problem I've run into is that, after the first translation, the page
comes back with babelfishes URLs prefixed to all URLs in the HTML. So if you
click another link, it also gets translated the same way. Actually, this is
great and wonderful except that I have a series of buttons on the bottom
that translate to different languages. So now the buttons, instead of
calling my translate.php function directly, will attempt to call it through
the translation page first, which totally screws it up.
What I want is the page to come back translated, yet somehow reset only the
certain URLs on the translate buttons so that they again call my
translate.php code directly, without the babelfish prefix.
Am I correct in thinking that I must somehow load the page into memory (from
babelfish), then search through it for the strings I want to replace, and
"edit" the HTML code, before I actually send it for output and display?
Any pointers/tips on doing this, or is there some easier way of dealing with
this? Thanks much.
--
Stephen Kay
Karma-Lab sk@karma-lab.NOSPAM.com
^^^^^^^
[Back to original message]
|