示例#1
0
 function _setlocale($category, $locale, $baseDir)
 {
     if (defined('_poMMo_gettext')) {
         return PommoHelperL10n::_setLocaleEmu($category, $locale, $baseDir);
     }
     // append _LC to locale
     if (!strpos($locale, '_')) {
         $locale = $locale . '_' . strtoupper($locale);
     }
     if (($ret = setlocale($category, $locale)) !== false) {
         return $ret;
     }
     /* Try just selecting the language */
     if (($i = strpos($locale, '_')) !== false && ($ret = setlocale($category, substr($locale, 0, $i))) !== false) {
         return $ret;
     }
     /*
      * Try appending some character set names; some systems (like FreeBSD) need this.
      * Some require a format with hyphen (e.g. gentoo) and others without (e.g. FreeBSD).
      */
     foreach (array('UTF-8', 'UTF8', 'utf8', 'ISO8859-1', 'ISO8859-2', 'ISO8859-5', 'ISO8859-7', 'ISO8859-9', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-5', 'ISO-8859-7', 'ISO-8859-9', 'EUC', 'Big5') as $charset) {
         if (($ret = setlocale($category, $locale . '.' . $charset)) !== false) {
             return $ret;
         }
     }
     return false;
 }
示例#2
0
 function _TP($msg, $plural, $count)
 {
     // for plurals
     global $pommo;
     if ($pommo->_escaping) {
         return $pommo->_l10n ? htmlspecialchars(PommoHelperL10n::translatePlural($msg, $plural, $count)) : htmlspecialchars($msg);
     }
     return $pommo->_l10n ? PommoHelperL10n::translatePlural($msg, $plural, $count) : $msg;
 }