Validation oddities |
Hi! I'm learning CI4, I have been using CI for a while but I figured out it's time to (try to) switch
![]() I'm facing some oddities in form validation app/Controllers/Login.php Code: public function index(){ app/Views/pages/login.php have this code on top: Code: $validation = \Config\Services::validation(); app/Views/templates/header.php have this code on top: this is "if a user is logged in, use his language otherwise if hl=something is set in the url use that (or fallback to English) otherwise just use English" Code: <?php app/Config/Routes.php Code: $routes->get('/', 'Login::index'); Oddities are: 1) the validation default messages are always localized in Italian. I have downloaded the "it" package from here https://github.com/codeigniter4/translations and put that in the Lang folder. without it/Validation.php every validation message is in English, with the it/Validatio.php every message is in Italian. I have labels in my login.php view that are showing correctly in English/italian (for instance <?=lang('my_text_lang.text_login_remember');?> ) so I think the code at the beginning of my header should work. I have buttons/labels in English but validation errors in Italian... 2) redirect('Login')->withInput(); will bring me to //localhost:8888/MY_CI_PROJECT/public/index.php/Login instead of //localhost:8888/MY_CI_PROJECT/public 3)I'm not completely sure about this but, after triggering the validation, if I manually change the URL to //localhost:8888/MY_CI_PROJECT/public/Login something redirects me to //localhost:8888/Login opening a new browser and go to //localhost:8888/MY_CI_PROJECT/public/Login doesn't do that... I'm developing with MAMP on macOS, htaccess file is the default one. thanks! |
Welcome Guest, Not a member yet? Register Sign In |