-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instantiate parent in Page->translatedLanguages() #2709
Conversation
A similar fix is probably needed for Flex Pages. |
@OleVik There's a small issue there; parent isn't the correct one as it comes from the current language, not from the same language as the page. |
Also include prefix with route.
@mahagr I added a check for a translated version of the parent, in the same language as the current Page, and set the parent's route to reflect that. I also updated the returned route to include the language-prefix, otherwise all languages return the same route. |
It still won't work as you can change slug from the parent based on the language. So the URL is basically going to be wrong: The only way to get it right, is to go up on a tree and initialize all the translated parent pages and get route from them. |
That's derived from aliases, right? Wouldn't the router then apply |
I think the best thing though, would be to get the The issue with your approach is that it'll not build the nested route right way causing 404 in many cases as the route cannot be found. |
@OleVik I checked this and, unfortunately no, your suggestion won't work like that as Grav currently keeps record only from the current translation. This means that all the other slugs are coming from the wrong language. |
What associates My assumption about the aliases stemmed from Language Alias Routes, which with |
Each language, no matter the language specific slugs, are associated by Lang and raw route. |
But do they then belong to different folders, or does the Page FrontMatter just declare the translation? I haven't really had need to use multi-language that much in Grav before, so my test-cases were always rather simple. |
Fixes #2163.