本文整理汇总了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");
}
}
示例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);
}
}
示例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");
}
}
示例4: setUp
public function setUp()
{
MoTranslator\Loader::loadFunctions();
_setlocale(0, 'cs');
_textdomain('phpmyadmin');
_bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
}
示例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);
}
示例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));
}
示例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');
}
}
示例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');
}
}
示例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) {
示例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
示例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());
示例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();
}
示例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');
示例14: bind_textdomain_codeset
function bind_textdomain_codeset($domain, $codeset)
{
return _bind_textdomain_codeset($domain, $codeset);
}
示例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");
}
}