How to reference to a page in a multi language setup?

Hi! I’m tweaking ith Grav, try to better understand how to do things. Currently I have a multi language setup (en, it, pt). All pages have localized titles and slugs (example - en: Instruments/instruments; it: Strumenti/strumenti; pt: Instrumentos/instrumentos).
How can I reference the localized slug of this page? I mean, if I use {{ page.route }} and if I navigate via the menu to this page, in italian, it correctly write http://somedomain/somepage/strumenti/ but If I switch to portugues, it display http://somedomain/somepage/instruments, using the default (english) slug. What’s wrong?


you should be able to use the localized page route if you want to reach a specific page language version (if you know it). Alternatively there is something that every page has called the rawroute and this is basically the lang with the default file-based route appended. For example:

/en/somepage/instruments -> english version
/it/somepage/instruments -> italian version

If you have the redirect default route option set in your system.yaml, it will redirect this route to the /somepage/strumenti one.

This is basically how the lang switcher plugin works. Remember that each language is basically isolated from the others. The only way you can get to a different language version of a page is to use the rawroute. From the english page, Grav has no idea about the italian page (it has not even parsed the .md file).

This is how Grav is able to maintain performance no matter how many languages you add.

You are right! I missed the redirect default route in my config. This is the reason why did not work, no matter how I code… great! Kudos!!!