From 6d91a3781ad26ac9aaefe5604bd3a566f714a9cb Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sat, 12 Sep 2026 17:37:17 +0200 Subject: [PATCH] feat(upgrade): localize app names if available on upgrade page This allows to use the localized app names set in appinfo.xml instead of showing the raw data of the serialized info.xml Signed-off-by: Thomas Citharel --- lib/OC.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/OC.php b/lib/OC.php index 251aa8b9a2bc1..e1e53d59af5e9 100644 --- a/lib/OC.php +++ b/lib/OC.php @@ -7,6 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ +use OC\App\InfoParser; use OC\Files\Filesystem; use OC\NavigationManager; use OC\Profiler\BuiltInProfiler; @@ -351,6 +352,9 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void { /** @var \OC\App\AppManager $appManager */ $appManager = Server::get(\OCP\App\IAppManager::class); + $l10nFactory = Server::get(\OCP\L10N\IFactory::class); + $infoParser = new InfoParser(); + $lang = $l10nFactory->findLanguage(); // get third party apps $ocVersion = $serverVersion->getVersion(); @@ -360,6 +364,7 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void { $incompatibleShippedApps = []; $incompatibleDisabledApps = []; foreach ($incompatibleApps as $appInfo) { + $appInfo = $infoParser->applyL10N($appInfo, $lang); if ($appManager->isShipped($appInfo['id'])) { $incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')'; } @@ -369,13 +374,14 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void { } if (!empty($incompatibleShippedApps)) { - $l = Server::get(\OCP\L10N\IFactory::class)->get('core'); + $l = $l10nFactory->get('core'); $hint = $l->t('Application %1$s is not present or has a non-compatible version with this server. Please check the apps directory.', [implode(', ', $incompatibleShippedApps)]); throw new \OCP\HintException('Application ' . implode(', ', $incompatibleShippedApps) . ' is not present or has a non-compatible version with this server. Please check the apps directory.', $hint); } $appConfig = Server::get(IAppConfig::class); - $appsToUpgrade = array_map(function ($app) use (&$appConfig) { + $appsToUpgrade = array_map(function ($app) use (&$appConfig, $infoParser, $lang) { + $app = $infoParser->applyL10N($app, $lang); return [ 'id' => $app['id'], 'name' => $app['name'],