PHP code example of phpfui / translation

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

    

phpfui / translation example snippets


namespace PHPFUI\Translation;
// specify where the translations are located
Translator::setTranslationDirectory(__DIR__ . '/trans');
// set the base locale, ie. the language of any native translations (unchunked)
Translator::setBaseLocale('EN-us');
// set the user's locale
Translator::setLocale('ES-us');
// get the ES-us version of 'red'
$translated = Translator::trans('red');
// get chunked version of colors.
$translated = Translator::trans('.colors.red');

// translate with parameters and pluralized
$translated = Translator::trans('.messages.recordsFound', ['count' => $found]);