Login   Register  
PHP Classes
elePHPant
Icontem

File: demo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Muhammed Mamedov  >  Language Definition  >  demo.php  >  Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Demonstration loading ru_lang.php from /lang dir
Class: Language Definition
Retrieve application texts for multiple idioms
Author: By
Last change:
Date: 5 years ago
Size: 743 bytes
 

Contents

Class file image Download
<?php
require('/home/mysite/public_html/LanguageDefinition.class.php');

$language='ru'//you can set this through a session or cookie or whatever
$lng = new LanguageDefinition('lng'); //you need to pass string with the name of the variable
$lng->setBase('/home/mysite/public_html/lang/');
$lng->setLang($language);

//optional, setting debug mode
$lng->setDebug(true); 

?>
<pre>
<p>
This data comes from language file:
<?=__('Days')?>
</p>
<p>
This data also comes from the same language file:
<?=__('months')?>
</p>
This will print 'pants', because it isn't defined in our language file
<?=__('pants')?>
</p>
</pre>
<br/>
Output Debug info (prints array containing term 'pants')
<?php print_r($lng->getDebug())?>