8000 Translation domain overrides no longer being used · Issue #40014 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

Translation domain overrides no longer being used #40014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kbond opened this issue Jan 27, 2021 · 10 comments
Closed

Translation domain overrides no longer being used #40014

kbond opened this issue Jan 27, 2021 · 10 comments

Comments

@kbond
Copy link
Member
kbond commented Jan 27, 2021

Symfony version(s) affected: 4.4.19

Description
After upgrading from 4.4.18 to 4.4.19, my custom translation messages for the security domain is no longer being used.

How to reproduce

  1. Create translations/security.en.yml with the following contents:
    "Invalid credentials.": Custom Message!
  2. My translator config looks like the following:
    framework:
        default_locale: en
        translator:
            default_path: '%kernel.project_dir%/translations'
            fallbacks:
                - en
  3. In a twig template:
    {{ 'Invalid credentials.'|trans([], 'security') }} {# resolves to "Invalid credentials." but expected "Custom Message!" #}

Possible Solution
I looked though the changes from 4.4.18 to 4.4.19 but couldn't pinpoint exactly what caused this bug.

Additional context
I can work on a reproducer. Reproducer: https://github.com/kbond/symfony-reproducer/tree/bug/trans-domain:

@cs278
Copy link
Contributor
cs278 commented Jan 28, 2021

I can confirm this as well. Adding "symfony/finder": "=4.4.19" to the conflict section of composer.json fixes the problem. It appears the problem is caused by 1dead9a.

@kbond
Copy link
Member Author
kbond commented Jan 28, 2021

(PR #39703)

Thanks for finding the source @cs278!

@xabbuh
Copy link
Member
xabbuh commented Jan 28, 2021

So #40023 would solve this issue too?

@xabbuh xabbuh closed this as completed Jan 28, 2021
@stof
Copy link
Member
stof commented Jan 28, 2021

@xabbuh I don't think so. The issue does not seem related to the append() bug, because FrameworkExtension does not use append.
Instead, I think that FrameworkBundle was actually relying on the sorting bug that was fixed by #39703, expecting to get translation files sorted first by the directory in which they are (in the order in which they were configured) and then by name inside it (due to the sorting by name configured in the Finder). When sorting everything by name only, this changes the order of resources overriding each other.

@stof stof reopened this Jan 28, 2021
@kbond
Copy link
Member Author
kbond commented Jan 29, 2021

I can confirm that #40023 does not solve the issue but reverting #39703 does.

@acantepie
Copy link

I have same issue on Symfony 5.2.2 .

Reproduce bug using "symfony/finder":5.2.2 when i am trying to override any translations from vendor:
composer require "symfony/finder":5.2.2

To resolve issue :
composer require "symfony/finder":5.2.1

@xabbuh
Copy link
Member
xabbuh commented Feb 6, 2021

Can you please check if #40116 fixes this issue?

@kbond
Copy link
Member Author
kbond commented Feb 6, 2021

@xabbuh I can confirm that PR fixes the issue for me.

nicolas-grekas added a commit that referenced this issue Feb 7, 2021
…tions sequentially (xabbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle][Translator] scan directories for translations sequentially

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40014
| License       | MIT
| Doc PR        |

Commits
-------

8389310 scan directories for translations sequentially
@nusje2000
Copy link
Contributor

@fabpot what are the plans regarding a new release for both the 4.4 and 5.x branches to resolve this issue?

@xabbuh
Copy link
Member
xabbuh commented Feb 10, 2021

@nusje2000 Patch releases are published monthly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants
0