Skip to content

Commit 3594877

Browse files
committed
bug symfony#20466 [Translation] fixed nested fallback catalogue using multiple locales. (aitboudad)
This PR was merged into the 2.7 branch. Discussion ---------- [Translation] fixed nested fallback catalogue using multiple locales. | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#17786 | License | MIT | Doc PR | ~ Commits ------- bac217d [Translation] fixed nested fallback catalogue using multiple locales.
2 parents 6953f4f + bac217d commit 3594877

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,16 @@ public function testWhenAResourceHasNoRegisteredLoader()
273273
$translator->trans('foo');
274274
}
275275

276+
public function testNestedFallbackCatalogueWhenUsingMultipleLocales()
277+
{
278+
$translator = new Translator('fr');
279+
$translator->setFallbackLocales(array('ru', 'en'));
280+
281+
$translator->getCatalogue('fr');
282+
283+
$this->assertNotNull($translator->getCatalogue('ru')->getFallbackCatalogue());
284+
}
285+
276286
public function testFallbackCatalogueResources()
277287
{
278288
$translator = new Translator('en_GB', new MessageSelector());

src/Symfony/Component/Translation/Translator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function getLocale()
159159
*
160160
* @throws \InvalidArgumentException If a locale contains invalid characters
161161
*
162-
* @deprecated since version 2.3, to be removed in 3.0. Use setFallbackLocales() instead.
162+
* @deprecated since version 2.3, to be removed in 3.0. Use setFallbackLocales() instead
163163
*/
164164
public function setFallbackLocale($locales)
165165
{
@@ -420,7 +420,7 @@ private function loadFallbackCatalogues($locale)
420420

421421
foreach ($this->computeFallbackLocales($locale) as $fallback) {
422422
if (!isset($this->catalogues[$fallback])) {
423-
$this->doLoadCatalogue($fallback);
423+
$this->loadCatalogue($fallback);
424424
}
425425

426426
$fallbackCatalogue = new MessageCatalogue($fallback, $this->catalogues[$fallback]->all());

0 commit comments

Comments
 (0)