Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0fcdc41

Browse filesBrowse files
author
Xavier RENAUDIN
committed
[Translator] Fix translator overlapse
1 parent 18f3978 commit 0fcdc41
Copy full SHA for 0fcdc41

File tree

2 files changed

+15
-1
lines changed
Filter options

2 files changed

+15
-1
lines changed

‎src/Symfony/Component/Translation/Tests/TranslatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Tests/TranslatorTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,20 @@ public function testIntlFormattedDomain()
683683
$this->assertSame('Hi Bob', $translator->trans('some_message', ['%name%' => 'Bob']));
684684
}
685685

686+
/**
687+
* @requires extension intl
688+
*/
689+
public function testIntlDomainOverlapse()
690+
{
691+
$translator = new Translator('en');
692+
$translator->addLoader('array', new ArrayLoader());
693+
694+
$translator->addResource('array', ['some_message' => 'hello'], 'en', 'messages');
695+
$translator->addResource('array', ['some_message' => 'hello intl'], 'en', 'messages+intl-icu');
696+
697+
$this->assertSame('hello intl', $translator->trans('some_message', [], 'messages'));
698+
}
699+
686700
/**
687701
* @group legacy
688702
*/

‎src/Symfony/Component/Translation/Translator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Translator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public function trans($id, array $parameters = [], $domain = null, $locale = nul
232232
}
233233

234234
if ($this->hasIntlFormatter && $catalogue->defines($id, $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX)) {
235-
return $this->formatter->formatIntl($catalogue->get($id, $domain), $locale, $parameters);
235+
return $this->formatter->formatIntl($catalogue->get($id, $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX), $locale, $parameters);
236236
}
237237

238238
return $this->formatter->format($catalogue->get($id, $domain), $locale, $parameters);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.