diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-10-13 11:37:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 11:37:22 +0200 |
commit | 4cae2cc06cdaadb797ab6bedc6dc4da8b90f85c9 (patch) | |
tree | 281c9140c796806a99c591df619c11b1ec4e4fbd /apps | |
parent | e163d199d810562da8bc959bf8be843ddbeac118 (diff) | |
parent | 37f40cdd468a2826f6269bacc81ff74d8c606d23 (diff) | |
download | nextcloud-server-4cae2cc06cdaadb797ab6bedc6dc4da8b90f85c9.tar.gz nextcloud-server-4cae2cc06cdaadb797ab6bedc6dc4da8b90f85c9.zip |
Merge pull request #29004 from nextcloud/bugfix/noid/fix-translated-app-details
Fix translated app details
Diffstat (limited to 'apps')
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 2 | ||||
-rw-r--r-- | apps/updatenotification/lib/Controller/APIController.php | 34 | ||||
-rw-r--r-- | apps/updatenotification/lib/Notification/Notifier.php | 6 |
3 files changed, 26 insertions, 16 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index 270181e42d2..6d4bd4bae60 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -378,7 +378,7 @@ class ThemingController extends Controller { $startUrl = $this->urlGenerator->getBaseUrl(); $description = $this->themingDefaults->getSlogan(); } else { - $info = $this->appManager->getAppInfo($app); + $info = $this->appManager->getAppInfo($app, false, $this->l10n->getLanguageCode()); $name = $info['name'] . ' - ' . $this->themingDefaults->getName(); $shortName = $info['name']; if (strpos($this->request->getRequestUri(), '/index.php/') !== false) { diff --git a/apps/updatenotification/lib/Controller/APIController.php b/apps/updatenotification/lib/Controller/APIController.php index b4c304a6120..9d5d1c2d764 100644 --- a/apps/updatenotification/lib/Controller/APIController.php +++ b/apps/updatenotification/lib/Controller/APIController.php @@ -34,6 +34,8 @@ use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; use OCP\IConfig; use OCP\IRequest; +use OCP\IUserSession; +use OCP\L10N\IFactory; class APIController extends OCSController { @@ -46,23 +48,29 @@ class APIController extends OCSController { /** @var AppFetcher */ protected $appFetcher; - /** - * @param string $appName - * @param IRequest $request - * @param IConfig $config - * @param IAppManager $appManager - * @param AppFetcher $appFetcher - */ - public function __construct($appName, + /** @var IFactory */ + protected $l10nFactory; + + /** @var IUserSession */ + protected $userSession; + + /** @var string */ + protected $language; + + public function __construct(string $appName, IRequest $request, IConfig $config, IAppManager $appManager, - AppFetcher $appFetcher) { + AppFetcher $appFetcher, + IFactory $l10nFactory, + IUserSession $userSession) { parent::__construct($appName, $request); $this->config = $config; $this->appManager = $appManager; $this->appFetcher = $appFetcher; + $this->l10nFactory = $l10nFactory; + $this->userSession = $userSession; } /** @@ -97,7 +105,7 @@ class APIController extends OCSController { $this->appFetcher->setVersion($newVersion, 'future-apps.json', false); // Apps available on the app store for that version - $availableApps = array_map(function (array $app) { + $availableApps = array_map(static function (array $app) { return $app['id']; }, $this->appFetcher->get()); @@ -108,6 +116,8 @@ class APIController extends OCSController { ], Http::STATUS_NOT_FOUND); } + $this->language = $this->l10nFactory->getUserLanguage($this->userSession->getUser()); + $missing = array_diff($installedApps, $availableApps); $missing = array_map([$this, 'getAppDetails'], $missing); sort($missing); @@ -128,8 +138,8 @@ class APIController extends OCSController { * @param string $appId * @return string[] */ - protected function getAppDetails($appId): array { - $app = $this->appManager->getAppInfo($appId); + protected function getAppDetails(string $appId): array { + $app = $this->appManager->getAppInfo($appId, false, $this->language); return [ 'appId' => $appId, 'appName' => $app['name'] ?? $appId, diff --git a/apps/updatenotification/lib/Notification/Notifier.php b/apps/updatenotification/lib/Notification/Notifier.php index 787a43b2db8..bfbcc203480 100644 --- a/apps/updatenotification/lib/Notification/Notifier.php +++ b/apps/updatenotification/lib/Notification/Notifier.php @@ -134,7 +134,7 @@ class Notifier implements INotifier { $notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'overview']) . '#version'); } } else { - $appInfo = $this->getAppInfo($notification->getObjectType()); + $appInfo = $this->getAppInfo($notification->getObjectType(), $languageCode); $appName = ($appInfo === null) ? $notification->getObjectType() : $appInfo['name']; if (isset($this->appVersions[$notification->getObjectType()])) { @@ -194,7 +194,7 @@ class Notifier implements INotifier { return \OC_App::getAppVersions(); } - protected function getAppInfo($appId) { - return \OC_App::getAppInfo($appId); + protected function getAppInfo($appId, $languageCode) { + return \OC_App::getAppInfo($appId, false, $languageCode); } } |