[php-src] Issue #10759: gettext/ngettext() returns wrong translation
| From: | tdclaritum | Date: | Fri, 03 Mar 2023 13:00:26 +0000 |
| Subject: | [php-src] Issue #10759: gettext/ngettext() returns wrong translation | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243840@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10759
Author: tdclaritum
### Description
ngettext() returns wrong value in the following code
```php
<?php
bindtextdomain("default", __DIR__ . '/locale');
textdomain("default");
$locale = 'de_DE';
putenv('LC_ALL=' . $locale);
echo ngettext( '1 customer', '%1$s customers', 20 );
```
Resulted in this output:
```
1 Kunde
```
But I expected this output instead:
```
%1$s Kunden
```
I have attached an archive, that contains the test script and the required translation files -
[test.tar.gz](https://github.com/php/php-src/files/10882029/test.tar.gz)
### PHP Version
PHP 8.0.24
### Operating System
_No response_