I18n & l10n system

MVCLight includes a localization library based on gettext principles. Both gettext and a custom translations file system are available, and they allow support for plural forms.To use it, include this line on your controller, as it is done in appController in this demo.$this->language->initGetText('en_GB');

Then, if gettext is available you can use your own MO files. Otherwise, you can take the file application/lang/es_ES as an example of use.

The function __() is defined to overload the gettext function _() and it is used like this:

  __('there are %s apples',     array( 'count' => 9,             'caps'  => ('first'|'words'|'upper'|'none'),            'vars'  => array('kitchen','window',...) )      );



Code__('there are %1$s apples in %2$s',array('count'=>0,'vars'=>__('the kitchen')))
Producesthere are 0 apples in the kitchen
Code__('there are %1$s apples in %2$s',array('count'=>1,'vars'=>__('the window')))
Producesthere are 1 apples in the window
Code__('there are %1$s apples in %2$s',array('count'=>5,'vars'=>__('the living room')))
Producesthere are 5 apples in the living room
Code__('there are %1$s apples in %2$s',array('count'=>12,'vars'=>__('the corridor')))
Producesthere are 12 apples in the corridor