Class functions:

Instantiation

void LanguageSys( void )
To instantate you can create a simple object of LanguageSys.
Don't forget to bind the class!
include('LanguageSys.class.php');
$lang = new LanguageSys();
$lang->...

LanguageSys::set_res_dir

bool set_res_dir( string dir )
This functions sets the directory which is searched for language files.
Returns TRUE on success, on error (eg the directory doesn't exist) it returns FALSE.
Before the first call of set_res_dir() the default directory which is set is ./lang, relative from the own directory. include('LanguageSys.class.php');
$lang = new LanguageSys();
$lang->set_res_dir('./foo/bar/');
$lang->...

LanguageSys::get_aviable_languages

array get_aviable_languages([lsys_return_type type])
Returns a array based on the given resource type. Those can be a numeric array which contains all the language codes (LSYS_RTN_CODES), a numeric array which contains all the names of the languages like "e;German (Germany)" (LSYS_RTN_NAMES), an other possibility is a assisioative array build of the language code as descriptor an the language name as content (LSYS_RTN_MIXED).
Default is LSYS_RTN_CODES.
Example for LSYS_RTN_CODES: $lang = new LanguageSys();
$languages = $lang->get_aviable_languages();
  
print_r($languages);
$lang->...
Would print out something like: Array (
  [0] => de_DE
  [1] => en_EN
  [2] => en_US
)
Example for LSYS_RTN_NAMES: $lang = new LanguageSys();
$languages = $lang->get_aviable_languages(LSYS_RTN_NAMES);
  
print_r($languages);
$lang->...
Would print out something like: Array (
  [0] => German (Germany)
  [1] => English
  [2] => English (United States of America)
)
Example for LSYS_RTN_MIXED: $lang = new LanguageSys();
$languages = $lang->get_aviable_languages(LSYS_RTN_MIXED);
  
print_r($languages);
$lang->...
Would print out something like: Array (
  [de_DE] => German (Germany)
  [en_EN] => English
  [en_US] => English (United States of America)
)

LanguageSys::load

bool load( string language_code )
The founction load() is used to load a language file. After loading the language file is aviable and the variables would be instantiated.
If there was a lnaguage file loaded before and you load a new language file the old variables wouldn't be deleted, just the variables are also given in the newly loaded file would be overwritten.
This is made so because of that eg a language file for a older version of your application was loaded. If you have loaded a other default language file before, the entries which are not aviable from the new loaded file are also avible in the default language.
On success this function returns TRUE, on error it returns FALSE. To handle the errors use the LanguageSys::last_error() function. $lang = new LanguageSys();
//Load the english language file.
$lang->load('en_EN');
//Print out the contents of "foo".
print $lang->foo;

LanguageSys::compile

bool compile(string sourcefile, string destinationfile)
The compile-function is used to precompile a language file.
You have to give the full path of the source and destination file, because the resource directory wouldn't be used.
By precompiling the parsing mechanism can be highliy increased, so if it is possible you should use precompiled files.
For more information on precompiling see "Precompiling"
Example: $lang = new LanguageSys();
$lang->compile('./uncompiled/en_EN.ini', './compiled/en_EN.lng');
$lang->...

LanguageSys::_parse

private mixed _parse( string &code )
The method _parse is used intern by LanguageSys to get the datas out of precompiled language files.
Those method isn't made for normal use.

LanguageSys::_pparse

private mixed _pparse( array &code )
The method _pparse is used intern by LanguageSys to get the datas out of the language files.
Those method isn't made for normal use.

LanguageSys::_error

private void _error(lsys_error_type type, string message [, int line])
Die Methode _error wird intern von LanguageSys verwendet um einen Fehler in den Fehlerpuffer zu schreiben.
Sie ist nicht für den normalen gebrauch gedacht. Kann aber sinnvol in abgeleiteten klassen eingesetzt werden.

LanguageSys::last_error

string last_error( void )
Returns the last error happened.
If there wasn't a failure yet it will return FALSE.
Normaly last_error() is used in cooperation with load() oder compile().
Example: ...
if( !
$lang->load('en_EN') )
{
  die(
$lang->last_error());
}
...

LanguageSys::get_fileinfo

string get_fileinfo(string info)
Returns the value of a variable defined in the [info] section of the language file.
If the value wasn't given by the language file, it will return NULL. ...
if( !
$lang->load('en_EN') )
{
  die(
$lang->last_error());
}
//Print out the translation informations..
print $lang->get_fileinfo('translation_info');
...

LanguageSys::get_author

string get_author( void )
Alias for LanguageSys::get_fileinfo('author')

LanguageSys::get_transinfo

string get_transinfo( void )
Alias for LanguageSys::get_fileinfo('translation_info')

LanguageSys::get_version

string get_version( void )
Alias for LanguageSys::get_fileinfo('version')

LanguageSys::get_application

string get_application( void )
Alias for LanguageSys::get_fileinfo('application')