Welcome Guest, Not a member yet? Register   Sign In
Translate validation errors / messages based on locale
#1

(This post was last modified: 08-16-2024, 01:05 PM by sevmusic.)

We are added language support in our program.

I have a mechanism that will set the locale to es / en.

Everything is dandy, until you get a validation error / message.

For example: Let's say i have an "I Agree" checkbox that is required to be checked upon form submission.

in my controller I have:

PHP Code:
$this->validate(['agree' => ['label' => 'I agree''rules' => 'required']]); 


And it will give me an error: "The I agree field is required." if the checkbox is left unchecked.

That's great if this were the 'en' version, but I get the same built-in language for the 'es' version.

Is there a way I can add language support for these built-in messages without having to type out every validation message for every field in other languages?

Thank in advanced.

Max
Reply
#2

Overriding System Message Translations
https://codeigniter4.github.io/CodeIgnit...anslations
Reply




Theme © iAndrew 2016 - Forum software by © MyBB