Pommo_Helper_L10n::_setlocale PHP Method

_setlocale() public static method

setlocale modified from from Gallery2
public static _setlocale ( $category, $locale, $baseDir )
    public static 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;
    }