NOTE: Altavista no longer runs Babelfish. This service is run by Yahoo now! If you used the Altavista settings, you need to change them according to this file.

Using the magic of Yahoo’s Babelfish and SSI includes, you can create a simple piece of code that will dynamically link the URL of the page to Yahoo’s Babelfish with a language translation of the user’s choice.

There are a few pre-requisites before you should attempt this:

* You MUST be familiar with editing and using the Unix Shell.
* You MUST know how to program ON the server via the Unix shell using Pico, Nano, or Vi
* You MUST know how to include files using SSI

If you’re not familiar with these steps, don’t try this. While technically simple, this is NOT something most folks have familiarity with. If you have any questions, ask TLN before you try this! Email me with ANY questions at mmcevoy at northvillelibrary.org

This information can probably be translated to work on an IIS server, or your own in-house server. I don’t know for sure, but the instructions below DO work on the TLN server.

First, create a file in your HOME web directory called “language.htm”

This file will consist of the following lines:

<pre>
<span>Need a different language for this page?<br>
<a href=”http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=http://www.northvillelibrary.org
<!–#echo var=”DOCUMENT_URI” –>&lp=en_es”>Espanol</a> | <a href=”http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=http://www.northvillelibrary.org
<!–#echo var=”DOCUMENT_URI” –>&lp=en_pt”>Portuguese</a> | <a href=”http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=http://www.northvillelibrary.org
<!–#echo var=”DOCUMENT_URI” –>&lp=en_it”>Italiano</a> | <a href=”http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=http://www.northvillelibrary.org
<!–#echo var=”DOCUMENT_URI” –>&lp=en_fr”>Francois</a> | <a href=”http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=http://www.northvillelibrary.org
<!–#echo var=”DOCUMENT_URI” –>&lp=en_de”>German</a> | <a href=”http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=http://www.northvillelibrary.org
<!–#echo var=”DOCUMENT_URI” –>&lp=en_zh”>Chinese</a> | <a href=”http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=http://www.northvillelibrary.org
<!–#echo var=”DOCUMENT_URI” –>&lp=en_ko”>Korean</a> | <a href=”http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=http://www.northvillelibrary.org
<!–#echo var=”DOCUMENT_URI” –>&lp=en_ja”>Japanese</a></span></pre>

In the language.htm file, change ALL www.northvillelibrary.org statements to your library’s domain. (i.e. if you’re from Brighton, use brightonlibrary.info or if from Livonia use www.livonia.lib.mi.us)

Save the language.htm file to the main web directory of your domain.

Explanation of programming for language.htm file:

First, you have a simple link construct for Yahoo Babelfish, like this:
http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=http://www.northvillelibrary.org&lp=en_es

The URL breakdown is simple: the first section defines the URL on Yahoo to look for the Babelfish tool:
http://babelfish.yahoo.com/translate_url?doit=done&tt=url&intl=1&fr=bf home&trurl=

The second section defines the URL to be translated:

http://www.northvillelibrary.org

The third part is the dynamic URL trick is an SSI trick. You simply include a LONG URL statement to tell exactly WHERE the URL to be translated is:
http://www.northvillelibrary.org

Where the first part is your library’s domain name (ex. www.northvillelibrary.org) and the second part is the SSI call for Document URL ()

Do NOT include a / in the statement. It is provided automatically.

The last half of the URL tells what language to translate from and to:
&lp=en_es

The language.htm file above provides translation links for English to the following languages:

Spanish (en_es), Portugese (en_pt), Italian (en_it), French (en_fr), German (en_de), Chinese (en_zh), Korean (en_ko), Japanese (en_jp)

You can probably get more languages out of this concept by adding more lines to the language.htm file. The above simply represent the primary English to Other Language translators.

Using the language.htm file:

Now, to actually include this file on a website, you must EDIT ON THE SERVER. You CANNOT do an SSI include with Microsoft Frontpage (to my knowledge) without Frontpage mangling the code when it is published to the server. Use Pico, Nano, or Vi. Whichever you are comfortable with.

If you know how to use footer files, you probably know how to use the SSI include trick. This is NOT difficult.

At the bottom of the code for your webpage, include this line:

Then SAVE the file.

Now, open your web browser and load that file. You should see at the bottom of the page your language.htm information. Click on a link to test it. It will load your webpage, translated to a new language, WITHOUT the user ever noticing that it went to Yahoo Babelfish to receive the translation!

Please note: You CANNOT include the file dynamically from a lower directory via something like It MUST be a direct statement! See the next section on how to get around this.

Using the same file in other directories:

Now, you may want to use the language.htm file in other directories. You can always copy the language.htm file to another directory, or you can create a dynamic link to the language.htm file. Say, you have a directory called “secondlevel” that would be at /home/library/library/www/secondlevel

You can use the Unix shell, go into the secondlevel directory and type the following command:

ln -s /home/library/library/www/language.htm

The above command creates a DYNAMIC link in the secondlevel directory to the language.htm file. Therefore, you don’t have to create multiple copies of the language.htm file. This simplifies updated the language.htm file (as you’ll only have to do it once if you add or subtract a language) and saves space on the TLN web server (or your own in-house server… a useful trick for any repeating files you may have, and very useful for “footer” files).

Possible Errors:

You MIGHT get an error message displaying on the webpage after you set the include. This could be a variety of thing, but mostly it’s because there is a type, or a mistake in the language.htm formatting. The most common error is forgetting to include the # in the correct place:

Or any other problems, including in the URL statement. Doublecheck the formatting on all lines if you get any kind of error on the webpage display.

But this problem can also happen if the language.htm file isn’t in the correct directory, or the file permissions are set too low. (chmod 644 should be adequate)

If these basic troubleshooting steps don’t work, remove the Include code from your file, and contact Michael for troubleshooting.

Questions?

If you have ANY questions at all about this document, please contact Michael at mmcevoy at northvillelibrary.org. You can see a working version of the information included in this document by browsing the Northville District Library website. Language choices are at the bottom of EVERY SINGLE PAGE on this website (except “Useful Websites”).

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>