PHP code example of daycry / codeigniter-language

1. Go to this page and download the library: Download daycry/codeigniter-language library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

daycry / codeigniter-language example snippets


$psr4 = [
    'Config'      => APPPATH . 'Config',
    APP_NAMESPACE => APPPATH,
    'App'         => APPPATH,
    'Daycry\Language' => APPPATH .'ThirdParty/codeigniter-language/src',
];

$language = new \Daycry\Language\Language( \Config\Services::request()->getLocale() );
$language->loadFile( 'Validation' );

var_dump( $language->getTraductions() );


$language = \Config\Services::language();
$language->loadFile( 'Validation' );

var_dump( $language->getTraductions() );


$this->twig->addGlobal( 'traductions', $this->language->getTraductions() );


echo view( 'some_view' );


<script>
    var traductions =  echo json_encode( $this->language->getTraductions() );