PHP code example of jord-jd / translator
1. Go to this page and download the library: Download jord-jd/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/ */
jord-jd / translator example snippets
use JordJD\Translator\Translator;
$translator = new Translator();
$translator->loadTranslationData(__DIR__.'/resources/lang/en.json');
$translator->loadTranslationArray([
'welcome' => 'Welcome, :name!',
]);
$translator = new Translator('en');
echo $translator->translate('welcome', ['name' => 'Jordan']);
$translator->has('welcome');
$translations = $translator->all();