BreadcrumbsBundle icon indicating copy to clipboard operation
BreadcrumbsBundle copied to clipboard

How use domain translation in breadcrumb item label?

Open lu43n opened this issue 4 years ago • 3 comments

How use domain translation in breadcrumb item label?

lu43n avatar Feb 18 '21 15:02 lu43n

@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.

mhujer avatar Feb 22 '21 09:02 mhujer

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)

RomainOdeval avatar Apr 06 '21 13:04 RomainOdeval

@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

mhujer avatar Jun 05 '21 09:06 mhujer