summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2022-08-23 10:11:04 +0200
committerGitHub <noreply@github.com>2022-08-23 10:11:04 +0200
commit73205a77ba9d6c6879bf3fc4c432c347efab2b99 (patch)
treec76274eee59d749fbb7701c1055ccd75ae68df5c /apps
parent5079bf6dd9df1240e88435b56e996b5cd8abde06 (diff)
parentf4885ee3ba0b97b50bb8bd3be5403d88690c4db5 (diff)
downloadnextcloud-server-73205a77ba9d6c6879bf3fc4c432c347efab2b99.tar.gz
nextcloud-server-73205a77ba9d6c6879bf3fc4c432c347efab2b99.zip
Merge pull request #33639 from nextcloud/bugfix/noid/fix-plural-usage-in-ldap
Fix plural usage in LDAP wizard
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/Wizard.php47
1 files changed, 20 insertions, 27 deletions
diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php
index ae9546be08b..e85e65a7d70 100644
--- a/apps/user_ldap/lib/Wizard.php
+++ b/apps/user_ldap/lib/Wizard.php
@@ -120,25 +120,11 @@ class Wizard extends LDAPUtility {
return (int)$result;
}
- /**
- * formats the return value of a count operation to the string to be
- * inserted.
- *
- * @param int $count
- * @return string
- */
- private function formatCountResult(int $count): string {
- if ($count > 1000) {
- return '> 1000';
- }
- return (string)$count;
- }
-
public function countGroups() {
$filter = $this->configuration->ldapGroupFilter;
if (empty($filter)) {
- $output = self::$l->n('%s group found', '%s groups found', 0, [0]);
+ $output = self::$l->n('%n group found', '%n groups found', 0);
$this->result->addChange('ldap_group_count', $output);
return $this->result;
}
@@ -152,12 +138,16 @@ class Wizard extends LDAPUtility {
}
return false;
}
- $output = self::$l->n(
- '%s group found',
- '%s groups found',
- $groupsTotal,
- [$this->formatCountResult($groupsTotal)]
- );
+
+ if ($groupsTotal > 1000) {
+ $output = self::$l->t('> 1000 groups found');
+ } else {
+ $output = self::$l->n(
+ '%n group found',
+ '%n groups found',
+ $groupsTotal
+ );
+ }
$this->result->addChange('ldap_group_count', $output);
return $this->result;
}
@@ -170,12 +160,15 @@ class Wizard extends LDAPUtility {
$filter = $this->access->getFilterForUserCount();
$usersTotal = $this->countEntries($filter, 'users');
- $output = self::$l->n(
- '%s user found',
- '%s users found',
- $usersTotal,
- [$this->formatCountResult($usersTotal)]
- );
+ if ($usersTotal > 1000) {
+ $output = self::$l->t('> 1000 users found');
+ } else {
+ $output = self::$l->n(
+ '%n user found',
+ '%n users found',
+ $usersTotal
+ );
+ }
$this->result->addChange('ldap_user_count', $output);
return $this->result;
}