Login   Register  
PHP Classes
elePHPant
Icontem

File: file.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mariano Iglesias  >  Internationalization and Localization  >  file.php  >  Download  
File: file.php
Role: Example script
Content type: text/plain
Description: This class presents an example of using the I18N package with text files as its source of data.
Class: Internationalization and Localization
Get internationalized texts from databases or XML
Author: By
Last change: Changed to use FileDataSource.
Date: 2005-07-17 22:05
Size: 935 bytes
 

Contents

Class file image Download
<?php

require_once(dirname(__FILE__) . '/I18N.class.php');

// Instantiate the source

$dataSource =& new FileDataSource(dirname(__FILE__) . '/file/i18n.xml');

// Do our I18N stuff

$i18n =& new I18N();

$i18n->setLanguage('en');
$i18n->setDataSource($dataSource);

$languages =& $i18n->fetchLanguages();
$container =& $i18n->fetch();
$section =& $i18n->fetch('section');
$element =& $i18n->fetch('section''element');

// Print out results

echo '<b>ACTIVE LANGUAGES</b>';
echo 
'<hr />';
echo 
'<pre>';
print_r($languages);
echo 
'</pre>';
echo 
'<hr />';

echo 
'<b>CONTAINER</b>';
echo 
'<hr />';
echo 
'<pre>';
print_r($container);
echo 
'</pre>';
echo 
'<hr />';

echo 
'<b>SECTION</b>';
echo 
'<hr />';
echo 
'<pre>';
print_r($section);
echo 
'</pre>';
echo 
'<hr />';

echo 
'<b>ELEMENT</b>';
echo 
'<hr />';
echo 
'<pre>';
echo 
'<b>' $element '</b>';
echo 
'</pre>';
echo 
'<hr />';


?>