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

Translation is broken in oneToMany edit form #657

Merged
merged 1 commit into from
Jan 30, 2017

Conversation

core23
Copy link
Member

@core23 core23 commented Jan 15, 2017

I am targetting this branch, because this a bugfix.

Closes #656

Changelog

### Fixed
 - Fixed broken translation in oneToMany table view

Subject

The PR #651 breaks the translation of oneToMany form fields in the table view.

@@ -23,7 +23,7 @@ file that was distributed with this source code.
style="display:none;"
{% endif %}
>
{{ nested_field.vars.label|trans({}, nested_field.vars.translation_domain) }}
{{ nested_field.vars.label|trans({}, nested_field.vars['sonata_admin'].admin.translationDomain|default(nested_field.vars.translation_domain)) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please linebreak this.

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks funny… what is vars['sonata_admin']? You're calling .admin on it…

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Had a deeper look, I think that sonata_admin is an instance Sonata\AdminBundle\Form\Type\AdminType here, or something like that… so it must be fine (I hope)

Copy link
Member Author

Choose a reason for hiding this comment

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

No idea how to solve this in 80 chars per line without destroying readability :/

Copy link
Contributor

@greg0ire greg0ire Jan 16, 2017

Choose a reason for hiding this comment

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

How about this :

{{ nested_field.vars.label
    |trans({}, nested_field.vars['sonata_admin'].admin.translationDomain
        |default(nested_field.vars.translation_domain)) }}

The last line is indented twice to make it clear what is nested in what, exactly like we would do in php.

@core23
Copy link
Member Author

core23 commented Jan 20, 2017

Can you approve this @greg0ire ?

@OskarStark
Copy link
Member

LGTM 👍

@OskarStark OskarStark merged commit c6c8d55 into sonata-project:3.x Jan 30, 2017
@core23 core23 deleted the patch/issue#656 branch January 30, 2017 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translation is broken in oneToMany edit form
4 participants