PHP code example of koded / i18n

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

    

koded / i18n example snippets


__(string $message, array $arguments => [], string $locale = '');

use Koded\Stdlib\Config;
use Koded\I18n\{ArrayCatalog, DefaultFormatter, I18n, I18nCatalog};

// all conf directives are optional
$config = new Config([
    'translation.catalog' => ArrayCatalog::class,
    'translation.formatter' => DefaultFormatter::class,
    'translation.dir' => '/path/to/your/translation/files',
    'translation.locale' => ['mk_MK', 'de_DE', 'it_IT'],
]);

I18n::register(I18nCatalog::new($config));

return [
    'language' => '',
    'messages' => [
        // your translation strings goes here
        'original string' => 'translated string',
    ]
];