mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Some changes for #1293
This commit is contained in:
parent
930be49775
commit
8247357184
3 changed files with 20 additions and 3 deletions
|
|
@ -34,7 +34,8 @@ class Application extends App implements IBootstrap
|
||||||
'PageController', function($c) {
|
'PageController', function($c) {
|
||||||
return new PageController(
|
return new PageController(
|
||||||
$c->query('AppName'),
|
$c->query('AppName'),
|
||||||
$c->query('Request')
|
$c->query('Request'),
|
||||||
|
$c->query(IL10N::class)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,9 @@ use OCP\IL10N;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class FetchController extends Controller {
|
class FetchController extends Controller {
|
||||||
private $config;
|
private IConfig $config;
|
||||||
private $appManager;
|
private IAppManager $appManager;
|
||||||
|
private IL10N $l;
|
||||||
|
|
||||||
public function __construct(string $appName, IRequest $request, IAppManager $appManager, IConfig $config, IL10N $l) {
|
public function __construct(string $appName, IRequest $request, IAppManager $appManager, IConfig $config, IL10N $l) {
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,24 @@ use OCA\SnappyMail\ContentSecurityPolicy;
|
||||||
|
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
|
use OCP\IL10N;
|
||||||
|
use OCP\IRequest;
|
||||||
|
|
||||||
class PageController extends Controller
|
class PageController extends Controller
|
||||||
{
|
{
|
||||||
|
// private IL10N $l;
|
||||||
|
|
||||||
|
public function __construct(string $appName, IRequest $request, IL10N $l) {
|
||||||
|
parent::__construct($appName, $request);
|
||||||
|
// $this->l = $l;
|
||||||
|
$lang = \strtolower(\str_replace('_', '-', $l->getLocaleCode()));
|
||||||
|
if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||||
|
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = $lang;
|
||||||
|
} else {
|
||||||
|
$_SERVER['HTTP_ACCEPT_LANGUAGE'] .= ",{$lang};q=2";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue