Skip to content

Commit 8b7fff7

Browse files
authored
Merge pull request #14801 from nextcloud/fix/14793/fetch_right_translations
Fetch proper translations
2 parents 4ce191b + a7fb71f commit 8b7fff7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/private/Settings/Admin/Sharing.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use OCP\Constants;
3232
use OCP\IConfig;
3333
use OCP\IL10N;
34+
use OCP\L10N\IFactory;
3435
use OCP\Settings\ISettings;
3536
use OCP\Share\IManager;
3637
use OCP\Util;
@@ -48,9 +49,9 @@ class Sharing implements ISettings {
4849
/**
4950
* @param IConfig $config
5051
*/
51-
public function __construct(IConfig $config, IL10N $l, IManager $shareManager) {
52+
public function __construct(IConfig $config, IFactory $l, IManager $shareManager) {
5253
$this->config = $config;
53-
$this->l = $l;
54+
$this->l = $l->get('lib');
5455
$this->shareManager = $shareManager;
5556
}
5657

tests/lib/Settings/Admin/SharingTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use OCP\Constants;
2929
use OCP\IConfig;
3030
use OCP\IL10N;
31+
use OCP\L10N\IFactory;
3132
use OCP\Share\IManager;
3233
use Test\TestCase;
3334

@@ -45,11 +46,16 @@ public function setUp() {
4546
parent::setUp();
4647
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
4748
$this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
49+
50+
$l10Factory = $this->createMock(IFactory::class);
51+
$l10Factory->method('get')
52+
->willReturn($this->l10n);
53+
4854
$this->shareManager = $this->getMockBuilder(IManager::class)->getMock();
4955

5056
$this->admin = new Sharing(
5157
$this->config,
52-
$this->l10n,
58+
$l10Factory,
5359
$this->shareManager
5460
);
5561
}

0 commit comments

Comments
 (0)