How to use PEAR i18n library
1. Download PEAR i18n package to your local machine
http://pear.php.net/packages.php?catpid=28&catname=Internationalization
2. Upload it to your server
3. Add the library path to php include_path using ini_set:
ini_set (”include_path”, “.:/www/facebook/pear:/usr/local/php5/lib/php”);
4. Use it
//loading PEAR I18Nv2
require_once ‘I18Nv2.php’;
require_once ‘I18Nv2/Locale.php’;
require_once ‘I18Nv2/Language.php’;
$i18nv2_lang = &new I18Nv2_Language($locale, ‘UTF-8′);
$i18nv2_locale = &I18Nv2::createLocale($locale);
- Getting translated language names
foreach ($i18nv2_lang->codes as $lang_code => $lang_translated) {
…
}
- Getting formatted date & time
$fdate= $i18nv2_locale->formatDate($time, I18Nv2_DATETIME_MEDIUM) ;
$ftime = $i18nv2_locale->formatTime($time, I18Nv2_DATETIME_MEDIUM);