« prev next »

How Translate Tool on this Site Works

Related Categories
  Blogging
  Friends
  Life
  Me
  Misc
  This Site
  Wendy
  Yifan
  Backstage
  Blog Tips
  Hosting
  Map
  MovableType
  Other Sites
  Spam
  Webcam
  Projects
  RSS

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:

<table width="100%" border="0"><tr><td>
<dl>
<dt>Other Languages
</a></dd>
<dd><a href="http://<mt:BlogHost/>/zh-CN/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">Chinese</a></dd>
<dd><a href="http://<mt:BlogHost/>/ja/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">Japanese</a></dd>
<dd><a href="http://<mt:BlogHost/>/fr/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">French</a></dd>
<dd><a href="http://<mt:BlogHost/>/de/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">German</a></dd>
<dd><a href="http://<mt:BlogHost/>/it/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">Italian</a></dd>
<dd><a href="http://<mt:BlogHost/>/ko/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">Korean</a></dd>
<dd><a href="http://<mt:BlogHost/>/pt/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">Portuguese</a></dd>
<dd><a href="http://<mt:BlogHost/>/ru/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">Russian</a></dd>
<dd><a href="http://<mt:BlogHost/>/ar/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">Arabic</a></dd>
<dd><a href="http://<mt:BlogHost/>/es/<mt:EntryCreatedDate format="%Y%m%d"/>_<mt:EntryTitle dirify="1"/>.htm">Spanish</a></dd>
</dl>
</td></tr></table>

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:

Posted by Jian Shuo Wang at February 12, 2008 3:54 AM
Copyright: You are free to redistribute this work, as long as you keep this disclaimer and this link: http://home.wangjianshuo.com/archives/20080212_how_translate_tool_on_this_site_works.htm

Related Entries: Backstage
  1. Improving User Portal on Wangjianshuo.com March 15, 2008
  2. Analysis of Links and Ways to Improve March 14, 2008
  3. How Translate Tool on this Site Works February 12, 2008
  4. Recovery of Fanfan's Blog December 2, 2007
  5. My Readers are Primarily Older, more Asian, and Male... November 7, 2007
  6. AdSense Color Schema Change October 14, 2007
  7. Shanghai Photo Viewer October 12, 2007
  8. Improved Commenter Page September 2, 2007
  9. How to Add Navigation Menu to MovableType September 1, 2007
Comments
Post a comment
Name:

Email Address: (will not show)

URL: (optional)

Comments:


It may take up to 30 seconds before the server returns a result. IP address recorded.
Remember my information?

<-- Please click POST only once
© 2001 - 2008 Jian Shuo Wang. All right reserved.