diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index 8c01d660915..c1b77cd88a8 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -44,6 +44,7 @@ use OCA\Talk\Share\RoomShareProvider; use OCP\Defaults; use OCP\EventDispatcher\IEventDispatcher; use OCP\IServerContainer; +use OCP\L10N\IFactory; use OCP\Share\IManager; use OCP\Share\IProviderFactory; use OCP\Share\IShare; @@ -102,7 +103,7 @@ class ProviderFactory implements IProviderFactory { $this->serverContainer->getLazyRootFolder(), $this->serverContainer->getMailer(), $this->serverContainer->query(Defaults::class), - $this->serverContainer->getL10NFactory(), + $this->serverContainer->get(IFactory::class), $this->serverContainer->getURLGenerator(), $this->serverContainer->getConfig() ); diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 658a85152bf..6c3f97e66ff 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -53,6 +53,7 @@ use OCP\IConfig; use OCP\IInitialStateService; use OCP\INavigationManager; use OCP\IUserSession; +use OCP\L10N\IFactory; use OCP\Support\Subscription\IRegistry; use OCP\Util; @@ -126,7 +127,7 @@ class TemplateLayout extends \OC_Template { // Set default app name $defaultApp = \OC::$server->getAppManager()->getDefaultAppForUser(); $defaultAppInfo = \OC::$server->getAppManager()->getAppInfo($defaultApp); - $l10n = \OC::$server->getL10NFactory()->get($defaultApp); + $l10n = \OC::$server->get(IFactory::class)->get($defaultApp); $this->assign('defaultAppName', $l10n->t($defaultAppInfo['name'])); // Add navigation entry @@ -200,8 +201,8 @@ class TemplateLayout extends \OC_Template { parent::__construct('core', 'layout.base'); } // Send the language and the locale to our layouts - $lang = \OC::$server->getL10NFactory()->findLanguage(); - $locale = \OC::$server->getL10NFactory()->findLocale($lang); + $lang = \OC::$server->get(IFactory::class)->findLanguage(); + $locale = \OC::$server->get(IFactory::class)->findLocale($lang); $lang = str_replace('_', '-', $lang); $this->assign('language', $lang); diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 9d62c46137e..1d13f94e836 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -71,6 +71,7 @@ use OCP\IConfig; use OCP\IGroupManager; use OCP\IURLGenerator; use OCP\IUser; +use OCP\L10N\IFactory; use OCP\Share\IManager; use Psr\Log\LoggerInterface; @@ -184,7 +185,7 @@ class OC_Util { $logger = \OC::$server->get(LoggerInterface::class); $plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValueString('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton'); - $userLang = \OC::$server->getL10NFactory()->findLanguage(); + $userLang = \OC::$server->get(IFactory::class)->findLanguage(); $skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory); if (!file_exists($skeletonDirectory)) { @@ -403,7 +404,7 @@ class OC_Util { */ public static function addTranslations($application, $languageCode = null, $prepend = false) { if (is_null($languageCode)) { - $languageCode = \OC::$server->getL10NFactory()->findLanguage($application); + $languageCode = \OC::$server->get(IFactory::class)->findLanguage($application); } if (!empty($application)) { $path = "$application/l10n/$languageCode"; diff --git a/lib/public/Util.php b/lib/public/Util.php index bff8038b3dd..d6642daf864 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -48,6 +48,7 @@ namespace OCP; use OC\AppScriptDependency; use OC\AppScriptSort; +use OCP\L10N\IFactory; use bantu\IniGetWrapper\IniGetWrapper; use Psr\Container\ContainerExceptionInterface; @@ -235,7 +236,7 @@ class Util { */ public static function addTranslations($application, $languageCode = null) { if (is_null($languageCode)) { - $languageCode = \OC::$server->getL10NFactory()->findLanguage($application); + $languageCode = \OC::$server->get(IFactory::class)->findLanguage($application); } if (!empty($application)) { $path = "$application/l10n/$languageCode"; diff --git a/tests/lib/L10N/L10nTest.php b/tests/lib/L10N/L10nTest.php index bd1fce29547..21be2bbf395 100644 --- a/tests/lib/L10N/L10nTest.php +++ b/tests/lib/L10N/L10nTest.php @@ -15,6 +15,7 @@ use OCP\ICacheFactory; use OCP\IConfig; use OCP\IRequest; use OCP\IUserSession; +use OCP\L10N\IFactory; use Test\TestCase; /** @@ -218,7 +219,7 @@ class L10nTest extends TestCase { public function testFindLanguageFromLocale($locale, $language) { $this->assertEquals( $language, - \OC::$server->getL10NFactory()->findLanguageFromLocale('lib', $locale) + \OC::$server->get(IFactory::class)->findLanguageFromLocale('lib', $locale) ); }