Hello there,
I made a virtual page from my page article,
How can I keep de translation in english or spanish from an article to the virtual page ?
Actually it only display in french
'routes' => [
[
'pattern' => '(:any)/print/(:all)',
'action' => function ($lang, $page_id) {
$p = page('print');
return $p->render([
'article' => page($lang, $page_id)
]);
}
],
]
texnixe
January 25, 2023, 8:15pm
#2
I don’t really understand your code or what you are trying to do.
If you want to visit a page in a given language, you have to use $site-visit($page, $lang)
before returning the page.
Or you set the language scope: Routing | Kirby CMS
But
claraloustau:
page($lang, $page_id)
This is not correct syntax, the page helper doesn’t accept a language code.
1 Like
Thank you Texnixe for your help, in fact I had to use
return site()->visit($p, $lang)->render([ 'article' => page($page_id) ]);