diff options
author | Joas Schilling <coding@schilljs.com> | 2018-10-09 15:32:14 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-10-09 15:32:14 +0300 |
commit | ea21aa3f7a12c5d1bd80eea329de3eb695fde4e5 (patch) | |
tree | 7ff489b7990d01a699dbdf43d1b5ab0bc27b4916 /lib | |
parent | ea411ccec4095e155755b4edf76fd1490e509e5d (diff) |
Use numeric placeholders if there are multiple, so that RTL languages can operate better
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/App/DependencyAnalyzer.php | 10 | ||||
-rw-r--r-- | lib/private/Share/Share.php | 54 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 8 | ||||
-rw-r--r-- | lib/private/legacy/app.php | 2 | ||||
-rw-r--r-- | lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php | 2 |
5 files changed, 38 insertions, 38 deletions
diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index e8da5a0b63a..1e4d597dbc4 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -236,7 +236,7 @@ class DependencyAnalyzer { $libName = $this->getValue($lib); $libVersion = $this->platform->getLibraryVersion($libName); if (is_null($libVersion)) { - $missing[] = (string)$this->l->t('The library %s is not available.', [$libName]); + $missing[] = $this->l->t('The library %s is not available.', [$libName]); continue; } @@ -244,15 +244,15 @@ class DependencyAnalyzer { if (isset($lib['@attributes']['min-version'])) { $minVersion = $lib['@attributes']['min-version']; if ($this->compareSmaller($libVersion, $minVersion)) { - $missing[] = (string)$this->l->t('Library %s with a version higher than %s is required - available version %s.', - array($libName, $minVersion, $libVersion)); + $missing[] = $this->l->t('Library %1$s with a version higher than %2$s is required - available version %3$s.', + [$libName, $minVersion, $libVersion]); } } if (isset($lib['@attributes']['max-version'])) { $maxVersion = $lib['@attributes']['max-version']; if ($this->compareBigger($libVersion, $maxVersion)) { - $missing[] = (string)$this->l->t('Library %s with a version lower than %s is required - available version %s.', - array($libName, $maxVersion, $libVersion)); + $missing[] = $this->l->t('Library %1$s with a version lower than %2$s is required - available version %3$s.', + [$libName, $maxVersion, $libVersion]); } } } diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 0a9371d35b8..36912dcafe3 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -413,8 +413,8 @@ class Share extends Constants { throw new \Exception($message_t); } if (!\OC::$server->getUserManager()->userExists($shareWith)) { - $message = 'Sharing %s failed, because the user %s does not exist'; - $message_t = $l->t('Sharing %s failed, because the user %s does not exist', array($itemSourceName, $shareWith)); + $message = 'Sharing %1$s failed, because the user %2$s does not exist'; + $message_t = $l->t('Sharing %1$s failed, because the user %2$s does not exist', array($itemSourceName, $shareWith)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG); throw new \Exception($message_t); } @@ -433,9 +433,9 @@ class Share extends Constants { } $inGroup = array_intersect($groupsOwner, $groupsShareWith); if (empty($inGroup)) { - $message = 'Sharing %s failed, because the user ' - .'%s is not a member of any groups that %s is a member of'; - $message_t = $l->t('Sharing %s failed, because the user %s is not a member of any groups that %s is a member of', array($itemName, $shareWith, $uidOwner)); + $message = 'Sharing %1$s failed, because the user ' + .'%2$s is not a member of any groups that %3$s is a member of'; + $message_t = $l->t('Sharing %1$s failed, because the user %2$s is not a member of any groups that %3$s is a member of', array($itemName, $shareWith, $uidOwner)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemName, $shareWith, $uidOwner), ILogger::DEBUG); throw new \Exception($message_t); } @@ -447,8 +447,8 @@ class Share extends Constants { // owner and is not a user share, this use case is for increasing // permissions for a specific user if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) { - $message = 'Sharing %s failed, because this item is already shared with %s'; - $message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith)); + $message = 'Sharing %1$s failed, because this item is already shared with %2$s'; + $message_t = $l->t('Sharing %1$s failed, because this item is already shared with %2$s', array($itemSourceName, $shareWith)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG); throw new \Exception($message_t); } @@ -459,16 +459,16 @@ class Share extends Constants { // owner and is not a user share, this use case is for increasing // permissions for a specific user if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) { - $message = 'Sharing %s failed, because this item is already shared with user %s'; - $message_t = $l->t('Sharing %s failed, because this item is already shared with user %s', array($itemSourceName, $shareWith)); + $message = 'Sharing %1$s failed, because this item is already shared with user %2$s'; + $message_t = $l->t('Sharing %1$s failed, because this item is already shared with user %2$s', array($itemSourceName, $shareWith)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::ERROR); throw new \Exception($message_t); } } } else if ($shareType === self::SHARE_TYPE_GROUP) { if (!\OC::$server->getGroupManager()->groupExists($shareWith)) { - $message = 'Sharing %s failed, because the group %s does not exist'; - $message_t = $l->t('Sharing %s failed, because the group %s does not exist', array($itemSourceName, $shareWith)); + $message = 'Sharing %1$s failed, because the group %2$s does not exist'; + $message_t = $l->t('Sharing %1$s failed, because the group %2$s does not exist', array($itemSourceName, $shareWith)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG); throw new \Exception($message_t); } @@ -476,9 +476,9 @@ class Share extends Constants { $group = \OC::$server->getGroupManager()->get($shareWith); $user = \OC::$server->getUserManager()->get($uidOwner); if (!$group || !$user || !$group->inGroup($user)) { - $message = 'Sharing %s failed, because ' - . '%s is not a member of the group %s'; - $message_t = $l->t('Sharing %s failed, because %s is not a member of the group %s', array($itemSourceName, $uidOwner, $shareWith)); + $message = 'Sharing %1$s failed, because ' + . '%2$s is not a member of the group %3$s'; + $message_t = $l->t('Sharing %1$s failed, because %2$s is not a member of the group %3$s', array($itemSourceName, $uidOwner, $shareWith)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), ILogger::DEBUG); throw new \Exception($message_t); } @@ -489,8 +489,8 @@ class Share extends Constants { null, self::FORMAT_NONE, null, 1, true, true)) { if ($checkExists['share_with'] === $shareWith && $checkExists['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) { - $message = 'Sharing %s failed, because this item is already shared with %s'; - $message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith)); + $message = 'Sharing %1$s failed, because this item is already shared with %2$s'; + $message_t = $l->t('Sharing %1$s failed, because this item is already shared with %2$s', array($itemSourceName, $shareWith)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG); throw new \Exception($message_t); } @@ -595,8 +595,8 @@ class Share extends Constants { */ if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_REMOTE, $shareWith, $uidOwner, self::FORMAT_NONE, null, 1, true, true)) { - $message = 'Sharing %s failed, because this item is already shared with %s'; - $message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith)); + $message = 'Sharing %1$s failed, because this item is already shared with %2$s'; + $message_t = $l->t('Sharing %1$s failed, because this item is already shared with %2$s', array($itemSourceName, $shareWith)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG); throw new \Exception($message_t); } @@ -626,15 +626,15 @@ class Share extends Constants { if ($send === false) { $currentUser = \OC::$server->getUserSession()->getUser()->getUID(); self::unshare($itemType, $itemSource, $shareType, $shareWith, $currentUser); - $message_t = $l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable.', array($itemSourceName, $shareWith)); + $message_t = $l->t('Sharing %1$s failed, could not find %2$s, maybe the server is currently unreachable.', array($itemSourceName, $shareWith)); throw new \Exception($message_t); } return $send; } else { // Future share types need to include their own conditions - $message = 'Share type %s is not valid for %s'; - $message_t = $l->t('Share type %s is not valid for %s', array($shareType, $itemSource)); + $message = 'Share type %1$s is not valid for %2$s'; + $message_t = $l->t('Share type %1$s is not valid for %2$s', array($shareType, $itemSource)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $shareType, $itemSource), ILogger::DEBUG); throw new \Exception($message_t); } @@ -1666,7 +1666,7 @@ class Share extends Constants { if ($checkReshare) { // Check if attempting to share back to owner if ($checkReshare['uid_owner'] == $shareWith && $shareType == self::SHARE_TYPE_USER) { - $message = 'Sharing %s failed, because the user %s is the original sharer'; + $message = 'Sharing %1$s failed, because the user %2$s is the original sharer'; $message_t = $l->t('Sharing failed, because the user %s is the original sharer', [$shareWith]); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), ILogger::DEBUG); @@ -1678,8 +1678,8 @@ class Share extends Constants { // Check if share permissions is granted if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) { if (~(int)$checkReshare['permissions'] & $permissions) { - $message = 'Sharing %s failed, because the permissions exceed permissions granted to %s'; - $message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner)); + $message = 'Sharing %1$s failed, because the permissions exceed permissions granted to %2$s'; + $message_t = $l->t('Sharing %1$s failed, because the permissions exceed permissions granted to %2$s', array($itemSourceName, $uidOwner)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), ILogger::DEBUG); throw new \Exception($message_t); @@ -1723,9 +1723,9 @@ class Share extends Constants { $result['itemSource'] = $itemSource; $result['expirationDate'] = $expirationDate; if (!$backend->isValidSource($itemSource, $uidOwner)) { - $message = 'Sharing %s failed, because the sharing backend for ' - .'%s could not find its source'; - $message_t = $l->t('Sharing %s failed, because the sharing backend for %s could not find its source', array($itemSource, $itemType)); + $message = 'Sharing %1$s failed, because the sharing backend for ' + .'%2$s could not find its source'; + $message_t = $l->t('Sharing %1$s failed, because the sharing backend for %2$s could not find its source', array($itemSource, $itemType)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource, $itemType), ILogger::DEBUG); throw new \Exception($message_t); } diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 9497b2c2637..e76269f9d86 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -735,10 +735,10 @@ class Manager implements IManager { 'shareWith' => $shareWith, ]); - $emailTemplate->setSubject($l->t('%s shared »%s« with you', array($initiatorDisplayName, $filename))); + $emailTemplate->setSubject($l->t('%1$s shared »%2$s« with you', array($initiatorDisplayName, $filename))); $emailTemplate->addHeader(); - $emailTemplate->addHeading($l->t('%s shared »%s« with you', [$initiatorDisplayName, $filename]), false); - $text = $l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]); + $emailTemplate->addHeading($l->t('%1$s shared »%2$s« with you', [$initiatorDisplayName, $filename]), false); + $text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); $emailTemplate->addBodyText( htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')), @@ -754,7 +754,7 @@ class Manager implements IManager { // The "From" contains the sharers name $instanceName = $this->defaults->getName(); $senderName = $l->t( - '%s via %s', + '%1$s via %2$s', [ $initiatorDisplayName, $instanceName diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 9c7e6001e5e..4cab92eba64 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -1096,7 +1096,7 @@ class OC_App { if (!empty($missing)) { $missingMsg = implode(PHP_EOL, $missing); throw new \Exception( - $l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s', + $l->t('App "%1$s" cannot be installed because the following dependencies are not fulfilled: %2$s', [$info['name'], $missingMsg] ) ); diff --git a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php index 844d33453f9..60c5b73659a 100644 --- a/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php +++ b/lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php @@ -43,7 +43,7 @@ class ProviderAlreadyExistsException extends HintException { public function __construct($newProviderId, $existingProviderName) { $l = \OC::$server->getL10N('federation'); $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; - $hint = $l->t('ID "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); + $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); parent::__construct($message, $hint); } |