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

[Translation] Return's wrong fallback locale #42796

Copy link
Copy link
Closed
@shyim

Description

@shyim
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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