Ez Publish Language switcher

195 Views Asked by At

Is it possible that when i switch to another language , get same content from where i'm switching ?

for example: if i'm on English page "http://englishDomain.com/en/News/someNews/SomeChildOfNews" and when i switch to German content i want to get like this "http://germanDomain.com/de/NewsOnGermanLanguage/SomeChildOfNewsOnGermanLanguage

as you can see on my example i want same content on German language and "slug" should be on German too

any links or tutorial examples will be helpful for me


I found this in DOC (https://doc.ez.no/display/EZP/Language+Switcher) but this code not working , it gives me a same url where i am.

$routeRefGenerator = $this->get( 'ezpublish.route_reference.generator' );
$routeRef = $routeRefGenerator->generate( $location, array( 'language' => 'fre-FR' ) );
$link = $this->generateUrl( $routeRef ); 
1

There are 1 best solutions below

0
Emmanuel On

Can you try this :

$link = $this->get( 'ezpublish.chain_router')->generate( $location, array('siteaccess' => 'de') );