Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] Add choice_translation_parameters option for ChoiceType form#36851
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[Form] Add choice_translation_parameters option for ChoiceType form#36851
Uh oh!
There was an error while loading.Please reload this page.
Conversation
3f1c059 toe37d6d4Comparesrc/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
VincentLanglet commentedJul 8, 2020
Just found a situation where a callback is needed if the translations parameters are depending on the choice. @xabbuh Do you know how I can support something like |
1ea5346 toecefd31Compareecefd31 tod876022CompareVincentLanglet commentedAug 12, 2020
Hi@xabbuh, I totally rework the PR and updated thesymfony/symfony-docs#13677 I change the way I implemented WDYT about it ? :) |
f31e0c4 to453bd62CompareVincentLanglet commentedAug 23, 2020
@xabbuh I don't know why the |
fabpot commentedAug 23, 2020
@VincentLanglet You should probably bump de dep of |
c9beb74 to944648cCompareVincentLanglet commentedAug 23, 2020
Indeed ! Thanks. I think this PR is finally ready to review then. :) |
fabpot left a comment
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.
LGTM,@xabbuh Can you review this one?
Uh oh!
There was an error while loading.Please reload this page.
| * @param array|callable|Cache\ChoiceTranslationParameters $labelTranslationParameters The parameters used to translate the choice labels | ||
| */ | ||
| publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,$index =null,$groupBy =null,$attr =null) | ||
| publicfunctioncreateView(ChoiceListInterface$list,$preferredChoices =null,$label =null,$index =null,$groupBy =null,$attr =null,$labelTranslationParameters = []) |
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.
Adding the argument here is a BC break.
src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
jvasseur commentedOct 2, 2020
@VincentLanglet you don't need to pass a translatable as key in the So yes, the feature does exists currently. |
VincentLanglet commentedOct 2, 2020
Oh I didn't think it that way. But, I propose the feature And you recommend I have trouble to see this solution as simpler. I'm not sure that the "Translatable should be the only option" is the best strategy for the developer. @xabbuh Do you have some time to review this PR ? :) |
jvasseur commentedOct 2, 2020
Personally I tend to never use the keys in Of course this example doesn't looks that good but in most cases your choices will contains the necessary data to construct the full translation. And even if it is a bit more verbose I think it's a better solution since it keeps the translation key and the translation parameters close to each others. |
VincentLanglet commentedOct 2, 2020
It's easier when it's a true/false case. But if choice are let's say It starts to be verbose. And if it was the recommended way, Symfony wouldn't use the I find your solution over-complicated, you don't like mine. For instance And And none of these solution are deprecated. |
fabpot commentedOct 3, 2020
@VincentLanglet Can you have a look at the failing tests? |
5fde5f8 toa962f60CompareVincentLanglet commentedOct 4, 2020
I fixed the error I got with missing space in line in the I also remove the deprecation I added since there is already one. But I don't know how to avoid getting this in tests. I'm getting this because the |
a962f60 to026ed90Comparefabpot commentedOct 7, 2020
We've just moved away from |
VincentLanglet commentedOct 7, 2020
Sure#38469 |
…centLanglet)This PR was squashed before being merged into the 5.3-dev branch.Discussion----------[Form] Add "choice_translation_parameters" option| Q | A| ------------- | ---| Branch? | 5.x| Bug fix? | no| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets |Fix#36845 <!-- prefix each issue number with "Fix #", if any -->| License | MIT| Doc PR |symfony/symfony-docs#13677Original PR:#36851Commits-------1ce5b03 [Form] Add "choice_translation_parameters" option
…centLanglet)This PR was squashed before being merged into the 5.3-dev branch.Discussion----------[Form] Add "choice_translation_parameters" option| Q | A| ------------- | ---| Branch? | 5.x| Bug fix? | no| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets | Fix #36845 <!-- prefix each issue number with "Fix #", if any -->| License | MIT| Doc PR |symfony/symfony-docs#13677Original PR:symfony/symfony#36851Commits-------1ce5b03c2a [Form] Add "choice_translation_parameters" option
…centLanglet)This PR was squashed before being merged into the 5.3-dev branch.Discussion----------[Form] Add "choice_translation_parameters" option| Q | A| ------------- | ---| Branch? | 5.x| Bug fix? | no| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets | Fix #36845 <!-- prefix each issue number with "Fix #", if any -->| License | MIT| Doc PR |symfony/symfony-docs#13677Original PR:symfony/symfony#36851Commits-------1ce5b03c2a [Form] Add "choice_translation_parameters" option
Uh oh!
There was an error while loading.Please reload this page.