Closed lukaskleinschmidt closed 5 years ago
Iam having a similair issue. If you have a plugin which uses a translation rendered in a route closure it picks the wrong language.
I have 'nl' as a default language. But in the I18n class it uses 'en' since the i18n::$locale is not set yet...
The problem is fixed with @lukaskleinschmidt. But like he said i dont know what else breaks moving this code up.
Can this please be reviewed?
I was having problems with my Retour plugin in this direction as well and came up with the same idea for a fix - if only I would have seen/remembered that issue earlier 🙈 We will check carefully if this indeed is a valid fix or if it breaks other important parts.
That really fixes the issues so far as it seems. We need to test it a bit further but all unit tests pass right now.
Describe the bug When adding a closure as a route accessing languages leads to an error.
To Reproduce
config.php
.// config.php
return [ 'languages' => true, 'routes' => function ($kirby) {
];
Expected behavior It should be possible to access languages within a route closure.
Kirby Version 3.0.1