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


PHP Lang::translate方法代码示例

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


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

示例1: process

 /**
  * Process a template (catch displayed content)
  * 
  * @param string $id template id
  * @param array $vars template variables
  * 
  * @return string parsed template content
  */
 public static function process($id, $vars = array())
 {
     // Are we asked to not output context related html comments ?
     $addctx = true;
     if (substr($id, 0, 1) == '!') {
         $addctx = false;
         $id = substr($id, 1);
     }
     // Resolve template file path
     $path = self::resolve($id);
     return (new Event('template_process', $id, $path, $vars, $addctx))->trigger(function ($id, $path, $vars, $addctx) {
         // Lambda renderer to isolate context
         $renderer = function ($_path, $_vars) {
             foreach ($_vars as $_k => $_v) {
                 if (substr($_k, 0, 1) != '_') {
                     ${$_k} = $_v;
                 }
             }
             include $_path;
         };
         // Render
         $exception = null;
         ob_start();
         try {
             $renderer($path, $vars);
         } catch (Exception $e) {
             $exception = $e;
         }
         $content = ob_get_clean();
         // Translation syntax
         $content = preg_replace_callback('`\\{(loc|tr|translate):([^}]+)\\}`', function ($m) {
             return (string) Lang::translate($m[2]);
         }, $content);
         // Config syntax
         $content = preg_replace_callback('`\\{(cfg|conf|config):([^}]+)\\}`', function ($m) {
             return Config::get($m[2]);
         }, $content);
         // Image syntax
         $content = preg_replace_callback('`\\{(img|image):([^}]+)\\}`', function ($m) {
             return GUI::path('images/' . $m[2]);
         }, $content);
         // Path syntax
         $content = preg_replace_callback('`\\{(path):([^}]*)\\}`', function ($m) {
             return GUI::path($m[2]);
         }, $content);
         // URL syntax
         $content = preg_replace_callback('`\\{(url):([^}]*)\\}`', function ($m) {
             return preg_replace('`^(https?://)?([^/]+)/`', '/', Config::get('application_url')) . $m[2];
         }, $content);
         // Add context as a html comment if required
         if ($addctx) {
             $content = "\n" . '<!-- template:' . $id . ' start -->' . "\n" . $content . "\n" . '<!-- template:' . $id . ' end -->' . "\n";
         }
         // If rendering threw rethrow
         if ($exception) {
             throw $exception;
         }
         return $content;
     });
 }
开发者ID:eheb,项目名称:renater-decide,代码行数:68,代码来源:Template.class.php

示例2: blacklistAction

 public function blacklistAction()
 {
     $model = new FriendsModel();
     Pagination::calculate(get('page', 'int'), 15, $model->countFriends(Request::getParam('user')->id, 'out', 0, 1, false));
     $this->view->blacklist = $model->getFriends(Request::getParam('user')->id, 'out', 0, 1, false, Pagination::$start, Pagination::$end);
     $this->view->title = Lang::translate('BLACKLIST_TITLE');
 }
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:7,代码来源:Controller.php

示例3: getCredentials

 /**
  * Generates Rackspace API key credentials
  * {@inheritDoc}
  */
 public function getCredentials()
 {
     $secret = $this->getSecret();
     if (!empty($secret['username']) && !empty($secret['apiKey'])) {
         $credentials = array('auth' => array('RAX-KSKEY:apiKeyCredentials' => array('username' => $secret['username'], 'apiKey' => $secret['apiKey'])));
         if (!empty($secret['tenantName'])) {
             $credentials['auth']['tenantName'] = $secret['tenantName'];
         } elseif (!empty($secret['tenantId'])) {
             $credentials['auth']['tenantId'] = $secret['tenantId'];
         }
         return json_encode($credentials);
     } else {
         throw new Exceptions\CredentialError(Lang::translate('Unrecognized credential secret'));
     }
 }
开发者ID:fandikurnia,项目名称:CiiMS,代码行数:19,代码来源:Rackspace.php

示例4: view

 public function view()
 {
     $strings = $_GET['strings'];
     $namespace = empty($_GET['namespace']) ? null : General::sanitize($_GET['namespace']);
     $new = array();
     foreach ($strings as $key => $value) {
         // Check value
         if (empty($value) || ($value = 'false')) {
             $value = $key;
         }
         $value = General::sanitize($value);
         // Translate
         $new[$value] = Lang::translate(urldecode($value), null, $namespace);
     }
     $this->_Result = $new;
 }
开发者ID:valery,项目名称:symphony-2,代码行数:16,代码来源:content.ajaxtranslate.php

示例5: setArray

 /**
  * Sets metadata values from an array, with optional prefix
  *
  * If $prefix is provided, then only array keys that match the prefix
  * are set as metadata values, and $prefix is stripped from the key name.
  *
  * @param array $values an array of key/value pairs to set
  * @param string $prefix if provided, a prefix that is used to identify
  *      metadata values. For example, you can set values from headers
  *      for a Container by using $prefix='X-Container-Meta-'.
  * @return void
  */
 public function setArray($values, $prefix = null)
 {
     if (empty($values)) {
         return false;
     }
     foreach ($values as $key => $value) {
         if ($prefix) {
             if (strpos($key, $prefix) === 0) {
                 $name = substr($key, strlen($prefix));
                 $this->getLogger()->info(Lang::translate('Setting [{name}] to [{value}]'), array('name' => $name, 'value' => $value));
                 $this->{$name} = $value;
             }
         } else {
             $this->{$key} = $value;
         }
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:29,代码来源:Metadata.php

示例6: SetArray

 /**
  * Sets metadata values from an array, with optional prefix
  *
  * If $prefix is provided, then only array keys that match the prefix
  * are set as metadata values, and $prefix is stripped from the key name.
  *
  * @param array $values an array of key/value pairs to set
  * @param string $prefix if provided, a prefix that is used to identify
  *      metadata values. For example, you can set values from headers
  *      for a Container by using $prefix='X-Container-Meta-'.
  * @return void
  */
 public function SetArray($values, $prefix = null)
 {
     if (empty($values)) {
         return false;
     }
     foreach ($values as $key => $value) {
         if ($prefix) {
             if (strpos($key, $prefix) === 0) {
                 $name = substr($key, strlen($prefix));
                 $this->debug(Lang::translate('Setting [%s] to [%s]'), $name, $value);
                 $this->{$name} = $value;
             }
         } else {
             $this->{$key} = $value;
         }
     }
 }
开发者ID:omusico,项目名称:home365,代码行数:29,代码来源:Metadata.php

示例7: indexAction

 public function indexAction()
 {
     $model = new ChatModel();
     setSession('chat_ses', 0);
     $this->view->list = $model->getChatMessages('chat');
     $this->view->title = Lang::translate('INDEX_TITLE');
     $this->view->onlines = $model->getUserOnline();
     /*  $countUser = 0;
     
     
     
                 while ($list = mysqli_fetch_object($listUserOnline)) {
     
                     $userList .= '<li><a href="' . url($list->id) . '" target="_blank"><span>' . $list->nickname . '</span><span class="level-icon">' . $list->level . '</span></a></li>';
     
                     $countUser++;
     
                 } */
 }
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:19,代码来源:Controller.php

示例8: getCookie

<div class="box">
    <?php 
if (getCookie('error')) {
    echo getCookie('error');
}
?>
    
    <?php 
if ($this->msg) {
    echo $this->msg;
    echo '<br/><a href="' . url('page', 'recovery') . '">' . Lang::translate("RECOVERY_GO_BACK") . '</a>';
} else {
    ?>

    <form action="<?php 
    echo url('page', 'recovery');
    ?>
" method="POST">
        <div class="formRow">
            <div class="formRowTitle">
                {L:RECOVERY_EMAIL}
            </div>
            <div class="formRowField">
                <input type="email" name="email" value="<?php 
    echo post('email') ? post('email') : '';
    ?>
" required="required" />
            </div>
        </div>
        
        <div class="formRow">
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:31,代码来源:recovery.php

示例9: banAction

 public function banAction()
 {
     //$model = new ProfileModel();
     $this->view->title = Lang::translate('BAN_TITLE');
 }
开发者ID:Snake4life,项目名称:csgobattlecom,代码行数:5,代码来源:Controller.php

示例10: userstatAction

 public function userstatAction()
 {
     $model = new AdminModel();
     $this->view->count = $model->countUsers();
     $this->view->count24h = $model->countUsers("`dateLast` > '" . (time() - 24 * 3600) . "'");
     $this->view->list = $model->getUsersOnline();
     $this->view->title = Lang::translate('USERSTAT_TITLE');
 }
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:8,代码来源:Controller.php

示例11:

<h1>{L:INDEX_TITLE}</h1>

<div><a class="marker-icon" href="{URL:admin/news}">{L:INDEX_NEWS}</a></div>
<div><a href="{URL:admin/verify_users}"><?php 
echo Lang::translate('INDEX_VERIFY_USERS') . ' (' . $this->countVerifyUsers . ')';
?>
</a></div>
<div><a href="{URL:admin/disputes}">{L:INDEX_DISPUTES}</a></div>
<div><a href="{URL:admin/servers}">{L:INDEX_SERVERS}</a></div>

<div><a class="marker-icon" href="{URL:admin/users}">{L:INDEX_USERS}</a></div>
<div><a class="marker-icon" href="{URL:admin/userstat}">{L:INDEX_USERS_STAT}</a></div>
<div><a class="marker-icon" href="{URL:admin/guests}">{L:INDEX_GUESTS}</a></div>
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:13,代码来源:index.php

示例12: social_saveAction

 public function social_saveAction()
 {
     if (empty($_SERVER['HTTP_X_REQUESTED_WITH'])) {
         error404();
     }
     $model = new SettingsModel();
     $save['facebook'] = post('__facebook');
     $save['steam'] = post('__steam');
     $save['twitch'] = post('__twitch');
     $save['twitter'] = post('__twitter');
     $save['youtube'] = post('__youtube');
     $model->setSettings(Request::getParam('user')->id, $save);
     $status = '<div class="">' . Lang::translate('SOCIAL_SAVED') . '</div>';
     $response['error'] = 0;
     $response['target_h']['#status'] = $status;
     echo json_encode($response);
     exit;
 }
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:18,代码来源:Controller.php

示例13: resourceName

 /**
  * Returns the resource name for the URL of the object; must be overridden
  * in child classes
  *
  * For example, a server is `/servers/`, a database instance is
  * `/instances/`. Must be overridden in child classes.
  *
  * @throws UrlError
  */
 public static function resourceName()
 {
     if (isset(static::$url_resource)) {
         return static::$url_resource;
     }
     throw new Exceptions\UrlError(sprintf(Lang::translate('No URL resource defined for class [%s] in ResourceName()'), get_class()));
 }
开发者ID:BulatSa,项目名称:Ctex,代码行数:16,代码来源:PersistentObject.php

示例14: while

<h1>{L:INDEX_VERIFY_USERS}</h1>

<?php 
while ($list = mysqli_fetch_object($this->list)) {
    echo '<div>';
    echo '<a href="' . url($list->id) . '">' . $list->nickname . '</a>';
    echo ' <span id="verify' . $list->id . '">(';
    echo '<a onclick="' . ajaxLoad(url('admin', 'verify_users_submit'), 'verifys', 'id:' . $list->id) . '">' . Lang::translate('VERIFY_USERS_SUBMIT') . '</a> | ';
    echo '<a onclick="' . ajaxLoad(url('admin', 'verify_users_reject'), 'verifyr', 'id:' . $list->id) . '">' . Lang::translate('VERIFY_USERS_REJECT') . '</a>';
    echo ')</span>';
    echo ' / Steam ';
    if ($list->steamid) {
        echo '<span class="c_green">&#10004;</span>';
    } else {
        echo '<span class="c_red">&#10006;</span>';
    }
    echo '</div>';
}
开发者ID:terrasystems,项目名称:csgobattlecom,代码行数:18,代码来源:verify_users.php

示例15: select

 /**
  * selects only specified items from the Collection
  *
  * This provides a simple form of filtering on Collections. For each item
  * in the collection, it calls the callback function, passing it the item.
  * If the callback returns `TRUE`, then the item is retained; if it returns
  * `FALSE`, then the item is deleted from the collection.
  *
  * Note that this should not supersede server-side filtering; the
  * `Collection::Select()` method requires that *all* of the data for the
  * Collection be retrieved from the server before the filtering is
  * performed; this can be very inefficient, especially for large data
  * sets. This method is mostly useful on smaller-sized sets.
  *
  * Example:
  * <code>
  * $services = $connection->ServiceList();
  * $services->Select(function($item){ return $item->region=='ORD';});
  * // now the $services Collection only has items from the ORD region
  * </code>
  *
  * `Select()` is *destructive*; that is, it actually removes entries from
  * the collection. For example, if you use `Select()` to find items with
  * the ID > 10, then use it again to find items that are <= 10, it will
  * return an empty list.
  *
  * @api
  * @param callable $testfunc a callback function that is passed each item
  *      in turn. Note that `Select()` performs an explicit test for
  *      `FALSE`, so functions like `strpos()` need to be cast into a
  *      boolean value (and not just return the integer).
  * @returns void
  * @throws DomainError if callback doesn't return a boolean value
  */
 public function select($testfunc)
 {
     foreach ($this->getItemList() as $index => $item) {
         $test = call_user_func($testfunc, $item);
         if (!is_bool($test)) {
             throw new Exceptions\DomainError(Lang::translate('Callback function for Collection::Select() did not return boolean'));
         }
         if ($test === false) {
             unset($this->itemList[$index]);
         }
     }
 }
开发者ID:fandikurnia,项目名称:CiiMS,代码行数:46,代码来源:Collection.php


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