1. Go to this page and download the library: Download pyrsmk/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/ */
pyrsmk / translator example snippets
$translator = new Translator\Http('en_EN');
$translator->setLocale('fr');
$translator->getLocale();
// Load the JSON file
$translator->load('fr_FR', json_decode(file_get_contents('fr_FR.json')));
// Prints 'chien'
echo $translator->translate('dog');
// Prints 'Bonjour, M. Philippe!'
echo $translator->translate('hello', [
'name' => 'Philippe'
]);
// Prints 'sl_IT'
echo $translator->normalizeLocale('sl_Latn-IT_nedis');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.