Pyro returns content in wrong language when the selected one is empty.
Created 2 years ago by gonziis

I have a translatable language field. In the view code there is a check whether the field is empty or not. If empty, it shouldnt display a block for that, so that means that the field is optional. That field in one language has content, in other it doesn't. But Pyro still returns the other language when it detects that the field is empty in the selected language. How can I disable this? Or how can I request it to give me the actual data even if its empty.

gonziis  —  2 years ago

Also I now noticed that a boolean value is always returned the one which is chosen in the main language. This about Pages btw, I have an custom boolean field assigned which is translatable. I am using the page in another language by linking with /langugage/page-slug. Is this the wrong way to assign a language to user perhaps, thats why its returning the main languages data.

gonziis  —  2 years ago

Ok, question. How can I do a laravel`s 'App::setLocale('en')' in twig views or a something like a basic controller/AppController? Whenever a user gets directed to any page, it checks whether there is an '/en' in the URL and the assigns the locale.

edster  —  2 years ago

I would create a middleware and assign it to the routes you want use.