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


PHP I18n::getLocale方法代码示例

本文整理汇总了PHP中I18n::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP I18n::getLocale方法的具体用法?PHP I18n::getLocale怎么用?PHP I18n::getLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在I18n的用法示例。


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

示例1: init

 /**
  * Initialize all activated plugin by including is index.php file.
  * Also load all language files for plugins available in plugins directory.
  */
 static function init()
 {
     $dir = PLUGINS_ROOT . DS;
     if ($handle = opendir($dir)) {
         while (false !== ($plugin_id = readdir($handle))) {
             $file = $dir . $plugin_id . DS . 'i18n' . DS . I18n::getLocale() . '-message.php';
             $default_file = PLUGINS_ROOT . DS . $plugin_id . DS . 'i18n' . DS . DEFAULT_LOCALE . '-message.php';
             if (file_exists($file)) {
                 $array = (include $file);
                 I18n::add($array);
             }
             if (file_exists($default_file)) {
                 $array = (include $default_file);
                 I18n::addDefault($array);
             }
         }
     }
     self::$plugins = unserialize(Setting::get('plugins'));
     foreach (self::$plugins as $plugin_id => $tmp) {
         $file = PLUGINS_ROOT . DS . $plugin_id . DS . 'index.php';
         if (file_exists($file)) {
             include $file;
         }
     }
 }
开发者ID:ariksavage,项目名称:superior-optical-eyewear,代码行数:29,代码来源:Plugin.php

示例2: __

/**
 * This function is as flexible as possible, you can choose your own pattern for variables in
 * the string.
 *
 * Examples of variables are: ':var_name', '#var_name', '{varname}',
 * '%varname', '%varname%', 'VARNAME', etc...
 *
 * <code>
 * return = array('hello world!' => 'bonjour le monde!',
 *                'user ":user" is logged in' => 'l\'utilisateur ":user" est connecté',
 *                'Posted by %user% on %month% %day% %year% at %time%' => 'Publié par %user% le %day% %month% %year% à %time%'
 *               );
 *
 * __('hello world!'); // bonjour le monde!
 * __('user ":user" is logged in', array(':user' => $user)); // l'utilisateur "demo" est connecté
 * __('Posted by %user% on %month% %day% %year% at %time%', array(
 *      '%user%' => $user,
 *      '%month%' => __($month),
 *      '%day%' => $day,
 *      '%year%' => $year,
 *      '%time%' => $time)); // Publié par demo le 3 janvier 2006 à 19:30
 * </code>
 */
function __($string, $args = null)
{
    if (I18n::getLocale() != DEFAULT_LOCALE) {
        $string = I18n::getText($string);
    }
    if ($args === null) {
        return $string;
    }
    return strtr($string, $args);
}
开发者ID:julpi,项目名称:FreshCMS,代码行数:33,代码来源:I18n.php

示例3: getInstance

 /**
  * Returns dateFormat instance
  * 
  * @return f_date_Format    Return singleton instance of f_date_Format
  */
 public static function getInstance($region = null)
 {
     if ($region === null) {
         $region = I18n::getLocale();
     }
     if (!isset(self::$_instances[$region])) {
         self::$_instances[$region] = new self($region);
     }
     return self::$_instances[$region];
 }
开发者ID:salomalo,项目名称:php-oxygen,代码行数:15,代码来源:format.class.php

示例4: init

 /**
  * Initialize all activated plugin by including is index.php file
  */
 static function init()
 {
     self::$plugins = unserialize(Setting::get('plugins'));
     foreach (self::$plugins as $plugin_id => $tmp) {
         $file = CORE_ROOT . '/plugins/' . $plugin_id . '/index.php';
         if (file_exists($file)) {
             include $file;
         }
         $file = CORE_ROOT . '/plugins/' . $plugin_id . '/i18n/' . I18n::getLocale() . '-message.php';
         if (file_exists($file)) {
             $array = (include $file);
             I18n::add($array);
         }
     }
 }
开发者ID:julpi,项目名称:FreshCMS,代码行数:18,代码来源:Plugin.php

示例5: _filemanager_lang

 private function _filemanager_lang()
 {
     $trans = array('ca', 'cs', 'da', 'de', 'en', 'es', 'fi', 'fr', 'he', 'hu', 'it', 'ja', 'nl', 'pl', 'pt', 'ru', 'sv', 'tr', 'vn', 'cn');
     $user_lang = I18n::getLocale();
     $lang = in_array($user_lang, $trans) ? $user_lang : 'en';
     if ($lang == 'cn') {
         $lang = 'zh-cn';
     }
     return $lang;
 }
开发者ID:sindotnet,项目名称:dashhotel,代码行数:10,代码来源:CkeditorController.php

示例6: _addErrorMessage

 /**
  * Return code and message from a given error code
  * 
  * @param integer $code
  * @return array            Array containing the error code and the error text
  */
 private function _addErrorMessage($code)
 {
     $codes = array(UPLOAD_ERR_OK => 'There is no error, the file uploaded with success', UPLOAD_ERR_INI_SIZE => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', UPLOAD_ERR_FORM_SIZE => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', UPLOAD_ERR_PARTIAL => 'The uploaded file was only partially uploaded', UPLOAD_ERR_NO_FILE => 'No file was uploaded', UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder', UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk', UPLOAD_ERR_EXTENSION => 'A PHP extension stopped the file upload', self::UPLOAD_ERR_MAX_SIZE => 'The file uploaded exceeds the maximum file size defined in the configuration', self::UPLOAD_ERR_FILE_EXTENSION => 'The extension of the file uploaded is blacklisted or not whitelisted', self::UPLOAD_ERR_FILE_TYPE => 'The type of the file uploaded is blacklisted or not whitelisted', self::UPLOAD_ERR_FILE_NOT_IMAGE => 'The file uploaded is not an image', self::UPLOAD_ERR_MOVE_FAILED => 'The uploaded filename could not be moved from temporary storage to the path specified', self::UPLOAD_ERR_OVERWRITE => 'The uploaded filename could not be saved because a file with that name already exists');
     $this->errors[$code] = I18n::t(FW_DIR . DS . 'lib' . DS . 'locales' . DS . 'upload.' . I18n::getLocale() . '.xml', $codes[$code], array(), 'en_US');
 }
开发者ID:salomalo,项目名称:php-oxygen,代码行数:11,代码来源:upload.class.php


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