set404Override - setLocale not working? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: set404Override - setLocale not working? (/showthread.php?tid=75843) |
set404Override - setLocale not working? - haugli92 - 03-22-2020 Hi! I'm just wondering why the controller set in set404Override() not listening to the selected locale. Is this a feature or a bug? Any other controller is working properly. app/Config/Routes.php PHP Code: $routes->set404Override('App\Controllers\Error::error_404'); app/Controllers/Error.php PHP Code: <?php namespace App\Controllers; RE: set404Override - setLocale not working? - haugli92 - 03-29-2020 Bump? No idea? RE: set404Override - setLocale not working? - haugli92 - 09-28-2020 Trying again. Bump RE: set404Override - setLocale not working? - paulbalandan - 09-28-2020 What do you mean your view files output data in English? Are the views supposed to be multilingual? RE: set404Override - setLocale not working? - haugli92 - 10-19-2020 (09-28-2020, 02:24 AM)paulbalandan Wrote: What do you mean your view files output data in English? Are the views supposed to be multilingual? All text in the view files is stored in the language files. When language is selected all text should be read from that language. It works on any page but, App\Controllers\Error::error_404 It seems to read browser's preferred language when hitting this page. Ignoring the selected language. RE: set404Override - setLocale not working? - jrr102412 - 08-25-2021 (10-19-2020, 01:15 AM)haugli92 Wrote:I have the same problem, have you been able to solve it?(09-28-2020, 02:24 AM)paulbalandan Wrote: What do you mean your view files output data in English? Are the views supposed to be multilingual? RE: set404Override - setLocale not working? - wdeda - 08-25-2021 I found a different solution: config\routes.php: PHP Code: $routes->setDefaultNamespace('App\Controllers'); There is a controller: PHP Code: <?php namespace App\Controllers\General; PHP Code: <!-- 20200524 --> RE: set404Override - setLocale not working? - InsiteFX - 08-26-2021 I think you need to call the Controllers initController. PHP Code: /** Add that and see if it fixes it. |