PHP code example of delboy1978uk / bone-i18n

1. Go to this page and download the library: Download delboy1978uk/bone-i18n 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/ */

    

delboy1978uk / bone-i18n example snippets




use Laminas\I18n\Translator\Loader\Gettext;

return [
    'i18n' => [
        'enabled' => true,
        'translations_dir' => 'data/translations',
        'type' => Gettext::class,
        'default_locale' => 'en_PI',
        'supported_locales' => ['en_PI', 'en_GB', 'nl_BE', 'fr_BE'],
        'date_format' => 'd/m/Y',
    ]
];

<?= $this->locale() 

<?= $this->l() 

$locale = $request->getAttribute('locale');

return  Init::controller(new YourController(), $c);

<?= $this->translate('whatever.key.to.translate') ;

<?= $this->t('whatever.key.to.translate') ;