-
-
Couldn't load subscription status.
- Fork 5.3k
Add CookBook documentation about Field Label Translations #1938
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove the space between ...Extension and </...
| I have added some comments and some general tips:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add one =
| I think it's all right now. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not aligned correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smoya it should be:
* @param FormView $view * @param FormInterface $form * @param array $options how it is now:
* @param FormView $view * @param FormInterface $form * @param array $options | I can't find the error of alignment |
| Sorry, I've had a bad day... :) |
| And now, what is the next step? |
| Now you wait until @weaverryan (the co-author of the symfony docs) will review and merge this PR, as this is a voluntary it will take one or two weeks (usually on friday). |
| Ok! really thanks @wouterj ! |
| Hi Sergio! I think this is an interesting entry - thanks for putting it together! But I do have one strategy question. Doesn't this strategy result in duplicate translations? For example, if you have a "Name" field on 2 different forms (e.g. a Thanks! |
| Ping @smoya! |
| Sorry for not answering at the time. |
| I was considering the same but I was going a different route. I wanted to provide the possibility of defining a label prefix which can be set in the form type class to still give some flexibility to the developer. The prefix is not being So the only difference is that you can set the prefix rather than generating one automatically. I am still working on In any case I think suche cookbook entry will be helpful because this is a common issue. |
| I'm going to close this. @weaverryan and I decided almost 1 year ago that we should close this one, so let's do it now. This articles explains something that is actually already implemented into the component. All strings can already be translated by using the label name. If you want to use the dot notation instead of the message notation, you should set the labels (like you see here: http://www.elao.com/blog/non-classe/a-nice-way-of-handing-form-label-translation.html ) or create an extension, like you did here. But this extension introduces more problems than it solves. For instance, it can't work with duplicate field names. All in all, we found this a bit of a "hacky" way to do this. And the docs shouldn't be hacky, they should explain only best practises. If someone disagrees, please comment on this issue. :) |
No description provided.