Better language fail

This commit is contained in:
Josh North 2021-06-10 06:12:24 -04:00
parent b16b55fa11
commit f3d506c857
3 changed files with 16 additions and 19 deletions

View File

@ -257,7 +257,7 @@ if (Registry::AUTHMETHOD == 'SAML') {
<!-- START VISITS LIST -->
<div class="container-fluid">
<div class="row">&nbsp;</div>
<div class="row"><?php echo $transLang['TTTT']; ?>&nbsp;</div>
<div class="row row-cols-2">
<div class="col d-grid gap-2">
<h2><i class="fas fa-home"></i> <?php echo $transLang['ACTIVEVISITS']; ?></h2>

View File

@ -26,23 +26,19 @@ use App\LobbySIO\Config\Registry;
* @author josh.north
*/
class Translate {
private $UserLng;
private $langSelected;
public $lang = array();
public function __construct($userLanguage){
$this->UserLng = $userLanguage;
//construct lang file
$langFile = Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini';
if(!file_exists($langFile)){
//throw new \Exception("Language could not be loaded"); //or default to a language
$langFile = Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini.example';
}
$this->lang = parse_ini_file($langFile);
}
public function userLanguage(){
return $this->lang;
}
private $UserLng;
private $langSelected;
public $lang = array();
public function __construct($userLanguage){
$this->UserLng = $userLanguage;
if(file_exists(Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini.example')){ $example = parse_ini_file(Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini.example'); };
if(file_exists(Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini')){ $custom = parse_ini_file(Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini'); };
if(isset($example)&&isset($custom)){$this->lang = array_merge($example,$custom);}
elseif(!isset($custom)){$this->lang = array_merge($example);}
elseif(!isset($example)){$this->lang = array_merge($custom);}
}
public function userLanguage(){
return $this->lang;
}
}

View File

@ -1,3 +1,4 @@
TTTT = 'TESTTESTTESTTEST'
ACCESS_LEVEL = 'Access'
ACCOUNT = 'Account'
ACCOUNT_INFO_DESC = 'You may make changes to your user profile below. To change your password, enter a new password twice below and press save. Minimum password length is '