[Translation] fixed nested fallback catalogue using multiple locales.
This commit is contained in:
parent
7e53eab232
commit
bac217dd83
@ -273,6 +273,16 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
||||
$translator->trans('foo');
|
||||
}
|
||||
|
||||
public function testNestedFallbackCatalogueWhenUsingMultipleLocales()
|
||||
{
|
||||
$translator = new Translator('fr');
|
||||
$translator->setFallbackLocales(array('ru', 'en'));
|
||||
|
||||
$translator->getCatalogue('fr');
|
||||
|
||||
$this->assertNotNull($translator->getCatalogue('ru')->getFallbackCatalogue());
|
||||
}
|
||||
|
||||
public function testFallbackCatalogueResources()
|
||||
{
|
||||
$translator = new Translator('en_GB', new MessageSelector());
|
||||
|
@ -159,7 +159,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface
|
||||
*
|
||||
* @throws \InvalidArgumentException If a locale contains invalid characters
|
||||
*
|
||||
* @deprecated since version 2.3, to be removed in 3.0. Use setFallbackLocales() instead.
|
||||
* @deprecated since version 2.3, to be removed in 3.0. Use setFallbackLocales() instead
|
||||
*/
|
||||
public function setFallbackLocale($locales)
|
||||
{
|
||||
@ -420,7 +420,7 @@ EOF
|
||||
|
||||
foreach ($this->computeFallbackLocales($locale) as $fallback) {
|
||||
if (!isset($this->catalogues[$fallback])) {
|
||||
$this->doLoadCatalogue($fallback);
|
||||
$this->loadCatalogue($fallback);
|
||||
}
|
||||
|
||||
$fallbackCatalogue = new MessageCatalogue($fallback, $this->catalogues[$fallback]->all());
|
||||
|
Reference in New Issue
Block a user