Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Igor Crevar  >  icI18n  >  examples/example.php  >  Download  
File: examples/example.php
Role: Example script
Content type: text/plain
Description: first example
Class: icI18n
Get application text translations from XML files
Author: By
Last change:
Date: 2011-04-04 14:45
Size: 858 bytes
 

Contents

Class file image Download
<?php
$thisPath 
dirname(__FILE__).'/';
require_once 
dirname$thisPath ).'/icI18n.class.php' ;

///set path for langs
icI18nLanguage::setBasePath($thisPath.'langs');

//we want translations in german language - doesnt matter for this example really :)
$culture 'de'
$oLang = new icI18nLanguage($culture);

//first time pick translations from php files inside pages dir
if ($oLang->isEmpty())
{
    echo 
'<br />Load all tokens which need to be translated from files.<br />';
    
$oLang->findAllTranslationStrings($thisPath.'pages');
    
$oLang->toFile();
}
$trans $oLang->getTranslations();

//output all translations on screen
print_r($trans);

echo 
'<br /><br /><br />';    
echo 
'If you want to edit translations go to '.($thisPath.'langs/'.$culture.'.xml').' edit xml file and than clear '.
(
$thisPath.'langs/cache').' directory';