mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-27 07:30:11 +01:00
41 lines
628 B
PHP
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);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
?>
|