PHP code example of ajda2 / simple-translator

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

    

ajda2 / simple-translator example snippets


use ajda2\Localization\ArrayTranslator;

nslator.php';

$strictMode = FALSE;
$enTable = >translate('form.validate.invalid_email') . PHP_EOL; // valid translation
echo $translator->translate('czech_only'); // return 'czech_only' because strictMode is disabled

$translator->setStrictMode(TRUE);

echo $translator->translate('czech_only'); // throw MissingTranslationException because of strict mode