mhujer / BreadcrumbsBundle

Breadcrumbs bundle for Symfony. This is a fork of whiteoctober/BreadcrumbsBundle maintained for newer Symfony and PHP versions.
Other
66 stars 12 forks source link

How use domain translation in breadcrumb item label? #26

Open lu43n opened 3 years ago

lu43n commented 3 years ago

How use domain translation in breadcrumb item label?

mhujer commented 3 years ago

@lu43n it can be changed in the configuration https://github.com/mhujer/BreadcrumbsBundle#configuration or passed directly to the twig function when using wo_render_breadcrumbs in the template.

RomainOdeval commented 3 years ago

Hi @mhujer ! It works only if you have one unique domain on each template and you generate item into twig template.

For example, we try to generate them into PHP controllers, depends of our routes, and we can't define it properly. Have you any idea ? (We try to put domain into translationParameters, without success)

mhujer commented 3 years ago

@RomainOdeval Oh, I can see it from the linked commits - you need to pass a different translation domain to each addItem call. It is currently not possible but I'll be happy to accept a PR which adds support for it.

You would need to add an extra $translationDomain parameter to methods in \WhiteOctober\BreadcrumbsBundle\Model\Breadcrumbs and also update the templates in Resources/views/ so they correctly use either global translation domain or the one from the specific breadcrumb.

I just added tests to cover existing behavior, so it should be easy to add similar tests for new use cases: https://github.com/mhujer/BreadcrumbsBundle/commit/784f9c421c07465b86fac4184b6e71bea964ead8#diff-6426747894f7bcaebf8f548599adb583ccd80bcf900cc0ae7d2f99373708c4dbR58-R79