summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-09-15 00:28:32 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-09-27 08:18:51 +0200
commit677003d1b6f1ebabab6cee32b96ccad8d70ee863 (patch)
tree51fa2d55d8f3bf5fc6aafaa28cde961925ca3220 /lib
parentf6d17da24eb003dde1deca0883fcc2692d87c3be (diff)
Add TZ & LANG
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/PageController.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index d0274101..4f4c722e 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -25,17 +25,29 @@ namespace OCA\Contacts\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IInitialStateService;
+use OCP\L10N\IFactory;
use OCP\IRequest;
class PageController extends Controller {
protected $appName;
+ /** @var IInitialStateService */
+ private $initialStateService;
+
+ /** @var IFactory */
+ private $languageFactory;
+
public function __construct(string $AppName,
- IRequest $request) {
+ IRequest $request,
+ IInitialStateService $initialStateService,
+ IFactory $languageFactory) {
parent::__construct($AppName, $request);
$this->appName = $AppName;
+ $this->initialStateService = $initialStateService;
+ $this->languageFactory = $languageFactory;
}
/**
@@ -45,6 +57,8 @@ class PageController extends Controller {
* Default routing
*/
public function index(): TemplateResponse {
+ $locales = $this->languageFactory->findAvailableLocales();
+ $this->initialStateService->provideInitialState($this->appName, 'locales', $locales);
return new TemplateResponse('contacts', 'main'); // templates/main.php
}
}