diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-08-25 09:26:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-25 09:26:42 +0200 |
commit | 7e6f33df6f6ad375a04add0efb7408f45d3eba60 (patch) | |
tree | 0831193fbe0974c020e3168c5067225f8b53b430 | |
parent | 7657d9b9e8cc3ef539ac1d5c53970eb30cc60b48 (diff) | |
parent | 2d748c928e210b67acca74006c8fe554562a4466 (diff) | |
download | nextcloud-server-7e6f33df6f6ad375a04add0efb7408f45d3eba60.tar.gz nextcloud-server-7e6f33df6f6ad375a04add0efb7408f45d3eba60.zip |
Merge pull request #33683 from nextcloud/backport/33667/stable23
[stable23] Fix plural usage in LDAP wizard
-rw-r--r-- | apps/user_ldap/lib/Wizard.php | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index 6e0d6f80f8d..19d0d1e5c74 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; } |