Skip to content
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

fix issue with translation domain #6523

Merged
merged 2 commits into from
Oct 23, 2020
Merged

Conversation

dmaicher
Copy link
Contributor

Subject

I am targeting this branch, because it fixes a bug introduced in 3.77.0 (#6401).

Closes #6522

Changelog

### Fixed
- fixed BC break with getting the translation domain for nested fields on a one-to-many inline edit table view

@@ -26,8 +26,7 @@ file that was distributed with this source code.
{% if nested_field.vars.translation_domain is same as(false) %}
{{ nested_field.vars.label }}
{% else %}
{% set translationDomain = nested_field.vars.translation_domain|default(nested_field.vars['sonata_admin'].admin.translationDomain) %}
Copy link
Contributor Author

@dmaicher dmaicher Oct 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some way that nested_field.vars['sonata_admin'].admin.translationDomain was actually used as the translation domain?

if nested_field.vars.translation_domain is false then its the above if block anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah wait. It can be null... changing it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the #6401 PR, it was:

nested_field.vars['sonata_admin'].admin.translationDomain|default(nested_field.vars.translation_domain)

Which mean it was used. And when it wasn't defined (like in your case) nested_field.vars.translation_domain was used instead.

The PR (with the bug), swap the default value.

I would say that if nested_field.vars.translation_domain is null it will fallback to nested_field.vars['sonata_admin'].admin.translationDomain, which is not a bad thing.

But if both nested_field.vars.translation_domain is null and nested_field.vars['sonata_admin'].admin.translationDomain is not defined ; what should we do ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if both are not available then we use null as the domain. The Symfony translator should handle it properly and use the default domain I think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the right solution indeed.

@dmaicher dmaicher marked this pull request as draft October 22, 2020 19:05
@dmaicher dmaicher marked this pull request as ready for review October 22, 2020 19:09
@VincentLanglet VincentLanglet requested a review from a team October 22, 2020 19:10
@VincentLanglet VincentLanglet mentioned this pull request Oct 22, 2020
@jordisala1991 jordisala1991 merged commit d36b99e into sonata-project:3.x Oct 23, 2020
@jordisala1991
Copy link
Member

Thank you @dmaicher

@dmaicher dmaicher deleted the patch-1 branch October 23, 2020 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BC break in 3.77: Impossible to access an attribute ("translationDomain") on a boolean variable ("")
3 participants