Basic locale switcher
This commit is contained in:
parent
e64bb9b9f5
commit
b4dd0aeb29
7 changed files with 135 additions and 10 deletions
|
@ -78,6 +78,7 @@ class FrontController
|
|||
$this->download = new VideoDownload();
|
||||
$this->container = $container;
|
||||
$this->view = $this->container->get('view');
|
||||
$this->locale = $this->container->get('locale');
|
||||
$session_factory = new \Aura\Session\SessionFactory();
|
||||
$session = $session_factory->newInstance($cookies);
|
||||
$this->sessionSegment = $session->getSegment('Alltube\Controller\FrontController');
|
||||
|
@ -106,12 +107,30 @@ class FrontController
|
|||
'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.',
|
||||
'domain' => $uri->getScheme().'://'.$uri->getAuthority(),
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'locales' => $this->locale->getSupportedLocales(),
|
||||
'locale' => $this->locale->getLocale(),
|
||||
]
|
||||
);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch locale.
|
||||
*
|
||||
* @param Request $request PSR-7 request
|
||||
* @param Response $response PSR-7 response
|
||||
* @param array $data Query parameters
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function locale(Request $request, Response $response, array $data)
|
||||
{
|
||||
$this->locale->setLocale($data['locale']);
|
||||
|
||||
return $response->withRedirect($this->container->get('router')->pathFor('index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a list of extractors.
|
||||
*
|
||||
|
@ -132,6 +151,7 @@ class FrontController
|
|||
'description' => 'List of all supported websites from which Alltube Download '.
|
||||
'can extract video or audio files',
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'locale' => $this->locale->getLocale(),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -156,6 +176,7 @@ class FrontController
|
|||
'title' => 'Password prompt',
|
||||
'description' => 'You need a password in order to download this video with Alltube Download',
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'locale' => $this->locale->getLocale(),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -246,6 +267,7 @@ class FrontController
|
|||
'protocol' => $protocol,
|
||||
'config' => $this->config,
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'locale' => $this->locale->getLocale(),
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -297,6 +319,7 @@ class FrontController
|
|||
'class' => 'video',
|
||||
'title' => 'Error',
|
||||
'canonical' => $this->getCanonicalUrl($request),
|
||||
'locale' => $this->locale->getLocale(),
|
||||
]
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue