Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): Fix to Bug In Web Page Initialization #215

Merged
merged 2 commits into from
Mar 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions webfiori/framework/ui/WebPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Error;
use Exception;
use TypeError;
use webfiori\collections\LinkedList;
use webfiori\framework\App;
use webfiori\framework\exceptions\MissingLangException;
Expand Down Expand Up @@ -572,6 +573,11 @@
*
*/
public function getTranslation() : Lang {

if (!$this->skipLangCheck && $this->tr === null) {
$this->usingLanguage();

Check warning on line 578 in webfiori/framework/ui/WebPage.php

View check run for this annotation

Codecov / codecov/patch

webfiori/framework/ui/WebPage.php#L578

Added line #L578 was not covered by tests
}

return $this->tr;
}
/**
Expand Down Expand Up @@ -790,9 +796,14 @@

$this->setTitleSep(App::getConfig()->getTitleSeparator());

$langObj = $this->getTranslation();
try {

Check warning on line 799 in webfiori/framework/ui/WebPage.php

View check run for this annotation

Codecov / codecov/patch

webfiori/framework/ui/WebPage.php#L799

Added line #L799 was not covered by tests
$langObj = $this->getTranslation();
$this->contentDir = $langObj->getWritingDir();
} catch (TypeError $ex) {
$this->contentDir = 'ltr';

Check warning on line 803 in webfiori/framework/ui/WebPage.php

View check run for this annotation

Codecov / codecov/patch

webfiori/framework/ui/WebPage.php#L802-L803

Added lines #L802 - L803 were not covered by tests
}

$this->contentDir = $langObj === null ? 'ltr' : $langObj->getWritingDir();


$this->incFooter = true;
$this->incHeader = true;
Expand Down Expand Up @@ -1313,6 +1324,7 @@
if (!$this->skipLangCheck) {
throw new MissingLangException($ex->getMessage());
}
return;

Check warning on line 1327 in webfiori/framework/ui/WebPage.php

View check run for this annotation

Codecov / codecov/patch

webfiori/framework/ui/WebPage.php#L1327

Added line #L1327 was not covered by tests
}
$pageLang = $this->getTranslation();

Expand Down
Loading