当前位置: 首页>>代码示例>>PHP>>正文


PHP _bind_textdomain_codeset函数代码示例

本文整理汇总了PHP中_bind_textdomain_codeset函数的典型用法代码示例。如果您正苦于以下问题:PHP _bind_textdomain_codeset函数的具体用法?PHP _bind_textdomain_codeset怎么用?PHP _bind_textdomain_codeset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_bind_textdomain_codeset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startup_gettext

function startup_gettext()
{
    # Get locale from Accept-Language header
    $lang = al2gt(array_keys(get_translations()), "text/html");
    if (defined('_TRANSLATION_OVERRIDE_DEFAULT')) {
        $lang = _TRANSLATION_OVERRIDE_DEFAULT;
    }
    /* In login action of mobile version */
    if ($_POST["language"] && defined('MOBILE_VERSION')) {
        $lang = $_POST["language"];
    } else {
        if ($_SESSION["language"] && $_SESSION["language"] != "auto") {
            $lang = $_SESSION["language"];
        }
    }
    if ($lang) {
        if (defined('LC_MESSAGES')) {
            _setlocale(LC_MESSAGES, $lang);
        } else {
            if (defined('LC_ALL')) {
                _setlocale(LC_ALL, $lang);
            }
        }
        if (defined('MOBILE_VERSION')) {
            _bindtextdomain("messages", "../locale");
        } else {
            _bindtextdomain("messages", "locale");
        }
        _textdomain("messages");
        _bind_textdomain_codeset("messages", "UTF-8");
    }
}
开发者ID:rclsilver,项目名称:openshift-tt-rss,代码行数:32,代码来源:functions.php

示例2: bindTextDomain

 /**
  * bind text domain.
  * 
  * @param string $domain text domain
  * @param string $directory directory where the translation file is. the directory must have trailing slash.
  * @param string $language_locale_uri language to check translation file exists.
  */
 public function bindTextDomain($domain, $directory, $language_locale_uri)
 {
     if (is_file($directory . $language_locale_uri . DS . 'LC_MESSAGES' . DS . $domain . '.mo') && function_exists('_bindtextdomain') && function_exists('_bind_textdomain_codeset')) {
         _bindtextdomain($domain, $directory);
         _bind_textdomain_codeset($domain, $this->encoding);
     }
 }
开发者ID:AgniCMS,项目名称:agni-framework,代码行数:14,代码来源:Language.php

示例3: startup_gettext

function startup_gettext()
{
    # Get locale from Accept-Language header
    $lang = al2gt(array_keys(get_translations()), "text/html");
    if (defined('_TRANSLATION_OVERRIDE_DEFAULT')) {
        $lang = _TRANSLATION_OVERRIDE_DEFAULT;
    }
    if ($_SESSION["uid"] && get_schema_version() >= 120) {
        $pref_lang = get_pref("USER_LANGUAGE", $_SESSION["uid"]);
        if ($pref_lang && $pref_lang != 'auto') {
            $lang = $pref_lang;
        }
    }
    if ($lang) {
        if (defined('LC_MESSAGES')) {
            _setlocale(LC_MESSAGES, $lang);
        } else {
            if (defined('LC_ALL')) {
                _setlocale(LC_ALL, $lang);
            }
        }
        _bindtextdomain("messages", "locale");
        _textdomain("messages");
        _bind_textdomain_codeset("messages", "UTF-8");
    }
}
开发者ID:neynah,项目名称:Tiny-Tiny-RSS,代码行数:26,代码来源:functions.php

示例4: setUp

 public function setUp()
 {
     MoTranslator\Loader::loadFunctions();
     _setlocale(0, 'cs');
     _textdomain('phpmyadmin');
     _bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
     _bind_textdomain_codeset('phpmyadmin', 'UTF-8');
 }
开发者ID:phpmyadmin,项目名称:motranslator,代码行数:8,代码来源:FunctionsTest.php

示例5: changeLocale

function changeLocale($newlocale)
{
    global $CURRENTLOCALE, $EMULATEGETTEXT, $text_domains;
    $CURRENTLOCALE = $newlocale;
    $EMULATEGETTEXT = 1;
    _textdomain('kusaba');
    _setlocale(LC_ALL, $newlocale);
    _bindtextdomain('kusaba', KU_ROOTDIR . 'inc/lang', $newlocale);
    _bind_textdomain_codeset('kusaba', KU_CHARSET);
}
开发者ID:nan0desu,项目名称:xyntach,代码行数:10,代码来源:misc.php

示例6: testGettext

 /**
  * Test for setting and parsing locales
  *
  * @param string $locale locale name
  *
  * @return void
  *
  * @group large
  * @dataProvider listLocales
  */
 public function testGettext($locale)
 {
     /* We should be able to set the language */
     $this->assertTrue(PMA_langSet($locale));
     /* Bind locales */
     _setlocale(LC_MESSAGES, $GLOBALS['lang']);
     _bind_textdomain_codeset('phpmyadmin', 'UTF-8');
     _textdomain('phpmyadmin');
     /* Grab some texts */
     $this->assertContains('%s', _ngettext('%s table', '%s tables', 10));
     $this->assertContains('%s', _ngettext('%s table', '%s tables', 1));
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:22,代码来源:locale_gettext_test.php

示例7: init_locale

function init_locale($locale, $error = 'error')
{
    if (_setlocale(LC_ALL, $locale) === false) {
        $error('The specified locale (' . $locale . ') does not exist on your platform!');
    }
    if (extension_loaded('gettext')) {
        bindtextdomain('tinyboard', './inc/locale');
        bind_textdomain_codeset('tinyboard', 'UTF-8');
        textdomain('tinyboard');
    } else {
        _bindtextdomain('tinyboard', './inc/locale');
        _bind_textdomain_codeset('tinyboard', 'UTF-8');
        _textdomain('tinyboard');
    }
}
开发者ID:vicentil,项目名称:vichan,代码行数:15,代码来源:functions.php

示例8: init_locale

function init_locale($locale, $error = 'error')
{
    if ($locale === 'en') {
        $locale = 'en_US.utf8';
    }
    if (extension_loaded('gettext')) {
        setlocale(LC_ALL, $locale);
        bindtextdomain('tinyboard', './inc/locale');
        bind_textdomain_codeset('tinyboard', 'UTF-8');
        textdomain('tinyboard');
    } else {
        _setlocale(LC_ALL, $locale);
        _bindtextdomain('tinyboard', './inc/locale');
        _bind_textdomain_codeset('tinyboard', 'UTF-8');
        _textdomain('tinyboard');
    }
}
开发者ID:Cipherwraith,项目名称:infinity,代码行数:17,代码来源:functions.php

示例9: file_exists

    require PHPDISK_ROOT . 'includes/class/' . $arr[$i] . '.class.php';
}
require PHPDISK_ROOT . 'includes/phpdisk_version.inc.php';
$C['gz']['open'] = $settings['gzipcompress'];
phpdisk_core::gzcompress_open();
$db = phpdisk_core::init_db_connect();
$setting_file = PHPDISK_ROOT . 'system/settings.inc.php';
file_exists($setting_file) ? require_once $setting_file : settings_cache();
$arr = phpdisk_core::init_lang_tpl();
$user_tpl_dir = 'templates/default/';
$admin_tpl_dir = $arr['admin_tpl_dir'];
$C['lang_type'] = $arr['lang_name'];
require PHPDISK_ROOT . 'includes/lib/php-gettext/gettext.inc.php';
_setlocale(LC_MESSAGES, $C['lang_type']);
_bindtextdomain('phpdisk', 'languages');
_bind_textdomain_codeset('phpdisk', $charset);
_textdomain('phpdisk');
if (!@get_magic_quotes_gpc()) {
    $_GET = addslashes_array($_GET);
    $_POST = addslashes_array($_POST);
    $_COOKIE = addslashes_array($_COOKIE);
}
$group_settings_file = PHPDISK_ROOT . 'system/global/group_settings.inc.php';
file_exists($group_settings_file) ? require_once $group_settings_file : group_settings_cache();
list($pd_uid, $pd_gid, $pd_username, $pd_pwd, $pd_email) = gpc('phpdisk_zcore_info', 'C', '') ? explode("\t", pd_encode(gpc('phpdisk_zcore_info', 'C', ''), 'DECODE')) : array('', '', '', '', '');
$pd_uid = (int) $pd_uid;
if (!$pd_uid || !$pd_pwd) {
    $pd_uid = 0;
} else {
    $userinfo = $db->fetch_one_array("select userid,u.gid,username,password,email,group_name from {$tpf}users u,{$tpf}groups g where username='{$pd_username}' and password='{$pd_pwd}' and u.gid=g.gid limit 1");
    if ($userinfo) {
开发者ID:saintho,项目名称:phpdisk,代码行数:31,代码来源:commons.inc.php

示例10: dirname

// 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 this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include_once dirname(__FILE__) . '/php-gettext/gettext.inc';
include_once dirname(__FILE__) . '/iso-set.php';
if (!defined('SESSION_DISABLE')) {
    LoadObjectDependency('net.php.pear.HTTP_Session2');
    $lang = HTTP_Session2::get('language', DEFAULT_LANGUAGE);
} else {
    $lang = DEFAULT_LANGUAGE;
}
$locale_dir = dirname(dirname(__FILE__)) . '/locale';
$__domains = array('freemed', UI);
_setlocale(LC_MESSAGES, $lang);
$GLOBALS['ISOSET'] = language2isoset($lang);
foreach ($__domains as $_v) {
    _bindtextdomain($_v, $locale_dir);
    _bind_textdomain_codeset($_v, language2isoset($lang));
    _textdomain($_v);
}
function get_translation_matrix($domain)
{
    global $default_domain;
    $default_domain = $domain;
    $l10n = _get_reader();
    return $l10n->cache_translations;
}
// end method get_translation_matrix
开发者ID:rrsc,项目名称:freemed,代码行数:31,代码来源:i18n.php

示例11: unset

    unset($cf);
}
// DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING OR ELSE BAD THINGS MAY HAPPEN
$modules_loaded = array();
$required = array(KU_ROOTDIR, KU_WEBFOLDER, KU_WEBPATH);
if (in_array('CHANGEME', $required) || in_array('', $required)) {
    echo 'You must set KU_ROOTDIR, KU_WEBFOLDER, and KU_WEBPATH before installation will finish!';
    die;
}
require KU_ROOTDIR . 'lib/gettext/gettext.inc.php';
require KU_ROOTDIR . 'lib/adodb/adodb.inc.php';
// Gettext
_textdomain('kusaba');
_setlocale(LC_ALL, KU_LOCALE);
_bindtextdomain('kusaba', KU_ROOTDIR . 'inc/lang');
_bind_textdomain_codeset('kusaba', KU_CHARSET);
// SQL  database
if (!isset($tc_db) && !isset($preconfig_db_unnecessary)) {
    $tc_db =& NewADOConnection(KU_DBTYPE);
    if (KU_DBUSEPERSISTENT) {
        $tc_db->PConnect(KU_DBHOST, KU_DBUSERNAME, KU_DBPASSWORD, KU_DBDATABASE) or die('SQL database connection error: ' . $tc_db->ErrorMsg());
        mysql_query('SET NAMES utf8');
    } else {
        $tc_db->Connect(KU_DBHOST, KU_DBUSERNAME, KU_DBPASSWORD, KU_DBDATABASE) or die('SQL database connection error: ' . $tc_db->ErrorMsg());
        mysql_query('SET NAMES utf8');
    }
    // SQL debug
    if (KU_DEBUG) {
        $tc_db->debug = true;
    }
    $results_events = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "events` WHERE `at` <= " . time());
开发者ID:nan0desu,项目名称:xyntach,代码行数:31,代码来源:config.php

示例12: activate

 /**
  * Activates given translation
  *
  * @return bool
  */
 public function activate()
 {
     $GLOBALS['lang'] = $this->code;
     // Set locale
     _setlocale(LC_MESSAGES, $this->code);
     _bindtextdomain('phpmyadmin', LOCALE_PATH);
     _bind_textdomain_codeset('phpmyadmin', 'UTF-8');
     _textdomain('phpmyadmin');
     /* Text direction for language */
     if ($this->isRTL()) {
         $GLOBALS['text_dir'] = 'rtl';
     } else {
         $GLOBALS['text_dir'] = 'ltr';
     }
     /* TCPDF */
     $GLOBALS['l'] = array();
     /* TCPDF settings */
     $GLOBALS['l']['a_meta_charset'] = 'UTF-8';
     $GLOBALS['l']['a_meta_dir'] = $GLOBALS['text_dir'];
     $GLOBALS['l']['a_meta_language'] = $this->code;
     /* TCPDF translations */
     $GLOBALS['l']['w_page'] = __('Page number:');
     /* Show possible warnings from langauge selection */
     LanguageManager::getInstance()->showWarnings();
 }
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:30,代码来源:Language.php

示例13: ev_ngettext

        }
    }
    function ev_ngettext($string, $plural, $number)
    {
        return ngettext($string, $plural, $number);
    }
    function _bind_textdomain_codeset($domain, $codeset)
    {
        return bind_textdomain_codeset($domain, $codeset);
    }
    function _bindtextdomain($domain, $path)
    {
        return bindtextdomain($domain, $path);
    }
    function _textdomain($domain)
    {
        return textdomain($domain);
    }
    function _gettext($msgid)
    {
        return gettext($msgid);
    }
    function _setlocale($category, $locale)
    {
        return setlocale($category, $locale);
    }
}
// this won't change over the request. so set it once and permanently
_bindtextdomain('eventum', APP_PATH . '/localization/');
_bind_textdomain_codeset('eventum', APP_CHARSET);
_textdomain('eventum');
开发者ID:dabielkabuto,项目名称:eventum,代码行数:31,代码来源:gettext.php

示例14: bind_textdomain_codeset

 function bind_textdomain_codeset($domain, $codeset)
 {
     return _bind_textdomain_codeset($domain, $codeset);
 }
开发者ID:vezla,项目名称:pH7-Social-Dating-CMS,代码行数:4,代码来源:gettext.inc.php

示例15: knjlocales_setmodule

/** Initilializes the chosen locales-module. */
function knjlocales_setmodule($domain, $dir, $module = "ext", $language = "auto"){
	global $functions_knjlocales;
	
	$functions_knjlocales["dir"] = $dir;
	$functions_knjlocales["module"] = $module;
	
	if ($language == "auto"){
		if (array_key_exists("HTTP_ACCEPT_LANGUAGE", $_SERVER) and $_SERVER["HTTP_ACCEPT_LANGUAGE"]){
			$accept = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
			foreach(explode(",", $accept) AS $value){
				$value = explode(";", $value);
				$language = $value[0];
				break;
			}
		}elseif($_SERVER["LANG"]){
			if (preg_match("/^([a-z]{2}_[A-Z]{2})/", $_SERVER["LANG"], $match)){
			$language = $match[1];
			}else{
				//Language could not be matched - default english.
				$language = "en_GB";
			}	
		}
		
		if ($language == "da"){
			$language = "da_DK";
		}elseif($language == "de"){
			$language = "de_DE";
		}elseif($language == "en"){
			$language = "en_GB";
		}
	}
	
	$language = strtr($language, array(
		"-" => "_"
	));
	if (preg_match("/^([A-z]{2})_([A-z]{2})$/", $language, $match)){
		$language = strtolower($match[1]) . "_" . strtoupper($match[2]);
	}
	
	$functions_knjlocales["language"] = $language;
	
	if (!file_exists($dir)){
		throw new exception("Dir does not exist: " . $dir);
	}
	
	if ($module == "php-gettext"){
		require_once "php-gettext/gettext.inc";
		$functions_knjlocales["module"] = "php-gettext";
		
		_setlocale(LC_ALL, $language);// or die("Locales error 5\n");
		_setlocale(LC_MESSAGES, $language);// or die("Locales error 6\n");
		_bindtextdomain($domain, $dir);
		_bind_textdomain_codeset($domain, "UTF-8");
		_textdomain($domain);
	}elseif($module == "ext"){
		require_once "knj/functions_knj_extensions.php";
		if (!knj_dl("gettext")){
			throw new exception("gettext-module could not be loaded.");
		}
		
		$functions_knjlocales["module"] = "ext";
		
		putenv("LANGUAGE=" . $language); 
		putenv("LC_ALL=" . $language);
		putenv("LC_MESSAGE=" . $language);
		putenv("LANG=" . $language); 
		
		$locales_language_real = $language . ".utf8";
		setlocale(LC_ALL, $locales_language_real);
		setlocale(LC_MESSAGES, $locales_language_real);
		
		bindtextdomain($domain, $dir);
		bind_textdomain_codeset($domain, "UTF-8");
		textdomain($domain);
	}else{
		throw new exception("knjlocales (" . __FILE__ . ":" . __LINE__ . "): No such module: " . $module . "\n");
	}
}
开发者ID:kaspernj,项目名称:knjphpfw,代码行数:79,代码来源:locales.php


注:本文中的_bind_textdomain_codeset函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。