Skip to content

Commit ed2bac9

Browse files
committed
Merge branch '6.4' into 7.2
* 6.4: [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 3978286 + a36cfd8 commit ed2bac9

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ private function formatFile(string $file, int $line, ?string $text = null): stri
233233
$text .= ' at line '.$line;
234234
}
235235

236+
if (!file_exists($file)) {
237+
return $text;
238+
}
239+
236240
$link = $this->fileLinkFormat->format($file, $line);
237241

238242
return \sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', $this->escape($link), $text);

src/Symfony/Component/Translation/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+
}

src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@
468468
</trans-unit>
469469
<trans-unit id="121">
470470
<source>This value is not a valid Twig template.</source>
471-
<target state="needs-review-translation">Deze waarde is geen geldige Twig-template.</target>
471+
<target>Deze waarde is geen geldige Twig-template.</target>
472472
</trans-unit>
473473
</body>
474474
</file>

0 commit comments

Comments
 (0)