continue with getter/setter removal

This commit is contained in:
Dennis Eichhorn 2023-05-30 04:15:40 +02:00
parent fc496460f5
commit 322ef97d0f
3 changed files with 16 additions and 16 deletions

View File

@ -154,7 +154,7 @@ final class Application
if ($account->id > 0) { if ($account->id > 0) {
$response->header->l11n = $account->l11n; $response->header->l11n = $account->l11n;
} elseif ($this->app->sessionManager->get('language') !== null } elseif ($this->app->sessionManager->get('language') !== null
&& $response->header->l11n->getLanguage() !== $this->app->sessionManager->get('language') && $response->header->l11n->language !== $this->app->sessionManager->get('language')
) { ) {
$response->header->l11n $response->header->l11n
->loadFromLanguage( ->loadFromLanguage(
@ -165,7 +165,7 @@ final class Application
$this->app->setResponseLanguage($request, $response, $this->config); $this->app->setResponseLanguage($request, $response, $this->config);
} }
if (!\in_array($response->getLanguage(), $this->config['language'])) { if (!\in_array($response->header->l11n->language, $this->config['language'])) {
$response->header->l11n->setLanguage($this->app->l11nServer->getLanguage()); $response->header->l11n->setLanguage($this->app->l11nServer->getLanguage());
} }
@ -190,14 +190,14 @@ final class Application
return; return;
} }
UriFactory::setQuery('/lang', $response->getLanguage()); UriFactory::setQuery('/lang', $response->header->l11n->language);
$this->loadLanguageFromPath( $this->loadLanguageFromPath(
$response->getLanguage(), $response->header->l11n->language,
__DIR__ . '/lang/' . $response->getLanguage() . '.lang.php' __DIR__ . '/lang/' . $response->header->l11n->language . '.lang.php'
); );
$response->header->set('content-language', $response->getLanguage(), true); $response->header->set('content-language', $response->header->l11n->language, true);
/* Create html head */ /* Create html head */
$this->initResponseHead($head, $request, $response); $this->initResponseHead($head, $request, $response);
@ -255,8 +255,8 @@ final class Application
$response->header->status = RequestStatusCode::R_406; $response->header->status = RequestStatusCode::R_406;
$pageView->setTemplate('/Web/{APPNAME}/Error/406'); $pageView->setTemplate('/Web/{APPNAME}/Error/406');
$this->loadLanguageFromPath( $this->loadLanguageFromPath(
$response->getLanguage(), $response->header->l11n->language,
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php'
); );
} }
@ -275,8 +275,8 @@ final class Application
$response->header->status = RequestStatusCode::R_503; $response->header->status = RequestStatusCode::R_503;
$pageView->setTemplate('/Web/{APPNAME}/Error/503'); $pageView->setTemplate('/Web/{APPNAME}/Error/503');
$this->loadLanguageFromPath( $this->loadLanguageFromPath(
$response->getLanguage(), $response->header->l11n->language,
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php'
); );
} }
@ -334,8 +334,8 @@ final class Application
$response->header->status = RequestStatusCode::R_403; $response->header->status = RequestStatusCode::R_403;
$pageView->setTemplate('/Web/{APPNAME}/Error/403'); $pageView->setTemplate('/Web/{APPNAME}/Error/403');
$this->loadLanguageFromPath( $this->loadLanguageFromPath(
$response->getLanguage(), $response->header->l11n->language,
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php'
); );
} }

View File

@ -22,7 +22,7 @@ $head = $this->getData('head');
$dispatch = $this->getData('dispatch') ?? []; $dispatch = $this->getData('dispatch') ?? [];
?> ?>
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html lang="<?= $this->printHtml($this->response->getLanguage()); ?>"> <html lang="<?= $this->printHtml($this->response->header->l11n->language); ?>">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -80,8 +80,8 @@ final class BackendController extends Controller
->with('answers/votes') ->with('answers/votes')
->with('tags') ->with('tags')
->with('tags/title') ->with('tags/title')
->where('tags/title/language', $response->getLanguage()) ->where('tags/title/language', $response->header->l11n->language)
->where('language', $response->getLanguage()) ->where('language', $response->header->l11n->language)
->limit(50)->execute(); ->limit(50)->execute();
$view->setData('questions', $list); $view->setData('questions', $list);
@ -124,7 +124,7 @@ final class BackendController extends Controller
->with('tags/title') ->with('tags/title')
->with('media') ->with('media')
->where('id', (int) $request->getData('id')) ->where('id', (int) $request->getData('id'))
->where('tags/title/language', $response->getLanguage()) ->where('tags/title/language', $response->header->l11n->language)
->execute(); ->execute();
$view->addData('question', $question); $view->addData('question', $question);