Routes and multi-language sites issue

Hi everyone,
I configured my website to work with two languages, all worked as expected until I added to my config file a custom route to handle an ajax POST request.
Every time I try to make a request to that route, instead of getting the returning value of the ‘action’ function, I get the following errors:

Notice: Trying to get property of non-object in /Users/marianoviola/Documents/Projects/Iperstudio/careof/kirby/branches/multilang/site.php on line 187
Fatal error: Call to a member function code() on a non-object in /Users/marianoviola/Documents/Projects/Iperstudio/careof/kirby/kirby.php on line 412

Commenting the languages configuration, the route starts to work as expected. I’m not sure, but it seems that Kirby tries to treat the route as a standard page.

Any idea on why this happens?

The multilang router works differently from the ‘normal’ router. More information here in the old forum: http://getkirby.com/forum/general/20141124/multi-language-routing/#20141216105011

1 Like

@FabianSperrle thanks for the link, I used the solution provided by @bastianallgeier and now the error is no longer raised.

Anyway it would be nice if in the future, the documentation would cover the combination of a multi-language site with custom routes :sweat_smile:

I added the information from the old forum to the documentation and created a pull request. So hopefully we’ll have at least minimal information about multilang routers in the docs soon.

2 Likes