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


PHP i18n::load方法代码示例

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


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

示例1: get

 /**
  * Returns translation of a string. If no translation exists, the original
  * string will be returned.
  *
  * @param   string   text to translate
  * @return  string
  */
 public static function get($string)
 {
     // Load the translation table
     $table = i18n::load(i18n::$lang);
     // Return the translated string if it exists
     return isset($table[$string]) ? $table[$string] : $string;
 }
开发者ID:ukd1,项目名称:kohana,代码行数:14,代码来源:i18n.php

示例2: action_main

 /**
  * Parses the $_FILES superglobal for uploaded files. An event is triggered for each file. Handlers
  * can then decide whether to keep the uploaded file. The action result is filled with the properties
  * of the $_FILES superglobal storing the corresponding result - whether the respective file was
  * removed or has been accepted.
  */
 protected function action_main($skipPermsCheck = false)
 {
     if (!$skipPermsCheck and !Permissions::has('sys_upload')) {
         return $this->redirectForbidden();
     }
     $lang = i18n::load('diamondmvc');
     $result = array();
     $success = true;
     if (!empty($_FILES)) {
         foreach ($_FILES as $prop => $file) {
             // Skip this file if not desired.
             if (!empty($this->filters) and !in_array($prop, $this->filters)) {
                 continue;
             }
             // Attempt to save the file.
             if (!$this->handleUpload($prop, $file)) {
                 $this->addMessage(str_replace('%name%', $file['name'], $lang->get('ERROR_TITLE', 'ControllerUpload')), $lang->get('ERROR_MESSAGE', 'ControllerUpload'), 'error');
                 $result[$prop] = false;
                 $success = false;
             } else {
                 $result[$prop] = true;
             }
         }
     }
     $this->result = array('success' => $success, 'details' => $result);
 }
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:32,代码来源:upload.php

示例3: generateDocsMenu

 protected function generateDocsMenu($ctrl)
 {
     $lang = i18n::load('diamondmvc');
     $result = new ModuleNavbar($ctrl);
     $result->addLinkLeft($lang->get('HOME'), DIAMONDMVC_URL . '/docs')->addMenuLeft($lang->get('GUIDES'))->addLink($lang->get('GETTING_STARTED'), DIAMONDMVC_URL . '/docs/getting-started')->addLink($lang->get('CONTROLLERS'), DIAMONDMVC_URL . '/docs/controllers')->addLink($lang->get('VIEWS'), DIAMONDMVC_URL . '/docs/views')->addLink($lang->get('MODELS'), DIAMONDMVC_URL . '/docs/models')->addLink($lang->get('INTERNATIONALIZATION'), DIAMONDMVC_URL . '/docs/i18n')->addLink($lang->get('PERMISSIONS'), DIAMONDMVC_URL . '/docs/permissions')->addLink($lang->get('EXTENSIONS'), DIAMONDMVC_URL . '/docs/extensions')->back();
     return $result;
 }
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:7,代码来源:menus.php

示例4: action_main

 protected function action_main()
 {
     $this->title = 'Error!';
     $lang = i18n::load('diamondmvc');
     $errors = array();
     if (isset($_SESSION['errors'])) {
         $errors = $_SESSION['errors'];
         unset($_SESSION['errors']);
     } else {
         if (isset($_SESSION['error'])) {
             $errors[] = $_SESSION['error'];
             unset($_SESSION['error']);
         } else {
             if (isset($_REQUEST['msg'])) {
                 $error = array();
                 $error['title'] = isset($_REQUEST['title']) ? htmlspecialchars(urldecode($_REQUEST['title'])) : $lang->get('GENERIC_ERROR');
                 $error['msg'] = htmlspecialchars(urldecode($_REQUEST['msg']));
                 // Prevent XSS attacks on our beloved clients
                 $error['level'] = isset($_REQUEST['level']) ? $_REQUEST['level'] : 'warn';
                 // The addMessage method automatically sanitizes this
                 $errors[] = $error;
             }
         }
     }
     foreach ($errors as $error) {
         $this->addMessage($error['title'], $error['msg'], $error['level']);
     }
 }
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:28,代码来源:error.php

示例5: defined

 *  - files:       List of files to be shown in the filebrowser.
 * 
 * Each item in the files array ought to provide the following data:
 *  - is_dir: Whether the item represents a directory or a regular file
 *  - name:   Name of the item
 *  - id:     Unique ID. This is passed to the AJAX callback upon clicking the item.
 *  - size:   Size in bytes
 *  - perms:  File permissions
 */
defined('DIAMONDMVC') or die;
if (isset($this->controller)) {
    $data = $this->controller->getResult();
} else {
    $data = $this->getData();
}
$lang = i18n::load('diamondmvc');
$this->addStylesheet('filebrowser.css');
$this->addStylesheet('/assets/dropzone/dropzone.min.css');
$this->addScript('./filebrowser');
$this->addScript('dropzone');
?>
<div class="view view-filebrowser">
	<?php 
if (isset($data['controls']) and !empty($data['controls'])) {
    ?>
		<div class="filebrowser-controls pull-right">
			<?php 
    if (isset($data['controls']['custom']) and !empty($data['controls']['custom'])) {
        ?>
				<?php 
        echo $data['controls']['custom'];
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:31,代码来源:default.php

示例6:

<?php

/**
 * @package  DiamondMVC
 * @author   Zyr <zyrius@live.com>
 * @version  1.0
 * @license  CC-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
 * 
 * Extension installation mask. Provides a modal to choose an extension ZIP archive for upload.
 */
$lang = i18n::load('diamondmvc-backend');
// $this->addStylesheet('install.css');
$this->addScript('dropzone');
$this->addScript('./install');
$data = $this->controller->getResult();
$snippet = $data['filebrowser'];
foreach ($snippet->getStylesheets() as $sheet) {
    $this->addStylesheet($sheet);
}
foreach ($snippet->getScripts() as $script) {
    $this->addScript($script);
}
?>
<div class="view view-install" id="view-system">
	<a href="<?php 
echo DIAMONDMVC_URL;
?>
/system/installations" class="btn btn-primary pull-right"><?php 
echo $lang->get('RETURN_TO_OVERVIEW', 'ControllerSystem.Install');
?>
</a>
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:31,代码来源:install.php

示例7: read

 /**
  * Reads the HTML template of this view into memory. The template is searched
  * based on the view's name.
  * Template parameters ought to be set prior to the invokation of this method.
  * @return View             Diese Instanz zur Methodenverkettung.
  */
 public function read()
 {
     ob_start();
     $path = $this->getPath();
     if (!empty($path)) {
         include $path;
     } else {
         $lang = i18n::load('diamondmvc');
         echo $lang->get('VIEW_NOT_FOUND');
     }
     $this->buffer = ob_get_contents();
     ob_end_clean();
     return $this;
 }
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:20,代码来源:class_view.php

示例8: redirectForbidden

 protected function redirectForbidden()
 {
     $lang = i18n::load('diamondmvc-backend');
     $_SESSION['error'] = array('title' => $lang->get('ERROR_RESTRICTED_ACCESS'), 'msg' => $lang->get('ERROR_INSUFFICIENT_PERMISSIONS'), 'level' => 'error');
     redirect(DIAMONDMVC_URL . '/error');
 }
开发者ID:Zyr93,项目名称:DiamondMVC,代码行数:6,代码来源:system.php

示例9: bind

 /**
  * load localized strings for one module
  *
  * @param string module name
  */
 public static function bind($module)
 {
     global $context;
     // sanity check
     if (!isset($context['language'])) {
         return;
     }
     // initialization
     if (!isset($context['l10n_modules'])) {
         $context['l10n_modules'] = array();
     }
     // ensure all cached modules are accurate on development machine
     if ($context['with_debug'] == 'Y') {
         i18n::load('en', $module);
         i18n::load('fr', $module);
     }
     // this module has already been loaded
     if (isset($context['l10n_modules'][$module])) {
         return;
     }
     // avoid further loading
     $context['l10n_modules'][$module] = TRUE;
     // load strings according to surfer localization
     i18n::load($context['language'], $module);
     // load strings according to community localization
     if ($context['preferred_language'] != $context['language']) {
         i18n::load($context['preferred_language'], $module);
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:34,代码来源:i18n.php


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