Welcome Guest, Not a member yet? Register   Sign In
$this->validation->set_message simple issue
#1

[eluser]EEssam[/eluser]
Hello,

The app I'm coding is not in English, so I'm trying to do the following:

// username
$rules['username'] = "required";
$this->validation->set_message($rules['username'], 'username is a required field in my language');

// password
$rules['password'] = "required";
$this->validation->set_message($rules['password'], 'password is a required field in my language');

The problem is I'm getting "password is a required field in my language" for both fields Sad

For instance, I just can't write:

- Username est un champ obligatoire (in french), it should be something like:

- Le nom d'utilisateur est un champ obligatoire

How can I overcome this problem?

Your help would be greatly appreciated.
#2

[eluser]xwero[/eluser]
Why not set the default language to french, that is the easiest solution. There is a french languagepack available on the wiki.
#3

[eluser]EEssam[/eluser]
How can I get "Le nom d’utilisateur est un champ obligatoire" instead of "Username est un champ obligatoire" in doing that?
#4

[eluser]xwero[/eluser]
Then you have to use the set_fields method
Code:
$fields['username'] = "le nom d'utilisateur";
$this->validation->set_fields($fields);
#5

[eluser]EEssam[/eluser]
Thank you very much that worked perfectly. I knew there was a clever solution for this Smile




Theme © iAndrew 2016 - Forum software by © MyBB