[php-src] Issue #8586: MessageFormatter seems to not translate correctly when having apostrophe before the translation key
| From: | andreisha | Date: | Fri, 20 May 2022 08:03:13 +0000 |
| Subject: | [php-src] Issue #8586: MessageFormatter seems to not translate correctly when having apostrophe before the translation key | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241548@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8586
Author: andreisha
### Description
Hello :) Thanks a lot for everything you do.
I came across this issue that seems like a bug to me. I looked if there were other similar bugs
opened but I didn't find one.
The following code:
```php
<?php
echo msgfmt_format(msgfmt_create("fr", "Name - '{name}' \n"),
["name" => "Martin"]);
echo msgfmt_format(msgfmt_create("fr", "Name - ''{name}''
\n"), ["name" => "Martin"]);
echo msgfmt_format(msgfmt_create("fr", "Name - ' {name} '"),
["name" => "Martin"]);
?>
```
Resulted in this output:
```
Name - {name}
Name - 'Martin'
Name - ' Martin '
```
But I expected this output instead:
```
Name - 'Martin'
Name - 'Martin'
Name - ' Martin '
```
Is this normal?
Thanks!
### PHP Version
8.1
### Operating System
_No response_