1. Go to this page and download the library: Download vertilia/text 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/ */
vertilia / text example snippets
new Vertilia\Text\Text();
echo $t->_('Just a test'), PHP_EOL; // output: Just a test
echo $t->pget('page', 'Next'), PHP_EOL; // output: Next
echo $t->nget('One page', 'Multiple pages', 1), PHP_EOL; // output: One page
echo $t->nget('One page', 'Multiple pages', 5), PHP_EOL; // output: Multiple pages
echo $t->npget('page', 'One sent', 'Multiple sent', 5), PHP_EOL; // output: Multiple sent
new App\L10n\MessagesFr();
echo $t->_('Just a test'), PHP_EOL; // output: Juste un test
echo $t->pget('page', 'Next'), PHP_EOL; // output: Suivante
echo $t->nget('One page', 'Multiple pages', 1), PHP_EOL; // output: Une page
echo $t->nget('One page', 'Multiple pages', 5), PHP_EOL; // output: Plusieurs pages
echo $t->npget('page', 'One sent', 'Multiple sent', 5), PHP_EOL; // output: Plusieurs envoyées
public function _(string $message): string;
$t = \Vertilia\Text\Text();
echo $t->_("Several words"); // output: Several words
$t = \App\L10n\MessagesRu();
echo $t->_("Several words"); // output: Несколько слов
public function nget(string $singular, string $plural, int $count): string;
putenv('LC_ALL=fr_FR');
setlocale(LC_ALL, 'fr_FR');
bindtextdomain("myPHPApp", "./locale");
textdomain("myPHPApp");
echo gettext("Welcome to My PHP Application"), "\n";
echo dgettext("anotherPHPApp", "Welcome to Another PHP Application"), "\n";
$myDomain = \App\L10n\MyPhpAppFr();
$anotherDomain = \App\L10n\AnotherPhpAppFr();
echo $myDomain->_("Welcome to My PHP Application"), "\n";
echo $anotherDomain->_("Welcome to Another PHP Application"), "\n";