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 --> <!-- START VISITS LIST -->
<div class="container-fluid"> <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="row row-cols-2">
<div class="col d-grid gap-2"> <div class="col d-grid gap-2">
<h2><i class="fas fa-home"></i> <?php echo $transLang['ACTIVEVISITS']; ?></h2> <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 * @author josh.north
*/ */
class Translate { class Translate {
private $UserLng;
private $UserLng; private $langSelected;
private $langSelected; public $lang = array();
public $lang = array(); public function __construct($userLanguage){
public function __construct($userLanguage){ $this->UserLng = $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'); };
//construct lang file if(file_exists(Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini')){ $custom = parse_ini_file(Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini'); };
$langFile = Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini'; if(isset($example)&&isset($custom)){$this->lang = array_merge($example,$custom);}
if(!file_exists($langFile)){ elseif(!isset($custom)){$this->lang = array_merge($example);}
//throw new \Exception("Language could not be loaded"); //or default to a language elseif(!isset($example)){$this->lang = array_merge($custom);}
$langFile = Registry::DIRPATH . 'src/Language/'. $this->UserLng . '.lang.ini.example'; }
} public function userLanguage(){
$this->lang = parse_ini_file($langFile); return $this->lang;
} }
public function userLanguage(){
return $this->lang;
}
} }

View File

@ -1,3 +1,4 @@
TTTT = 'TESTTESTTESTTEST'
ACCESS_LEVEL = 'Access' ACCESS_LEVEL = 'Access'
ACCOUNT = 'Account' 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 ' 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 '