SonataPageBundle icon indicating copy to clipboard operation
SonataPageBundle copied to clipboard

Twig path function and forcing the locale with multisite

Open haivala opened this issue 2 years ago • 5 comments

Feature Request

I'm using multisite host_with_path and I have Symfony route that is updated as Dynamic page with update-core-routes. Meaning that I have 2 routes: /example/{slug} and /en/example/{slug} as the another site is prefixed with the /en and has locale en. Now I render the page template and would like to have a link to the another page with the same route but different locale & site. Twig path function does not work by giving it parameter locale or _locale as it always gives the Symfony route. How can I link to the another site page? meaning how I can force the locale? Do we need new twig function for this?

haivala avatar Sep 21 '22 18:09 haivala

I guess I have to use the technical alias section of the page..

haivala avatar Sep 21 '22 20:09 haivala

Dynamic page does not have Technical Alias field

haivala avatar Sep 22 '22 06:09 haivala

Feature Request

I'm using multisite host_with_path and I have Symfony route that is updated as Dynamic page with update-core-routes. Meaning that I have 2 routes: /example/{slug} and /en/example/{slug} as the another site is prefixed with the /en and has locale en. Now I render the page template and would like to have a link to the another page with the same route but different locale & site. Twig path function does not work by giving it parameter locale or _locale as it always gives the Symfony route. How can I link to the another site page? meaning how I can force the locale? Do we need new twig function for this?

Also now you have to insert all page blocks twice. Better option would be if page fields and page blocks would be translantable and you would need only translate texts and dont need to insert images again. Something like in https://docs.sonata-project.org/projects/SonataTranslationBundle/en/2.x/index.html But it would be lot of work. Easier would be option to duplicate page with all blocks to another site (another locale) and you would only translate some fields.

mesiarm avatar Oct 12 '22 14:10 mesiarm

I don't see why it is a problem to insert the page blocks twice. Sometimes it does not even make sense to make the same page in another language as the content is so much different and not that maintained.

Page duplication batch action to different site would be nice to have and relatively easy to do.

This issue is about getting path to any page that is made with update-core-routes command but forcing it's it's locale. It is not possible now as the path twig function does not take to account the site.

haivala avatar Oct 12 '22 16:10 haivala

I don't see why it is a problem to insert the page blocks twice. Sometimes it does not even make sense to make the same page in another language as the content is so much different and not that maintained.

Page duplication batch action to different site would be nice to have and relatively easy to do.

This issue is about getting path to any page that is made with update-core-routes command but forcing it's it's locale. It is not possible now as the path twig function does not take to account the site.

Ok I´ll create separate issue

mesiarm avatar Oct 12 '22 18:10 mesiarm

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 11 '23 09:04 github-actions[bot]