1. Go to this page and download the library: Download basteyy/php-i18n 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/ */
basteyy / php-i18n example snippets
// Content of /var/www/index.php
use basteyy\I18n\I18n;
I18n::addTranslationFolder(__DIR__ . '/lang/');
I18n::addTranslationFolder(__DIR__ . '/another_folder/');
I18n::setTranslationLanguage('de_DE');
echo __('Add');
// Result: Hinzufügen
echo __("Remove");
// Result: Entfernen
echo __('Remove %s Item\'s ', 3212);
// Result: 3212 Dinge entfernen
echo __('A new string');
// Result: A new string
echo __('A new string with placeholder %s', 'inside');
// Result: A new string with placeholder inside