diff --git a/app/class/LangManager.php b/app/class/LangManager.php index 6a218ec..b85b97f 100644 --- a/app/class/LangManager.php +++ b/app/class/LangManager.php @@ -7,24 +7,36 @@ class LanguageManager private $lngCode = 'en'; private $lngDatabase = []; + private $debug = false; - function __construct(string $lngCode) + function __construct(string $lngCode, bool $debug = false) { $this->lngCode = $lngCode; + $this->debug = $debug; } function load() { $file = './app/lang/en.php'; + if (!file_exists($file)){ + die(); + //TODO add lng EXEPTIONS + } $arrayFirst = include($file); $file = './app/lang/' . $this->lngCode . '.php'; - $arraySecond = include($file); + $arraySecond = []; + if (file_exists($file)){ + $arraySecond = include($file); + } $this->lngDatabase = array_merge($arrayFirst,$arraySecond); return true; } function get(string $stringKey) { + if ($this->debug) { + return $stringKey; + } if (isset($this->lngDatabase[$stringKey])) { return $this->lngDatabase[$stringKey]; } @@ -33,9 +45,15 @@ class LanguageManager function echo(string $stringKey) { - if (isset($this->lngDatabase[$stringKey])) { - return $this->lngDatabase[$stringKey]; + if ($this->debug) { + echo $stringKey; + return; } - return $stringKey; + if (isset($this->lngDatabase[$stringKey])) { + echo $this->lngDatabase[$stringKey]; + return; + } + echo $stringKey; + return; } } diff --git a/app/lang/cs.php b/app/lang/cs.php index 92f5501..ae31830 100644 --- a/app/lang/cs.php +++ b/app/lang/cs.php @@ -1,5 +1,5 @@ 'Domů', 'm_dashboard' => 'Nástěnka', @@ -45,6 +45,7 @@ $lang = [ 'l_sleepTime' => 'Doba spánku zařízení', 'l_atHome' => 'Doma Jsou', 'l_nameAt' => 'Název', + 'l_lastSeen' => 'Naposledy připojeno', //Title 't_createScene' => 'Vytvořit scénu', diff --git a/app/lang/en.php b/app/lang/en.php index c29271f..ee6a736 100644 --- a/app/lang/en.php +++ b/app/lang/en.php @@ -1,5 +1,5 @@ 'Home', 'm_dashboard' => 'Dashboard', @@ -21,6 +21,12 @@ $lang = [ 'b_approve' => 'Approve', 'b_disable' => 'Disable', 'b_save' => 'Save', + 'b_logOut' => 'Logout', + 'b_sendTestNotification' => 'Send Test Notification', + 'b_rooms' => 'Rooms', + 'b_restart' => 'Restart', + 'b_disable' => 'disabele', + 'b_select' => 'Select', //labels @@ -45,6 +51,8 @@ $lang = [ 'l_sleepTime' => 'Device sleep Time', 'l_atHome' => 'At home', 'l_nameAt' => 'Name', + 'l_lastSeen' => 'Last Seen', + 'l_notificationStatus' => 'Notification status', //Title 't_createScene' => 'Create Scene', @@ -52,7 +60,15 @@ $lang = [ 't_createAutomation' => 'Create Automation', + + 't_addDevice' => 'Add Device', 't_editDevice' => 'Edit Device', + 't_pageAfterLogIn' => 'Page After Login', + 't_profile' => 'Profile', + 't_notification' => 'Notification', + 't_experimental' => 'Experimental', + 't_' => 'Edit Device', + //constants 'humi' => 'Humidity', @@ -73,6 +89,19 @@ $lang = [ 'w_neni' => 'At', 'w_is' => 'is', + //tables + 't_time' => 'Time', + 't_state' => 'State', + + //Days Long + 'd_monday' => 'Monday', + 'd_tuesday' => 'Tuesday', + 'd_wednesday' => 'Wednesday', + 'd_thursday' => 'Thursday', + 'd_friday' => 'Friday', + 'd_saturday' => 'Saturday', + 'd_sunday' => 'Sunday', + //example '' => '', ]; diff --git a/app/lang/pl.php b/app/lang/pl.php index 6759ada..9daf095 100644 --- a/app/lang/pl.php +++ b/app/lang/pl.php @@ -1,5 +1,5 @@ 'Home', 'm_dashboard' => 'Dashboard', diff --git a/app/templates/automation.phtml b/app/templates/automation.phtml index 4d1b50a..ee6c5eb 100644 --- a/app/templates/automation.phtml +++ b/app/templates/automation.phtml @@ -14,24 +14,24 @@ prepare('item','automation'); - $partial->prepare('lang',$LANG); + $partial->prepare('langMng',$LANGMNG); $partial->render(); ?>
Last Seen
+echo('l_lastSeen'); echo ' ' . $SUBDEVICE['lastRecort']['niceTime']; ?>
Time | -State | +echo('t_time');?> | +echo('t_state');?> |
---|