Skip to content

Commit

Permalink
Some changes for the-djmaze#1293
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Nov 20, 2023
1 parent 930be49 commit 8247357
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public function register(IRegistrationContext $context): void
'PageController', function($c) {
return new PageController(
$c->query('AppName'),
$c->query('Request')
$c->query('Request'),
$c->query(IL10N::class)
);
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
use OCP\IRequest;

class FetchController extends Controller {
private $config;
private $appManager;
private IConfig $config;
private IAppManager $appManager;
private IL10N $l;

public function __construct(string $appName, IRequest $request, IAppManager $appManager, IConfig $config, IL10N $l) {
parent::__construct($appName, $request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,24 @@

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
Expand Down

0 comments on commit 8247357

Please sign in to comment.