Login   Register  
PHP Classes
elePHPant
Icontem

Internationalization and Localization: Get internationalized texts from databases or XML

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (22)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2005-07-19 (9 years ago) RSS 2.0 feedNot enough user ratingsTotal: 2,152 This week: 1All time: 1,691 This week: 1,467Up
Version License Categories  
i18n 1.0GNU Lesser General Publ...XML, Localization, Databases
Description Author  

This package can retrieve texts for internationalized applications from databases or plain text files (XML or INIs).

It provides a base data source class that defines an interface with functions to retrieve texts given their element identifiers, the language to use, the locale for a language (optional), the application section and an eventual container object of a class that is used to retrive the actual internationalized texts.

The base class interface also provides a function to retrieve the list of supported languages, and locales.

The package comes with implementation classes that know how to access the data source container objects to retrieve the texts, supported languages and locales.

Currently there are implementation classes that can retrieve the information from either databases or plain text files (in the form of XML or INI files.) Other implementation classes can be developed to retrieve the information from other data sources, such as LDAP repositories.

Innovation Award  
PHP Programming Innovation award nominee
July 2005
Number 5


Prize: One downloadable copy of Roadsend PHP Compiler
To adapt an application that can be used by users of different countries it is necessary to present the application messages in the idioms spoken in those countries.

Usually the solution is to load configuration files that contain the texts for each of the supported idioms.

However, sometimes it is more convenient to store the translated texts in a database because it is easier to edit and make any changes immediately available to the applications.

This class provides a generalized solution that provides the same interface to retrieve application localized texts independently from how the texts are stored.

Manuel Lemos
Picture of Mariano Iglesias
Name: Mariano Iglesias <contact>
Classes: 1 package by
Country: Argentina Argentina
Age: 36
All time rank: 126516 in Argentina Argentina
Week rank: 1125 Up13 in Argentina Argentina Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
File Role Description
Accessible without login Plain text file database.php Example An example script that uses a database connection as a string source.
Plain text file DatabaseConnection.class.php Class Class that extends and implements methods in DatabaseConnectionManager and is used by the database.php example script.
Plain text file DatabaseConnectionManager.class.php Class This is an abstract class that provides the skeleton for the implementation of the class that will provide database connectivity to I18N.
Plain text file DatabaseDataSource.class.php Class Implementation of DataSource, that provides the database based approach to obtain elements.
Plain text file DataSource.class.php Class Abstract class that all data sources should implement.
Accessible without login Plain text file Documentation.txt Doc. Documentation that tells how to install this script, and provides a description of how to use this package.
Plain text file Dommer.class.php Class The XML parser used to parse the configuration file when using text source. It will use the DOM XML package (it is PHP5 compatible), or if it is not available, it will use PEAR's XML_Parser.
Accessible without login Plain text file example-data.sql Data SQL script to insert some example data in the database.
Accessible without login Plain text file file.php Example This class presents an example of using the I18N package with text files as its source of data.
Plain text file FileDataSource.class.php Class Implementation of DataSource, that provides the file based approach to obtain elements.
Accessible without login Plain text file i18n-xml.xml Data The XML configuration file used by the xml.php example script. You need to adjust paths to use it.
Plain text file I18N.class.php Class The main I18N class that handles internationalization and localization.
Accessible without login Plain text file i18n.sql Data SQL script to create tables for using a database as a source for the I18N package.
Accessible without login Plain text file i18n.xml Data The XML configuration file used by the file.php example script. You need to adjust paths to use it.
Accessible without login Plain text file language.en.lang Data Example language file for the file.php example script.
Accessible without login Plain text file language.en.lang.xml Data Example language file for the xml.php example script
Accessible without login Plain text file language.en_uk.lang Data Example language file (localized) for the file.php example script.
Accessible without login Plain text file language.en_uk.lang.xml Data Example language file (localized) for the xml.php example script
Accessible without login Plain text file language.es.lang Data Example language file for the file.php example script.
Accessible without login Plain text file language.es.lang.xml Data Example language file for the xml.php example script
Accessible without login Plain text file xml.php Example This script presents an example of using the I18N package with XML files as its source of data
Plain text file XmlDataSource.class.php Class Implementation of DataSource, that provides the XML file based approach to obtain elements.

 Version Control Unique User Downloads Download Rankings  
 0%Total:2,152All time:1,691
 This week:1This week:1,467Up