Closed
Description
Symfony version(s) affected: v5.3.7, v4.4.30
Description
With the change in #42576 the catalog fallback language gives now en_001
instead of the wanted fallback language
How to reproduce
Insert into src/Symfony/Component/Translation/Tests/TranslatorTest.php
public function testCatalogueGetsCorrectFallback()
{
$translator = new Translator('en_GB');
$translator->setFallbackLocales(['en_GB', 'en']);
$catalogue = $translator->getCatalogue('en_GB');
$this->assertEquals('en', $catalogue->getFallbackCatalogue()->getLocale());
}
Possible Solution
\Symfony\Component\Translation\Translator::computeFallbackLocales
computes the fallback with the language en_GB
. This has an entry in parents.json
and the $parent will be en_001
and later assigned in the if as locale.
With the change of #42576, it will be appended to the $locales
array and the fallback language will be then en_001
instead of en_GB
Additional context