I’m new to Grav. I’m considering to build the page with this CMS.
I was looking the for the answer and tried different configuration options but without success.
@pawellabaj, I’m starting to believe that I’m not understanding what your expectation is…
Do you want to replace a missing en page with a page for the default pl language
Or do you wish to omit the non existing en page from the navigation bar?
I assumed you expected this behaviour…
ad. 1
If you want to replace the non-existing en page with the pl page you need to set the following:
content_fallback:
pl: pl
en: [en, pl]
No need to change the template in this case.
Note:
I’m not sure if this is a desirable behaviour from the user’s point of view. The user choses the English language because he/she doesn’t understand Polish. Presenting the user a Polish page anyway is not very useful for the user…
My initial interpretation (1) would be more logical IMHO.
Yeas, this is the behaviour I’d like to achieve. This is one of the requirement I need to fulfil.
When I set follwoing configuration:
languages:
content_fallback:
pl: pl
en: [en, pl]
I see all pages in menu. In en language I see menu items with following urls:
First[/en/first]
Second[/en/second]
When I click /en/second link, the page in default (pl) language is opening; in browser address bar there is localhost:8000/en/second.
This is misleading - I clicked link for English page and received Polish one.
This is misleading - I clicked link for English page and received Polish one.
The property content_fallback does what it should do: falling back to the content of another language. It doesn’t fallback to a url of a page in another language.
I really don’t see what the use-case is of your approach. As a non Polish speaker/reader, I would not want to be directed to the url of a Polish page, nor do I want to be presented Polish content.
What if I save the the url in my favourites?
When saving /en/second showing Polish content, I might see English content in the future when the page gets translated.
When saving /pl/second I would never see the English content in the future. Also, I would land on the Polish version of the website, while I don’t understand Polish…
As a non-Polish speaker, I would prefer to not see Polish content ever, I also don’t want to know there is a Polish page, but not in English. I would prefer the first solution I’ve presented. Not falling back to Polish, and don’t show me a url in the navigation if there is no English content.
Please share a use-case that suits your preferred behaviour.