PHP code example of phellow / intl
1. Go to this page and download the library: Download phellow/intl 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/ */
phellow / intl example snippets
$intl = new IntlService('en_US');
$intl->setAvailableLocales(['en_US', 'de_DE']);
// get current locale
$locale = $intl->getLocale();
// translate texts
$translator = new ArrayTranslator('path/to/translation-files');
$intl->setTranslator($translator);
$text = $intl->_('translate this');
$text = $intl->_n('one', 'more', 2);