-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Allow translations in resource bundle #2405
Allow translations in resource bundle #2405
Conversation
…ource-bundle Allow translations in resource bundle
Thanks Gonzalo! 👍 |
@@ -16,14 +16,15 @@ | |||
use Symfony\Component\Config\FileLocator; | |||
use Symfony\Component\DependencyInjection\ContainerBuilder; | |||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; | |||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | |||
use Sylius\Bundle\TranslationBundle\DependencyInjection\AbstractTranslationExtension; |
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 wrong IMO as it adds (missing anyway) dependency for ResourceBundle on the TranslationBundle...
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.
@stloyd What do you mean? I don't see why this is adding a dependency of ResourceBundle on TranslationBundle.
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.
Using class from another bundle is the additional dependency.
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.
Ok, I thought you meant that the dependency was the other way round.
If we allow translations in the resource bundle it's normal to have a dependency on that bundle.
I am thinking if we really need Transltion and TranslationBundle, maybe add translations support to Sylius resource directly. What do you think guys? @stloyd @gonzalovilaseca @Sylius/core-team |
@pjedrzejewski At some point I thought that too. Let's see what others say. The integration would be quite easy. |
Yes, also, would be cool if we can move the translation resource creation to the translatable node directly. So instead of: sylius_resource:
resources:
app.book:
driver: doctrine/orm
classes:
model: App\Entity\Book
translatable:
model: App\Entity\BookTranslation
app.book_translation:
driver: doctrine/orm
classes:
model: App\Entity\BookTranslation We can have: sylius_resource:
resources:
app.book:
driver: doctrine/orm
classes:
model: App\Entity\Book
translatation:
model: App\Entity\BookTranslation
repository: # And other configurations. I think that should be quite simple to do. Basically: translation node under classes registers another resources with name X_translation. :) Same for bundle configs of course. |
@pjedrzejewski In fact, while refactoring the bundle I started to do it that way, but then I realised that any configuration that might be added in the future to the
But with this approach I had issues in the case where First option is easier, but as I said, configuration nodes will need to be duplicated. |
I'd say I am fine with the little duplication here, we can look at it later, when we perhaps add something more than |
…or-resource-bundle Allow translations in resource bundle
With this small refactorization it's possible to create a translatable resource entity, eg:
It would be great to have the translatable repo mapped by default, but that will be in another PR.