PHP code example of paquettg / i18n

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

    

paquettg / i18n example snippets


use I18n\I18n;

$i18n = new I18n;
$i18n->set([
	'foo' => 'bar',
	'baz' => [
		'rawr' => 'meow?',
	],
], 'en_CA');
$i18n->load('en_CA');

echo $i18n->get('baz.rawr'); // will output 'meow?'

use I18n\I18n;

$i18n = new I18n;
$i18n->load($pathToLocaleDirectory);
$i18n->load($locale);

use I18n\Facade\StaticI18n;

StaticI18n::mount();
I18n::set([
	'foo' => 'bar',
	'baz' => [
		'rawr' => 'meow?',
	],
], 'en_CA');
I18n::load('en_CA');
echo I18n::get('baz.rawr');