I am currently setting up a multilingual site. The default language is English, and the other languages are German, Dutch and French.
When I add a page in the panel, I can choose the language and I can define the URL. This creates the folder in the content part of the site and within this folder I have the files depending on the number of languages. So far so good.
My problem is that when I add a German translation of this page, the URL remains in English.
Example: I created an English page “Hardy Krueger died” and added a translation in German, but the URL remains the same - it’s only the language identifier that is changing:
But I would like to see something like
Should I use $page->urlForLanguage()? If so, could someone tell me how? Do I have to define 2 URLs in the template/blueprint? Or should I write a routine that converts the page title into a URL?
In the page settings in the Panel you find an option Change URL which you can use to localize the page slug. If you use this option in the default language, the actual folder name is changed. For non-default languages, a slug prop is added to the content file.
The only issue I have is that if I create an article only in German (second language). How could I make sure to exclude the English version (which has been created by the system, but is empty) from being listed on the site? Should I filter by $page->text() being empty?