Welcome Guest, Not a member yet? Register   Sign In
Translating Field Names
#1

[eluser]Unknown[/eluser]
Hi everyone!
I'm trying to translate the config error of my form. Let say i have an input field 'first_name' I want to apply the validation on it but if there is an error I want it to be output in french. I created this on my french_lang.php file
Code:
$lang["first_name"]="Le champ Prénom est nécessaire.";
on the output it showed me this:
The Le champ Prénom est nécessaire. field is required.
it nested my translation within the error string.

it add my translation into the sentence but I wanted to print only my sentence:
Le champ Prénom est nécessaire.

I follow the guide
http://ellislab.com/codeigniter/user-gui...nslatingfn

in my rules I had the lang: to the field that I want the translation
Code:
//load the french_lang.php on the french folder
$this->lang->load('french', 'french');
$config = array(
               array(
                     'field'   => 'prenom',
                     'label'   => 'lang:first_name',
                     'rules'   => 'required|trim|min_length[2]|xss_clean|prep_for_form'
                  ),

I did load my language file

Also I d'like to know how can I put a custom translation to the min_length?
#2

[eluser]TheFuzzy0ne[/eluser]
./application/language/french/french_lang.php
Code:
$lang["first_name"] = 'Prénom';

./application/language/french/form_validation.php
Code:
$lang['required'] = 'Le champ de %s est nécessaire.';
$lang['min_length'] = 'Le champ de %s doit être d'au moins %s caractères de longueur';

Apologies for my bad French. Smile
#3

[eluser]Unknown[/eluser]
Thanks a lot for this! Don't worry your french is perfect! Smile




Theme © iAndrew 2016 - Forum software by © MyBB