mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Different solution to use Nextcloud languages #1293
This commit is contained in:
parent
8984726fd7
commit
e56415aa51
5 changed files with 25 additions and 20 deletions
|
|
@ -35,8 +35,7 @@ class Application extends App implements IBootstrap
|
|||
'PageController', function($c) {
|
||||
return new PageController(
|
||||
$c->query('AppName'),
|
||||
$c->query('Request'),
|
||||
$c->query(IL10N::class)
|
||||
$c->query('Request')
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,24 +7,9 @@ use OCA\SnappyMail\ContentSecurityPolicy;
|
|||
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\IL10N;
|
||||
use OCP\IRequest;
|
||||
|
||||
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
|
||||
* @NoCSRFRequired
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue