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


PHP T_bindtextdomain函数代码示例

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


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

示例1: initiate

 /**
  * TuiyoLocalize::initiate()
  * Initiates a language domain
  * @param mixed $domain
  * @param mixed $locale
  * @param mixed $encoding
  * @return
  */
 public function initiate($domain, $locale, $encoding)
 {
     //Initialize gettText
     $locale = !empty($locale) ? $locale : TUIYO_DEFAULT_LOCALE;
     $domain = !empty($domain) ? $domain : 'system';
     $encoding = !empty($encoding) ? $encoding : TUIYO_DEFAULT_ENCODING;
     putenv("LANG={$locale}");
     if (!extension_loaded('gettext')) {
         TuiyoLoader::import("gettext.gettext", "elibrary", "inc");
         T_setlocale(LC_ALL, $locale);
         T_bindtextdomain($domain, TUIYO_LOCALE);
         T_bind_textdomain_codeset($domain, $encoding);
         T_textdomain($domain);
         //return TRUE;
     }
     setlocale(LC_ALL, $locale);
     bindtextdomain($domain, TUIYO_LOCALE);
     bind_textdomain_codeset($domain, $encoding);
     textdomain($domain);
     $path = "components/com_tuiyo/locale/" . $locale;
     //Load the parameters for the site!
     if (!class_exists('JSite')) {
         $path = "../components/com_tuiyo/locale/" . $locale;
     }
     $GLOBALS['mainframe']->addMetaTag("locale", $locale);
     $GLOBALS['mainframe']->addCustomHeadTag('<link href="' . $path . '/LC_MESSAGES/system.client.json" lang="' . $locale . '" rel="gettext" />');
 }
开发者ID:night-coder,项目名称:ignite,代码行数:35,代码来源:localize.php

示例2: initialize

 private function initialize($config = array())
 {
     // Load language helper
     $this->CI->load->helper(array('cookie', 'language'));
     // Make sure the session library is loaded
     class_exists('CI_Session') or $this->CI->load->library('session');
     // List all available languages
     $this->languages = $config['languages'];
     // Set default language.
     // AS you can see, even if we set the default language
     // we do a little check up to make sure in exists on the
     // available languages list. If it doesn't, we set it to
     // CodeIgniter default language (english).
     $this->default = array_key_exists($config['default'], $this->languages) ? $this->languages[$config['default']] : $this->languages[config_item('language')];
     // We now set the session and cookie names
     $this->session = $config['session'] ? $config['session'] : 'lang';
     $this->cookie = $config['cookie'] ? $config['cookie'] : 'lang';
     // Set client language
     $this->client = $this->_set_client_language();
     // Set the current language
     $this->current = $this->_set_current_language();
     // Set config
     $this->CI->config->set_item('language', $this->current['folder']);
     if (!empty($config['files'])) {
         foreach ($config['files'] as $file) {
             $this->CI->lang->load($file, $this->current['folder']);
         }
     }
     T_setlocale(LC_MESSAGES, $this->current['folder']);
     T_bindtextdomain('application', APPPATH . 'language');
     return;
 }
开发者ID:bkader,项目名称:CodeIgniter-Extended,代码行数:32,代码来源:I18n.php

示例3: AdminMembers

 /**
  * AdminMembers 
  * 
  * @param object $fcmsError 
  * @param object $fcmsDatabase
  * @param object $fcmsUser 
  * 
  * @return  void
  */
 function AdminMembers($fcmsError, $fcmsDatabase, $fcmsUser)
 {
     $this->fcmsError = $fcmsError;
     $this->fcmsDatabase = $fcmsDatabase;
     $this->fcmsUser = $fcmsUser;
     T_bindtextdomain('messages', '.././language');
 }
开发者ID:lmcro,项目名称:fcms,代码行数:16,代码来源:admin_members_class.php

示例4: initialize

 /**
  * 
  * Initializes the php-gettext
  * Remember to load first php-gettext
  * @param string $locale
  * @param string $charset
  * @param string $domain
  */
 public static function initialize($locale = 'en_UK', $charset = 'utf-8', $domain = 'messages')
 {
     /**
      * setting the statics so later we can access them from anywhere
      */
     //we allow to choose lang from the url
     if (Core::config('i18n.allow_query_language') == 1) {
         if (Core::get('language') !== NULL) {
             $locale = Core::get('language');
         } elseif (Cookie::get('user_language') !== NULL) {
             $locale = Cookie::get('user_language');
         }
         Cookie::set('user_language', $locale, Core::config('auth.lifetime'));
     }
     self::$lang = $locale;
     //used in i18n kohana
     self::$locale = $locale;
     self::$charset = $charset;
     self::$domain = $domain;
     //time zone set in the config
     date_default_timezone_set(Kohana::$config->load('i18n')->timezone);
     //Kohana core charset, used in the HTML templates as well
     Kohana::$charset = self::$charset;
     /**
      * In Windows LC_MESSAGES are not recognized by any reason.
      * So we check if LC_MESSAGES is defined to avoid bugs,
      * and force using gettext
      */
     if (defined('LC_MESSAGES')) {
         $locale_res = setlocale(LC_MESSAGES, self::$locale);
     } else {
         $locale_res = FALSE;
     }
     // used with a function money_format
     setlocale(LC_MONETARY, self::$locale);
     /**
      * check if gettext exists if not uses gettext dropin
      */
     if (!function_exists('_') or $locale_res === FALSE or empty($locale_res)) {
         /**
          * gettext override
          * v 1.0.11
          * https://launchpad.net/php-gettext/
          * We load php-gettext here since Kohana_I18n tries to create the function __() function when we extend it.
          * PHP-gettext already does this.
          */
         require Kohana::find_file('vendor', 'php-gettext/gettext', 'inc');
         T_setlocale(LC_MESSAGES, self::$locale);
         T_bindtextdomain(self::$domain, DOCROOT . 'languages');
         T_bind_textdomain_codeset(self::$domain, self::$charset);
         T_textdomain(self::$domain);
         //force to use the gettext dropin
         self::$dropin = TRUE;
     } else {
         bindtextdomain(self::$domain, DOCROOT . 'languages');
         bind_textdomain_codeset(self::$domain, self::$charset);
         textdomain(self::$domain);
     }
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:67,代码来源:i18n.php

示例5: PhotoGallery

 /**
  * PhotoGallery 
  * 
  * @param object $fcmsError 
  * @param object $fcmsDatabase
  * @param object $fcmsUser 
  * @param object $fcmsImage
  * 
  * @return void
  */
 function PhotoGallery($fcmsError, $fcmsDatabase, $fcmsUser, $fcmsImage = null)
 {
     $this->fcmsError = $fcmsError;
     $this->fcmsDatabase = $fcmsDatabase;
     $this->fcmsUser = $fcmsUser;
     $this->fcmsImage = $fcmsImage;
     // TODO - this could be fixed by using ROOT
     T_bindtextdomain('messages', '.././language');
 }
开发者ID:sauravpratihar,项目名称:fcms,代码行数:19,代码来源:gallery_class.php

示例6: set_locale

function set_locale($locale)
{
    //Set language
    putenv("LC_ALL={$locale}");
    T_setlocale(LC_MESSAGES, $locale);
    T_bindtextdomain('default', 'locale');
    T_bind_textdomain_codeset('default', 'UTF-8');
    T_textdomain('default');
}
开发者ID:5haman,项目名称:Sendy,代码行数:9,代码来源:locale.php

示例7: _setlocaleEmu

 function _setlocaleEmu($category, $locale, $baseDir)
 {
     $domain = 'pommo';
     $encoding = 'UTF-8';
     T_setlocale($category, $locale);
     T_bindtextdomain($domain, $baseDir . '/language');
     T_bind_textdomain_codeset($domain, $encoding);
     T_textdomain($domain);
     return true;
 }
开发者ID:systemfirez,项目名称:poMMo,代码行数:10,代码来源:Pommo_Helper_L10n.php

示例8: setLocale

 /**
  * Sets a locale (if supported)
  * @param String $locale locale to set
  * @param String $domain messages domain
  * @return String locale set
  */
 private static function setLocale($locale, $domain = 'messages')
 {
     $locale = self::isSupported($locale) ? $locale : self::$config['default'];
     T_setlocale(LC_MESSAGES, $locale);
     T_bindtextdomain($domain, self::$config['path']);
     T_bind_textdomain_codeset($domain, self::$config['encoding']);
     T_textdomain($domain);
     header("Content-type: text/html; charset=" . self::$config['encoding']);
     return $locale;
 }
开发者ID:justvinz,项目名称:i18n,代码行数:16,代码来源:I18N.php

示例9: set_current_lang

 private function set_current_lang($newlang)
 {
     $this->current_lang = $newlang;
     @putenv("LC_ALL=" . $newlang);
     // for WinXP SP3
     T_setlocale(LC_ALL, $newlang);
     T_bindtextdomain("vpsAdmin", WWW_ROOT . "/lang/locale/");
     T_bind_textdomain_codeset("vpsAdmin", "UTF-8");
     T_textdomain("vpsAdmin");
     setcookie(self::c_name, $this->current_lang, time() + 86400 * 7);
 }
开发者ID:whedro,项目名称:vpsadmin,代码行数:11,代码来源:gettext_lang.lib.php

示例10: __construct

 /**
  * Class constructor
  *
  * @return	void
  */
 public function __construct()
 {
     $config =& get_config();
     $lang = empty($config['language']) ? $this->fallback : $config['language'];
     T_setlocale(LC_MESSAGES, $lang);
     // Application Language then system's
     T_bindtextdomain('application', APPPATH . 'language');
     T_bindtextdomain('system', BASEPATH . 'language');
     T_bind_textdomain_codeset('application', 'UTF-8');
     T_textdomain('application');
     unset($lang);
     log_message('info', 'Language Class Initialized');
 }
开发者ID:bkader,项目名称:CodeIgniter-Extended,代码行数:18,代码来源:Lang.php

示例11: load_gettext

/**
 * load_gettext
 * Sets up our local gettext settings.
 *
 * @return void
 */
function load_gettext()
{
    $lang = AmpConfig::get('lang');
    $charset = AmpConfig::get('site_charset') ?: 'UTF-8';
    $locale = $lang . '.' . $charset;
    //debug_event('i18n', 'Setting locale to ' . $locale, 5);
    T_setlocale(LC_MESSAGES, $locale);
    /* Bind the Text Domain */
    T_bindtextdomain('messages', AmpConfig::get('prefix') . "/locale/");
    T_bind_textdomain_codeset('messages', $charset);
    T_textdomain('messages');
    //debug_event('i18n', 'gettext is ' . (locale_emulation() ? 'emulated' : 'native'), 5);
}
开发者ID:axelsimon,项目名称:ampache,代码行数:19,代码来源:i18n.php

示例12: applyLocale

 public static function applyLocale($newlocale)
 {
     self::$locale = $newlocale;
     //TODO Allow locale to be overriden by GET request?
     //if($_GET['lang']) $locale = $_GET['lang'];
     locale_set_default(self::$locale);
     //$language = locale_get_display_language(self::$locale, 'en');
     $lang = locale_get_primary_language(self::$locale);
     //$region = locale_get_display_region(self::$locale);
     T_setlocale(LC_MESSAGES, $lang);
     T_bindtextdomain("grase", "/usr/share/grase/locale");
     T_bind_textdomain_codeset("grase", "UTF-8");
     T_textdomain("grase");
 }
开发者ID:KuberKode,项目名称:grase-www-portal,代码行数:14,代码来源:Locale.php

示例13: switchLocale

function switchLocale($locale)
{
    global $helpPath, $helpRoot, $masterPath, $defLocale, $incPath;
    T_setlocale(LC_ALL, $locale . ".utf8");
    T_bindtextdomain('messages', "{$incPath}/locale");
    T_textdomain('messages');
    if (file_exists("{$helpRoot}/{$locale}")) {
        $helpPath = "{$masterPath}{$helpRoot}/{$locale}/";
    } elseif (file_exists("{$helpRoot}/{$defLocale}")) {
        $helpPath = "{$masterPath}{$helpRoot}/{$defLocale}/";
    } else {
        $helpPath = "{$masterPath}{$helpRoot}/en_EN/";
    }
}
开发者ID:dg-wfk,项目名称:dl,代码行数:14,代码来源:lang.php

示例14: defineLanguage

/**
 * Define language for get-text translator
 *
 * Directory structure for traduction must be:
 *		./locale/Lang/LC_MESSAGES/messages.mo
 * Example (French):
 *		./locale/fr_FR/LC_MESSAGES/messages.mo
 */
function defineLanguage($lang)
{
    $encoding = 'UTF-8';
    if (isset($lang)) {
        $locale = $lang;
    } else {
        $locale = DEFAULT_LOCALE;
    }
    // gettext setup
    T_setlocale(LC_MESSAGES, $locale);
    // Set the text domain as 'messages'
    $domain = 'messages';
    T_bindtextdomain($domain, LOCALE_DIR);
    T_bind_textdomain_codeset($domain, $encoding);
    T_textdomain($domain);
}
开发者ID:404rq,项目名称:bgpanel,代码行数:24,代码来源:func.lang.inc.php

示例15: i18n_gettext

function i18n_gettext($name, $msg)
{
    global $plugin_lang_path;
    static $checked = array();
    if (!isset($checked[$name])) {
        $checked[$name] = 1;
        if (empty($plugin_lang_path[$name])) {
            T_bindtextdomain($name, LANG_DIR);
        } else {
            T_bindtextdomain($name, $plugin_lang_path[$name]);
        }
    }
    T_textdomain($name);
    $text = _(rawurldecode($msg));
    T_textdomain(DOMAIN);
    return $text;
}
开发者ID:logue,项目名称:pukiwiki_adv,代码行数:17,代码来源:_get.inc.php


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