diff --git a/webfiori/framework/ui/WebPage.php b/webfiori/framework/ui/WebPage.php index c4baf81f..87fcf4b3 100644 --- a/webfiori/framework/ui/WebPage.php +++ b/webfiori/framework/ui/WebPage.php @@ -12,6 +12,7 @@ use Error; use Exception; +use TypeError; use webfiori\collections\LinkedList; use webfiori\framework\App; use webfiori\framework\exceptions\MissingLangException; @@ -572,6 +573,11 @@ public function getTitleSep() : string { * */ public function getTranslation() : Lang { + + if (!$this->skipLangCheck && $this->tr === null) { + $this->usingLanguage(); + } + return $this->tr; } /** @@ -790,9 +796,14 @@ public function reset() { $this->setTitleSep(App::getConfig()->getTitleSeparator()); - $langObj = $this->getTranslation(); + try { + $langObj = $this->getTranslation(); + $this->contentDir = $langObj->getWritingDir(); + } catch (TypeError $ex) { + $this->contentDir = 'ltr'; + } - $this->contentDir = $langObj === null ? 'ltr' : $langObj->getWritingDir(); + $this->incFooter = true; $this->incHeader = true; @@ -1313,6 +1324,7 @@ private function usingLanguage() { if (!$this->skipLangCheck) { throw new MissingLangException($ex->getMessage()); } + return; } $pageLang = $this->getTranslation();