Sylius: Adding Translations for locale

2019-03-05 10:18发布

问题:

I'm using the Sylius/Sylius package for development and would like to serve my visitors with a Dutch interface. Not all strings are translated to Dutch, and some are done poorly. My question now is, without touching the Sylius bundles directly, what would be the best way to add/override translations?

Because I want to re-use these translations I'm writing my own Sylius "wrapper", which in its current approach extends the Sylius bundles and have their own Resources/translations folder. For example: MyWebBundle extends SyliusWebBundle through getParent() and has a Resource/translations/messages.nl.yml file containing Dutch strings.

I'm looking forward to hearing your thoughts.

回答1:

Since translations are not related to bundles, but to domains, you can overwrite the translations from anywhere. Either from app/Resources/translations/ or from your bundles Resources/translations/ directory.

Unfortunately Sylius is correctly missing a translations domain and uses only messages, this is a little mess, but there is already a discussion on GitHub. Translations is a very living part in Sylius and can change evrytime.



回答2:

Actually Sylius is using crowdin for maintaining languages support. As I can see dutch is at 95% so you can edit or update translation there and they will be updated in core.

https://crowdin.com/project/sylius