1. Go to this page and download the library: Download tleckie/translate 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/ */
tleckie / translate example snippets
use Tleckie\Translate\Loader\ArrayLoader;
use Tleckie\Translate\Translator;
$trans = new Translator(
new ArrayLoader('./translations/','php'),
'es_ES'
);
$trans->trans('hello');
$trans->trans('other.value');
return [
'hello' => "Hola! Bienvenido a mi sitio web!",
'other.value' => "Otro valor",
.
.
.
];
use Tleckie\Translate\Loader\ArrayLoader;
use Tleckie\Translate\Translator;
$trans = new Translator(
new ArrayLoader('./translations/','php'),
'es_ES'
);
$trans->trans('hello',['John']);
return [
'hello' => "Hola %s! Bienvenido a mi sitio web!"
];
use Tleckie\Translate\Loader\ArrayLoader;
use Tleckie\Translate\Translator;
$trans = new Translator(
new ArrayLoader('./translations/','php'),
'es_ES'
);
$trans->trans('hello',['John'],null, 'en_GB');
use Tleckie\Translate\Loader\ArrayLoader;
use Tleckie\Translate\Translator;
$trans = new Translator(
new ArrayLoader('./translations/','php'),
'es_ES'
);
$trans->trans('hello',['John'],null, 'en_GB');
$trans->trans('hello',['John'],null, 'en_US');
bash
/translations/es_ES.php
bash
/translations/en.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.