Skip to content

Commit b600c70

Browse files
committed
chore: Replace OC::$server->getL10N by OCP\Util::getL10N in lib and some apps
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent 0a971c5 commit b600c70

17 files changed

Lines changed: 26 additions & 26 deletions

File tree

apps/files/lib/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Helper {
4848
public static function buildFileStorageStatistics($dir) {
4949
// information about storage capacities
5050
$storageInfo = \OC_Helper::getStorageInfo($dir);
51-
$l = \OC::$server->getL10N('files');
51+
$l = \OCP\Util::getL10N('files');
5252
$maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);
5353
$maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize);
5454
$maxHumanFileSize = $l->t('Upload (max. %s)', [$maxHumanFileSize]);

apps/files_external/lib/MountConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public static function getBackendStatus($class, $options, $isPersonal, $testOnly
152152
* @param Backend[] $backends
153153
*/
154154
public static function dependencyMessage(array $backends): string {
155-
$l = \OC::$server->getL10N('files_external');
155+
$l = \OCP\Util::getL10N('files_external');
156156
$message = '';
157157
$dependencyGroups = [];
158158

apps/files_trashbin/lib/Trashbin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ private static function getVersionsFromTrash($filename, $timestamp, string $user
10691069
private static function getUniqueFilename($location, $filename, View $view) {
10701070
$ext = pathinfo($filename, PATHINFO_EXTENSION);
10711071
$name = pathinfo($filename, PATHINFO_FILENAME);
1072-
$l = \OC::$server->getL10N('files_trashbin');
1072+
$l = \OCP\Util::getL10N('files_trashbin');
10731073

10741074
$location = '/' . trim($location, '/');
10751075

apps/user_ldap/ajax/clearMappings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function ($uid) {
5050
}
5151

5252
if ($mapping === null || !$result) {
53-
$l = \OC::$server->getL10N('user_ldap');
53+
$l = \OCP\Util::getL10N('user_ldap');
5454
throw new \Exception($l->t('Failed to clear the mappings.'));
5555
}
5656
\OC_JSON::success();

apps/user_ldap/ajax/deleteConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@
3535
if ($helper->deleteServerConfiguration($prefix)) {
3636
\OC_JSON::success();
3737
} else {
38-
$l = \OC::$server->getL10N('user_ldap');
38+
$l = \OCP\Util::getL10N('user_ldap');
3939
\OC_JSON::error(['message' => $l->t('Failed to delete the server configuration')]);
4040
}

apps/user_ldap/ajax/testConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
\OC_JSON::checkAppEnabled('user_ldap');
3131
\OC_JSON::callCheck();
3232

33-
$l = \OC::$server->getL10N('user_ldap');
33+
$l = \OCP\Util::getL10N('user_ldap');
3434

3535
$ldapWrapper = new OCA\User_LDAP\LDAP();
3636
$connection = new \OCA\User_LDAP\Connection($ldapWrapper, $_POST['ldap_serverconfig_chooser']);

apps/user_ldap/ajax/wizard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
\OC_JSON::checkAppEnabled('user_ldap');
3232
\OC_JSON::callCheck();
3333

34-
$l = \OC::$server->getL10N('user_ldap');
34+
$l = \OCP\Util::getL10N('user_ldap');
3535

3636
if (!isset($_POST['action'])) {
3737
\OC_JSON::error(['message' => $l->t('No action specified')]);

apps/user_ldap/lib/Access.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public function setPassword($userDN, $password) {
354354
return @$this->invokeLDAPMethod('exopPasswd', $userDN, '', $password) ||
355355
@$this->invokeLDAPMethod('modReplace', $userDN, $password);
356356
} catch (ConstraintViolationException $e) {
357-
throw new HintException('Password change rejected.', \OC::$server->getL10N('user_ldap')->t('Password change rejected. Hint: ') . $e->getMessage(), (int)$e->getCode());
357+
throw new HintException('Password change rejected.', \OCP\Util::getL10N('user_ldap')->t('Password change rejected. Hint: ') . $e->getMessage(), (int)$e->getCode());
358358
}
359359
}
360360

core/strings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
*/
2727
//some strings that are used in /lib but won't be translatable unless they are in /core too
28-
$l = \OC::$server->getL10N('core');
28+
$l = \OCP\Util::getL10N('core');
2929
$l->t("Personal");
3030
$l->t("Users");
3131
$l->t("Apps");

lib/private/Files/View.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,19 +1846,19 @@ public function verifyPath($path, $fileName): void {
18461846
[$storage, $internalPath] = $this->resolvePath($path);
18471847
$storage->verifyPath($internalPath, $fileName);
18481848
} catch (ReservedWordException $ex) {
1849-
$l = \OC::$server->getL10N('lib');
1849+
$l = \OCP\Util::getL10N('lib');
18501850
throw new InvalidPathException($l->t('File name is a reserved word'));
18511851
} catch (InvalidCharacterInPathException $ex) {
1852-
$l = \OC::$server->getL10N('lib');
1852+
$l = \OCP\Util::getL10N('lib');
18531853
throw new InvalidPathException($l->t('File name contains at least one invalid character'));
18541854
} catch (FileNameTooLongException $ex) {
1855-
$l = \OC::$server->getL10N('lib');
1855+
$l = \OCP\Util::getL10N('lib');
18561856
throw new InvalidPathException($l->t('File name is too long'));
18571857
} catch (InvalidDirectoryException $ex) {
1858-
$l = \OC::$server->getL10N('lib');
1858+
$l = \OCP\Util::getL10N('lib');
18591859
throw new InvalidPathException($l->t('Dot files are not allowed'));
18601860
} catch (EmptyFileNameException $ex) {
1861-
$l = \OC::$server->getL10N('lib');
1861+
$l = \OCP\Util::getL10N('lib');
18621862
throw new InvalidPathException($l->t('Empty filename is not allowed'));
18631863
}
18641864
}

0 commit comments

Comments
 (0)