piler/webui/system/language.php
2012-02-08 23:14:28 +01:00

41 lines
628 B
PHP

<?php
class Language {
public $data = array();
public function __construct () {
if(isset($_SESSION['lang'])) {
$file = DIR_LANGUAGE . $_SESSION['lang'] . '/messages.php';
} else {
$file = DIR_LANGUAGE . LANG . '/messages.php';
}
if (file_exists($file)) {
$_ = array();
require($file);
$this->data = array_merge($this->data, $_);
}
else {
exit('Error: Could not load language ' . $file . '!');
}
}
public function get($key) {
return (isset($this->data[$key]) ? $this->data[$key] : $key);
}
}
?>