aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-09-26 10:42:38 +0200
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-02-05 11:16:04 +0100
commit1332078be1643e51caf2aa8104d92d2fdd773e80 (patch)
treef71c6bfc17017645c7cf7d90f5189dba6d16f28b /lib
parent062ca546ee23222137613696606ed54364c48888 (diff)
downloadnextcloud-server-1332078be1643e51caf2aa8104d92d2fdd773e80.tar.gz
nextcloud-server-1332078be1643e51caf2aa8104d92d2fdd773e80.zip
Use OCP\Util::getL10N instead of OC::$server->getL10N
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Server.php2
-rw-r--r--lib/public/Federation/Exceptions/ActionNotSupportedException.php2
-rw-r--r--lib/public/Federation/Exceptions/AuthenticationFailedException.php2
-rw-r--r--lib/public/Federation/Exceptions/BadRequestException.php2
-rw-r--r--lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php2
-rw-r--r--lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php2
-rw-r--r--lib/public/Files/LockNotAcquiredException.php2
-rw-r--r--lib/public/Files/StorageAuthException.php2
-rw-r--r--lib/public/Files/StorageBadConfigException.php2
-rw-r--r--lib/public/Files/StorageConnectionException.php2
-rw-r--r--lib/public/Files/StorageNotAvailableException.php2
-rw-r--r--lib/public/Files/StorageTimeoutException.php2
-rw-r--r--lib/public/Util.php7
13 files changed, 14 insertions, 17 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index d8fa900c0af..2e36d677164 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -1724,7 +1724,7 @@ class Server extends ServerContainer implements IServerContainer {
* @param string $app appid
* @param string $lang
* @return IL10N
- * @deprecated 20.0.0
+ * @deprecated 20.0.0 use \OCP\Util::getL10N instead
*/
public function getL10N($app, $lang = null) {
return $this->get(IFactory::class)->get($app, $lang);
diff --git a/lib/public/Federation/Exceptions/ActionNotSupportedException.php b/lib/public/Federation/Exceptions/ActionNotSupportedException.php
index e5f8d50fd99..a7dcda15fe5 100644
--- a/lib/public/Federation/Exceptions/ActionNotSupportedException.php
+++ b/lib/public/Federation/Exceptions/ActionNotSupportedException.php
@@ -38,7 +38,7 @@ class ActionNotSupportedException extends HintException {
*
*/
public function __construct($action) {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$message = 'Action "' . $action . '" not supported or implemented.';
$hint = $l->t('Action "%s" not supported or implemented.', [$action]);
parent::__construct($message, $hint);
diff --git a/lib/public/Federation/Exceptions/AuthenticationFailedException.php b/lib/public/Federation/Exceptions/AuthenticationFailedException.php
index 2bd3e361edd..63c8f63ab85 100644
--- a/lib/public/Federation/Exceptions/AuthenticationFailedException.php
+++ b/lib/public/Federation/Exceptions/AuthenticationFailedException.php
@@ -38,7 +38,7 @@ class AuthenticationFailedException extends HintException {
*
*/
public function __construct() {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$message = 'Authentication failed, wrong token or provider ID given';
$hint = $l->t('Authentication failed, wrong token or provider ID given');
parent::__construct($message, $hint);
diff --git a/lib/public/Federation/Exceptions/BadRequestException.php b/lib/public/Federation/Exceptions/BadRequestException.php
index bc8b5c7b724..fbd781aee43 100644
--- a/lib/public/Federation/Exceptions/BadRequestException.php
+++ b/lib/public/Federation/Exceptions/BadRequestException.php
@@ -45,7 +45,7 @@ class BadRequestException extends HintException {
* @param array $missingParameters
*/
public function __construct(array $missingParameters) {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$this->parameterList = $missingParameters;
$parameterList = implode(',', $missingParameters);
$message = 'Parameters missing in order to complete the request. Missing Parameters: ' . $parameterList;
diff --git a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
index d30d81eca27..cb0a8e8d51f 100644
--- a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
+++ b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php
@@ -42,7 +42,7 @@ class ProviderAlreadyExistsException extends HintException {
* @param string $existingProviderName name of cloud federation provider which already use the same ID
*/
public function __construct($newProviderId, $existingProviderName) {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
$hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]);
parent::__construct($message, $hint);
diff --git a/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
index 849209da22d..0594bb6875b 100644
--- a/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
+++ b/lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php
@@ -39,7 +39,7 @@ class ProviderDoesNotExistsException extends HintException {
* @param string $providerId cloud federation provider ID
*/
public function __construct($providerId) {
- $l = \OC::$server->getL10N('federation');
+ $l = \OCP\Util::getL10N('federation');
$message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
$hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
parent::__construct($message, $hint);
diff --git a/lib/public/Files/LockNotAcquiredException.php b/lib/public/Files/LockNotAcquiredException.php
index 4a26878cedf..2cf8ea20acf 100644
--- a/lib/public/Files/LockNotAcquiredException.php
+++ b/lib/public/Files/LockNotAcquiredException.php
@@ -43,7 +43,7 @@ class LockNotAcquiredException extends \Exception {
* @since 7.0.0
*/
public function __construct($path, $lockType, $code = 0, \Exception $previous = null) {
- $message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', [$lockType, $path]);
+ $message = \OCP\Util::getL10N('core')->t('Could not obtain lock type %d on "%s".', [$lockType, $path]);
parent::__construct($message, $code, $previous);
}
diff --git a/lib/public/Files/StorageAuthException.php b/lib/public/Files/StorageAuthException.php
index 5fce191b57e..bc39f8e27f5 100644
--- a/lib/public/Files/StorageAuthException.php
+++ b/lib/public/Files/StorageAuthException.php
@@ -36,7 +36,7 @@ class StorageAuthException extends StorageNotAvailableException {
* @since 9.0.0
*/
public function __construct($message = '', \Exception $previous = null) {
- $l = \OC::$server->getL10N('core');
+ $l = \OCP\Util::getL10N('core');
parent::__construct($l->t('Storage unauthorized. %s', [$message]), self::STATUS_UNAUTHORIZED, $previous);
}
}
diff --git a/lib/public/Files/StorageBadConfigException.php b/lib/public/Files/StorageBadConfigException.php
index 0e16a24daa8..36d7329d4b5 100644
--- a/lib/public/Files/StorageBadConfigException.php
+++ b/lib/public/Files/StorageBadConfigException.php
@@ -36,7 +36,7 @@ class StorageBadConfigException extends StorageNotAvailableException {
* @since 9.0.0
*/
public function __construct($message = '', \Exception $previous = null) {
- $l = \OC::$server->getL10N('core');
+ $l = \OCP\Util::getL10N('core');
parent::__construct($l->t('Storage incomplete configuration. %s', [$message]), self::STATUS_INCOMPLETE_CONF, $previous);
}
}
diff --git a/lib/public/Files/StorageConnectionException.php b/lib/public/Files/StorageConnectionException.php
index 9113faf72a1..d29398172e6 100644
--- a/lib/public/Files/StorageConnectionException.php
+++ b/lib/public/Files/StorageConnectionException.php
@@ -36,7 +36,7 @@ class StorageConnectionException extends StorageNotAvailableException {
* @since 9.0.0
*/
public function __construct($message = '', \Exception $previous = null) {
- $l = \OC::$server->getL10N('core');
+ $l = \OCP\Util::getL10N('core');
parent::__construct($l->t('Storage connection error. %s', [$message]), self::STATUS_NETWORK_ERROR, $previous);
}
}
diff --git a/lib/public/Files/StorageNotAvailableException.php b/lib/public/Files/StorageNotAvailableException.php
index f600ef80808..c205d6b9c44 100644
--- a/lib/public/Files/StorageNotAvailableException.php
+++ b/lib/public/Files/StorageNotAvailableException.php
@@ -56,7 +56,7 @@ class StorageNotAvailableException extends HintException {
* @since 6.0.0
*/
public function __construct($message = '', $code = self::STATUS_ERROR, \Exception $previous = null) {
- $l = \OC::$server->getL10N('core');
+ $l = \OCP\Util::getL10N('core');
parent::__construct($message, $l->t('Storage is temporarily not available'), $code, $previous);
}
diff --git a/lib/public/Files/StorageTimeoutException.php b/lib/public/Files/StorageTimeoutException.php
index bad88ad35e0..c20711d4181 100644
--- a/lib/public/Files/StorageTimeoutException.php
+++ b/lib/public/Files/StorageTimeoutException.php
@@ -36,7 +36,7 @@ class StorageTimeoutException extends StorageNotAvailableException {
* @since 9.0.0
*/
public function __construct($message = '', \Exception $previous = null) {
- $l = \OC::$server->getL10N('core');
+ $l = \OCP\Util::getL10N('core');
parent::__construct($l->t('Storage connection timeout. %s', [$message]), self::STATUS_TIMEOUT, $previous);
}
}
diff --git a/lib/public/Util.php b/lib/public/Util.php
index 6322ab56a88..4009237db5d 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -126,13 +126,10 @@ class Util {
/**
* get l10n object
- * @param string $application
- * @param string|null $language
- * @return \OCP\IL10N
* @since 6.0.0 - parameter $language was added in 8.0.0
*/
- public static function getL10N($application, $language = null) {
- return \OC::$server->getL10N($application, $language);
+ public static function getL10N(string $application, ?string $language = null): IL10N {
+ return Server::get(\OCP\L10N\IFactory::class)->get($application, $language);
}
/**