Internationalization and Multilingualization

I am up to my knees in the entrails of Dataface as I attempt to take it to the next level.  I am currently working on the 0.6 release and hope that it will be available for download in early May.  The big bit that I’m working on right now is Internationalization and Multi-lingualization. 

Internationalization:

I have added a LanguageTool class whose job it is to translate text.  Developers can provide language ini files with translations for multiple languages which the language tool uses for its translations.  Dataface provides a smarty {translate} tag that translates a section of text, so that internationalizing a template is just a matter of wrapping the text sections in {translate} tags and creating the language files.  Once one translation is done, the language file can be translated easily to produce additional translations.

Multilingualization:

 One of the more difficult problems to solve in Data driven applications is how to deal with mult-lingual content in the database.  Dataface will solve this problem by defining conventions for table names.  For example, if we have a ‘Profile’ table with fields "ProfileID", "Name", "Phone", and "Blurb", and we want the "Blurb" field to be multi-lingual,  then we create an additional table for each translation named "Profile_<language_code>" where <language code is the 2 digit code for the language (e.g. Profile_en would contain the english translation, and Profile_fr would contain the french translation).

Then Dataface would be able to load and save records transparently in the proper language according to the language that the user has selected.  Dataface will provide a wrapper db_query() function that can be used in place of any mysql_query() call that will automatically parse and convert the query to extract the proper language translation.  This will make it almost trivial to convert an existing PHP/MySQL application to a bilingual application without even having to change the application structure.  Just swap the mysql_query() calls for the dataface db_query() function.

In addition to this low-level conversion, Dataface will provide a "Translation Form" to translate records from one language to another.  It will be similar to the existing Edit Record Form, but will show one language translation and allow the user to edit another language translation and save the changes.  Good API support will be available so that forms can be created easily programmatically and placed anywhere in the application without having to change the existing application structure.

Anyways.. stay tuned 

comments powered by Disqus