1. Go to this page and download the library: Download gelight/sml-i18n-for-php 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/ */
gelight / sml-i18n-for-php example snippets
ight\smlI18n\{smlI18n};
$i18n = new smlI18n();
$i18n->loadTranslations(__DIR__."/translations");
$i18n->setCurrentLocale("en");
# You can use also the short notation of the most important properties in the same example
$i18n = new smlI18n(__DIR__."/translations", "en");
# The method t() returns the corresponding translation
echo $i18n->t("sml.title");
echo $i18n->t("sml.description");
$i18n = new smlI18n();
$i18n->loadTranslations("path/to/your/translations/folder");
# Short notation by using the first constructor parameter
$i18n = new smlI18n("path/to/your/translations/folder");
echo $i18n->getDefaultLocale(); // result for example > "en"
$i18n->setDefaultLocale("en"); // Standard default locale is "de"