October 3.1 - translated page url does not work

hi guys,

I have some project with multiple languages.
with octobercms 2.x I was used to manage different page urls with the help of the translation plugin like this:

page.htm

url = "/land"
title = "..."
layout = "..."

[viewBag]
localeUrl[en]="/country"

When I visit the default url /de/land everything works as expected.
Now I expect the english page to be like this: /en/country.

Unfortunately I get a 404 (page not found). Anyone has an idea?

Hey guys. I fixed my “issue”.

The problem has been, I am used to write the cms pages by hand in my IDE.
Now I used the backend and this is the working result.

url = "/land"
layout = "default"
title = "Land"

[viewBag]
localeUrl[en-gb] = "/country"

It didn’t worked, because i was using the wrong language code.

I should have used en-gb. Instead I was used to write my own code en.

Problem solved.

1 Like

Thanks for sharing the solution!

I found that this is very finnicky, even with the right language code.

After experimenting for a fair bit, I’ve found that if you use the exact sequence like this, it finally works.
Don’t forget to clear cache after every save…

url = "/subspecialties"
layout = "common"
title = "Subspecialties"

[viewBag]
localeUrl[fr] = "/sous-specialites"
localeUrl[nl] = "/subspecialiteiten"
localeTitle[fr] = "Sous-spécialités"
localeTitle[nl] = "Subspecialiteiten"
activeMenuItem = "subspecialties"

Using the built in editor unfortunately does not guarantee a working solution.