From 85d94f72aa1646f4d76f9dd812ddb86fb6a845f4 Mon Sep 17 00:00:00 2001 From: Florin-Ciprian Bodin Date: Mon, 13 Nov 2023 06:09:11 +0200 Subject: [PATCH] Update Language.php to show also the language file with missing key --- classes/Language.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/classes/Language.php b/classes/Language.php index 8d71ad7..c59ac2f 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -1,9 +1,8 @@ __get('language'); + return $config->__get('language'); } /** @@ -132,13 +131,13 @@ class Language */ public function __construct() { - $lang_file = PATH_TO_LANGUAGES . $this -> get_current_lang() . LANGUAGE_FILE_EXT; - if (!@is_readable($lang_file)) + $this->lang_file = PATH_TO_LANGUAGES . $this->get_current_lang() . LANGUAGE_FILE_EXT; + if (!@is_readable($this->lang_file)) { throw new ExceptionFatal('Cannot read from language file: ' . Url::html_output($lang_file) . ''); } //load the file as a tab-separated object - $this -> translation_data = new ConfigData($lang_file); + $this->translation_data = new ConfigData($this->lang_file); } /** @@ -147,7 +146,7 @@ class Language */ public function is_set($name) { - return $this -> translation_data -> is_set($name); + return $this->translation_data->is_set($name); } /** @@ -156,12 +155,12 @@ class Language */ public function __get($var) { - if ($this -> translation_data -> is_set($var)) + if ($this->translation_data->is_set($var)) { - return $this -> translation_data -> __get($var); + return $this->translation_data->__get($var); } - throw new ExceptionDisplay('Variable ' . Url::html_output($var) . ' not set in Language file.'); + print('Variable ' . Url::html_output($var) . ' not set in Language file'. $this->lang_file . '.'); + throw new ExceptionDisplay('Variable ' . Url::html_output($var) . ' not set in Language file'. $this->lang_file . '.'); } } - -?> \ No newline at end of file +?>