How Translate Tool on this Site Works

By Jian Shuo Wang on 2008-02-12 03:54 · Backstage

The Files are Not Actually There

In .htaccess file in root folder, I have the following:

RewriteRule ^(fr|ja|zh-CN|de|it|ko|pt|es|ar|ru)/.*$ scripts/analytics/translatedoc.php [L]

This way, I have the most language supported:

There are many more need to be added, which I will do later.

Links to the Pages

The entry page for the translated articles are at the main individual archive pages */archives/ *on this blog. It is located at the right most corner of each page currently. Here is the code to make it happen:

Other Languages
_.htm">Chinese
_.htm">Japanese
_.htm">French
_.htm">German
_.htm">Italian
_.htm">Korean
_.htm">Portuguese
_.htm">Russian
_.htm">Arabic
_.htm">Spanish

The Code Itself

Now that we have the facade ready, and now we are going to work on the real page.

Storage of the Translated Documents

They are in the hidden folder (outside /public_html/home/ directory) called /translate/. There are different folders, according to the languages, to store the raw data of the translated file.

Then the class Article need to the plumbing work to get the purified data out of the files, to give the render page clear title, clear body.

Requirement for the Raw Documents

To simply programing, the following is required: