Pages

Pages

Up to Contents Next: Translating Static Text

Internationalization with Xataface

Jump:

Xataface includes the ability to internationalize your applications. Note, that multilingualization of content requires the query translation extension that is not available as open-source. Contact info at weblite.ca for more information about

Introduction

What is internationalization, and how can Dataface be used to internationalize your applications?

Internationalizing a web site is the process of making it usable in different multiple languages.  This involves translating the text of your website into each multiple languages, formatting dates, times, and numbers in a locale-dependent fashion, and managing the website data in multiple languages.
Xataface 0.6 provides the tools to internationalize your existing PHP/MySQL application quite easily by following a few conventions.

How does Xataface deal with Internationalization?

Xataface handles all of the grunt work involved in making your application (or website) ready for an international audience.  This includes:

  • Automatic detection of the user's language settings.
  • Allowing users to specify language preferences manually (switching between languages).
  • Text translation of "static" text in the web application to the appropriate language for the user.  "Static" text refers to any text that is not stored in the database.  It may be embedded as part of a template, or a string literal as part of a PHP script.
  • Multi-lingual data storage.  Xataface allows database records to be stored in multiple languages so that records can be viewed and edited in the appropriate language.
  • Data translation. Xataface provides a translation form that allows translators to easily translate database records from one language to another.
  • Seamless integration.  You can use Xataface to internationalize any existing PHP/MySQL application without having to change the application structure.  You just replace a few specific function calls with their Xataface api equivalent, and the translation is handled automatically.

What is the procedure to internationalize an application?

There are two main aspects to deal with when internationalizing your site.  First you need to "internationalize" your static content (e.g. templates ).  Next, you have the option to multilingualize your dynamic content (e.g. database records).

First Step: Internationalizing Static Content

  1. Specify the languages that you want your application to support inside the conf.ini file.
  2. Add a directory named 'lang' to your application directory with your language translation files for each language.
  3. Use the df_translate() function and the {translate} tag to "translate" all text in your scripts and templates.  And create translations in your translation files.(tedious but easy).

Second Step: Multilingualizing Dynamic Content

  1. For each table that needs to be multilingualized, add corresponding tables of the form Tablename_<lang-code> (where <lang-code> is the 2-letter ISO 639.2 language code).  E.g. If the table 'Profiles' needs to be translated into English and French, you would create tables named 'Profiles_en' and 'Profiles_fr' with primary key columns and columns that need to be translated.  These tables need not contain any columns that don't need to be translated (e.g. Phone Number).
  2. If your application or site uses SQL to directly select and update records in the database (e.g., using mysql_query() calls), then you will need to swap all calls to mysql_query() (or the equivalent) to df_query() (a query function which is part of the Xataface API).  df_query() parses all SQL queries and alters them as necessary to retrieve the appropriate translation of data from the database.
  3. Use Xataface's built-in translation form to translate records from one language to another (if necessary).

That's it!  You're done.

Samples

Some sites that use Xataface's multilingual features include:

Web Lite Translate
A site advertising multilingual database and website services based on the Xataface framework. This site is translated into English, French, and Chinese .(http://translate.weblite.ca).
Science.ca
A Canadian science web site that includes a database of scientist profiles, questions and answers, and more.  This site just recently moved from PHP/PostgreSQL to PHP/MySQL with Xataface's translation technologies to make the site Bilingual (English and French).  Much of the site is currently translated using the Google translation service so the quality of translation is not very good at this point, however they are slowly replacing the machine translations with human translations. (http://www.science.ca).
 

Demos

Check out a demo version of the Web Lite Translate web site at http://dev.weblite.ca/translate_demo/index.php .  This version allows you to log into the Xataface back-end and make changes to the data and try out the translation technology.

This site is refreshed every 24 hours so you don't have to worry about messing things up.

 
 

Up to Contents Next: Translating Static Text
blog comments powered by Disqus
Powered by Xataface
(c) 2005-2024 All rights reserved