June 12, 2008

Why Language Translation is Important

As a follow up to my Language Translation plugin, here's a little info on why language translation is important.

Most people in the world do not speak English:
Sample chart

Most people in the world are also not able to access the internet. But this number is growing by leaps and bounds.
Sample chart


Sample chart

While many English speaking people are already on the Internet, the number of people that do not speak English on the Internet is growing substantially.
chart

Source: http://www.internetworldstats.com/stats.htm

Translate Plugin for MT

Download the plugin by clicking here.

Translate Plugin for Movable Type 4.x

Translate

This plugin allows you to place links on your blogs that will translate the content into multiple foreign languages using the Google Language AJAX APIs.

A. Installation Instructions

       
  1. Copy the contents of the folder to your MovableType directory. Make sure     that the directory structure remains intact.    
  2.    
  3.         Log in to the MovableType dashboard, or refresh the dashboard if you are already logged in.         You should be prompted to "Upgrade".    
  4.    
  5.         Open the Header template (Design - Templates - Template Modules) and insert the <MTTranslateHeader/> tag between the <head> and </head> tags.         This will allow the Google Language AJAX APIs to work on your site on all pages (the tag includes the needed javascript).    
  6.    
  7. Open the Stylesheet template and include the following line after the other "@import" statements:         @import url(<MT:StaticWebPath>/plugins/Translate/css/translate.css);    
  8.    
  9. Modifiy the templates and include the tags in the desired locations (see section B: Using The Tags).
  10.    
  11. Publish your blog. You should see the "Translate" link below each entry.

B. Using the Tags

You must use the <MTTranslateHeader> tag somewhere (ideally in the Header template).

The only other tag is the <MTTranslateMenu> tag which inserts the proper code needed to display the translate menu, which allows the reader to translate the content of the entry. The tag has 2 parameters:

       
  • sourceid (required) - The HTML div id of the content that is to be translated.
  •    
  • sourcelanguage (optional) - The 2 character language code of the original language of the content.     If not specified, "en" will be used by default (English).

For example, you could place the following code into your Summary template:

    <mt:setvarblock name="sourceid">asset-body-<$MTEntryID$></mt:setvarblock>
    <MTTranslateMenu sourceid="$sourceid" />

Make sure that your template has the corresponding id on the appropriate div tag. You may need to add the id yourself if it is not already in your template!
Also note that you will probably need to place the tag in your Entry template as well. Remember, div tag id's must be unique, so use the MTEntryID tag to get the unique id of the entry.

C. Other Stuff

The CSS file can be changed to create the desired style. By default it uses flag icons from http://www.famfamfam.com/lab/icons/flags/ which are named according to country codes (not to be confused with language codes).