Skip to content

Commit 4aba290

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: [Translation] Add intl-icu fallback for MessageCatalogue metadata [Validator] update Dutch translation [ErrorHandler] Do not transform file to link if it does not exist
2 parents 0760342 + 5f8502e commit 4aba290

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

MessageCatalogue.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,16 @@ public function getMetadata(string $key = '', string $domain = 'messages'): mixe
217217
return $this->metadata;
218218
}
219219

220+
if (isset($this->metadata[$domain.self::INTL_DOMAIN_SUFFIX])) {
221+
if ('' === $key) {
222+
return $this->metadata[$domain.self::INTL_DOMAIN_SUFFIX];
223+
}
224+
225+
if (isset($this->metadata[$domain.self::INTL_DOMAIN_SUFFIX][$key])) {
226+
return $this->metadata[$domain.self::INTL_DOMAIN_SUFFIX][$key];
227+
}
228+
}
229+
220230
if (isset($this->metadata[$domain])) {
221231
if ('' == $key) {
222232
return $this->metadata[$domain];
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Translation\Tests\Catalogue;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Translation\MessageCatalogue;
16+
17+
class MessageCatalogueTest extends TestCase
18+
{
19+
public function testIcuMetadataKept()
20+
{
21+
$mc = new MessageCatalogue('en', ['messages' => ['a' => 'new_a']]);
22+
$metadata = ['metadata' => 'value'];
23+
$mc->setMetadata('a', $metadata, 'messages+intl-icu');
24+
$this->assertEquals($metadata, $mc->getMetadata('a', 'messages'));
25+
$this->assertEquals($metadata, $mc->getMetadata('a', 'messages+intl-icu'));
26+
}
27+
}

0 commit comments

Comments
 (0)