aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-05-21 22:25:11 +0200
committerMorris Jobke <hey@morrisjobke.de>2019-05-21 22:25:13 +0200
commit8c3c04596e72b49f1bbad388c51a1441c9061499 (patch)
tree537c5624d691699729a99b531561f81b28a78371 /lib
parentac92603014268a13a9b31beb8bd9dd26cbd84282 (diff)
downloadnextcloud-server-8c3c04596e72b49f1bbad388c51a1441c9061499.tar.gz
nextcloud-server-8c3c04596e72b49f1bbad388c51a1441c9061499.zip
Fix l10n for SettingsManager by injecting the l10n factory
Fixes #10832 Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Server.php2
-rw-r--r--lib/private/Settings/Manager.php16
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 942bef3b638..408b457ec39 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -1093,7 +1093,7 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('SettingsManager', function (Server $c) {
$manager = new \OC\Settings\Manager(
$c->getLogger(),
- $c->getL10N('lib'),
+ $c->getL10NFactory(),
$c->getURLGenerator(),
$c
);
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php
index 7281d7bf72e..982c2dba2ee 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -34,6 +34,7 @@ use OCP\IL10N;
use OCP\ILogger;
use OCP\IServerContainer;
use OCP\IURLGenerator;
+use OCP\L10N\IFactory;
use OCP\Settings\ISettings;
use OCP\Settings\IManager;
use OCP\Settings\ISection;
@@ -46,6 +47,9 @@ class Manager implements IManager {
/** @var IL10N */
private $l;
+ /** @var IFactory */
+ private $l10nFactory;
+
/** @var IURLGenerator */
private $url;
@@ -54,12 +58,12 @@ class Manager implements IManager {
public function __construct(
ILogger $log,
- IL10N $l10n,
+ IFactory $l10nFactory,
IURLGenerator $url,
IServerContainer $container
) {
$this->log = $log;
- $this->l = $l10n;
+ $this->l10nFactory = $l10nFactory;
$this->url = $url;
$this->container = $container;
}
@@ -190,6 +194,10 @@ class Manager implements IManager {
* @inheritdoc
*/
public function getAdminSections(): array {
+ if ($this->l === null) {
+ $this->l = $this->l10nFactory->get('lib');
+ }
+
// built-in sections
$sections = [
0 => [new Section('overview', $this->l->t('Overview'), 0, $this->url->imagePath('settings', 'admin.svg'))],
@@ -301,6 +309,10 @@ class Manager implements IManager {
* @inheritdoc
*/
public function getPersonalSections(): array {
+ if ($this->l === null) {
+ $this->l = $this->l10nFactory->get('lib');
+ }
+
$sections = [
0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))],
5 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('settings', 'password.svg'))],