⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Validation message language



nunenthal

nunenthal
  • profile picture
  • Member

Posted 13 May 2019 - 16:10 PM

Hello,

 

How to set the language for the valitron library.

 

Thank you.

 

I use

$crud->setLanguage('French');

 

But don't work.

 

Thank you.

 


web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 17 June 2019 - 08:21 AM

Hello,

 

How to set the language for the valitron library.

 

Thank you.

 

I use

$crud->setLanguage('French');

 

But don't work.

 

Thank you.

 

Hello @nunenthal,

 

Currently this is not working "out of the box" as the mapping is a bit different. I will try to see if I can do something automatically at the future to pick it up automatically. Till then you can use the below work-around: 

Add the below line anywhere before the render() :

 

\Valitron\Validator::lang('fr');

This will enable the language for "French" for Valitron

 

I will try to have this to work out of the box in the future so you will not have to do it manually this step. 

 

Let me know if that worked for you

 

Regards

Johnny


nunenthal

nunenthal
  • profile picture
  • Member

Posted 17 June 2019 - 16:10 PM

Perfect, this work for me, added in the construct  function like this, so it's just one time for all my administration function, no worry

 

 

public function __construct()
    {
        parent::__construct();
                \Valitron\Validator::lang('fr');
        $this->load->database();
        $this->load->helper('url');
                $this->load->library('session');
                $this->load->helper('form');
                $this->load->model('login_m');
      
        include(APPPATH . 'config/config.php');
               }

       
 


web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 18 June 2019 - 14:18 PM

Perfect, this work for me, added in the construct  function like this, so it's just one time for all my administration function, no worry

 

 

public function __construct()
    {
        parent::__construct();
                \Valitron\Validator::lang('fr');
        $this->load->database();
        $this->load->helper('url');
                $this->load->library('session');
                $this->load->helper('form');
                $this->load->model('login_m');
      
        include(APPPATH . 'config/config.php');
               }

       
 

 

I am glad that this worked for you :)

In case you are interested, I've scheduled to have a permanent fix for the next release. It will probably pick up the language automatically from setLanguage. If you would like to track the progress of this task you can go to: https://trello.com/c/if8EaJ0M/27-gc-399-validation-message-doesnt-pick-up-the-language-automatically and press the button "Follow"

 

Regards

Johnny


web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 22 June 2019 - 06:16 AM

I am glad to inform you that at the new version of Grocery CRUD Enterprise (2.7.6) this extra step is not required anymore as it happens automatically.

 

In case you would like to download the latest version visit: https://www.grocerycrud.com/users/enterprise_latest_version

 

Regards

Johnny