This file is part of poMMo (http://www.pommo.org) poMMo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or any later version. poMMo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with program; see the file docs/LICENSE. If not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Example #1
0
 function _setlocale($category, $locale, $baseDir)
 {
     if (defined('_poMMo_gettext')) {
         return Pommo_Helper_L10n::_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;
 }
Example #2
0
 function _TP($msg, $plural, $count)
 {
     if (Pommo::$_escaping) {
         return Pommo::$_l10n ? htmlspecialchars(Pommo_Helper_L10n::translatePlural($msg, $plural, $count)) : htmlspecialchars($msg);
     }
     return Pommo::$_l10n ? Pommo_Helper_L10n::translatePlural($msg, $plural, $count) : $msg;
 }