Location: PHPKode > scripts > icI18n > examples/example2.php
<?php
$thisPath = dirname(__FILE__).'/';
require_once dirname( $thisPath ).'/icI18n.class.php' ;

///set path for langs files
//current language is en(english) same as default language
icI18n::init('en', $thisPath.'langs2', 'en');

$langs = array('de', 'fr', 'sr');
$langsNames = array('de' => 'German',  'fr' => 'French', 'sr' => 'Serbian');

//create langs objects
foreach ($langs as $lang){
	icI18n::addLanguage( new icI18nLanguage($lang) );
}

//first time pick translations from php files inside pages dir
foreach ($langs as $lang){
	$oLang = icI18n::getLanguage($lang);
	if (!$oLang->isEmpty()) continue;
	$oLang->findAllTranslationStrings($thisPath.'pages/example2');
	$oLang->toFile();
}

require_once($thisPath.'pages/example2/juststrings.php');

//output all translations on screen for german
echo '<h1>Original English</h1>';
//current language is english - we alreadt set that in init, but this is an example - who carres :)
icI18n::setCurrentLanguage('en');
printDetails();
foreach ($langs as $lang){
	echo '<h2>Translation on '.$langsNames[$lang].'</h2><br />';
	icI18n::setCurrentLanguage($lang);
	printDetails();
}


echo '<br /><br />';	
echo 'Sorry for all translations :). My native is serbian. I use google translate for all other languages :)';
echo '<br /><br />';	
echo 'If you want to edit translations edit xml files inside '.($thisPath.'langs2/').' and than clear '.
($thisPath.'langs2/cache').' directory';
Return current item: icI18n