當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Helpers::translate方法代碼示例

本文整理匯總了PHP中Helpers::translate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Helpers::translate方法的具體用法?PHP Helpers::translate怎麽用?PHP Helpers::translate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Helpers的用法示例。


在下文中一共展示了Helpers::translate方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: items

 /**
  * Creates a serie of checkable items
  *
  * @param array $_items Items to create
  */
 protected function items($_items)
 {
     // If passing an array
     if (sizeof($_items) == 1 and is_array($_items[0])) {
         $_items = $_items[0];
     }
     // Iterate through items, assign a name and a label to each
     $count = 0;
     foreach ($_items as $name => $label) {
         // If we haven't any name defined for the checkable, try to compute some
         if (!is_string($name)) {
             $name = $this->name;
             if ($this->checkable == 'checkbox') {
                 $name .= '_' . $count;
             }
         }
         $this->items[] = array('name' => $name, 'label' => Helpers::translate($label));
         $count++;
     }
 }
開發者ID:nigobo,項目名稱:laravel-play,代碼行數:25,代碼來源:Checkable.php

示例2: legend

 /**
  * Creates a form legend
  *
  * @param  string $legend     The text
  * @param  array  $attributes Its attributes
  * @return string             A legend tag
  */
 public static function legend($legend, $attributes = array())
 {
     $legend = Helpers::translate($legend);
     return '<legend' . \HTML::attributes($attributes) . '>' . $legend . '</legend>';
 }
開發者ID:raftalks,項目名稱:former,代碼行數:12,代碼來源:Former.php

示例3: items

 /**
  * Creates a serie of checkable items
  *
  * @param array $_items Items to create
  */
 protected function items($_items)
 {
     // If passing an array
     if (sizeof($_items) == 1 and is_array($_items[0])) {
         $_items = $_items[0];
     }
     // Iterate through items, assign a name and a label to each
     $count = 0;
     foreach ($_items as $label => $name) {
         // Define a fallback name in case none is found
         $fallback = $this->isCheckbox() ? $this->name . '_' . $count : $this->name;
         // If we haven't any name defined for the checkable, try to compute some
         if (!is_string($label) and !is_array($name)) {
             $label = $name;
             $name = $fallback;
         }
         // If we gave custom information on the item, add them
         if (is_array($name)) {
             $attributes = $name;
             $name = array_get($attributes, 'name', $fallback);
             unset($attributes['name']);
         }
         // Store all informations we have in an array
         $item = array('name' => $name, 'label' => Helpers::translate($label));
         if (isset($attributes)) {
             $item['attributes'] = $attributes;
         }
         $this->items[] = $item;
         $count++;
     }
 }
開發者ID:raftalks,項目名稱:former,代碼行數:36,代碼來源:Checkable.php

示例4: ponder

 /**
  * Ponders a label and a field name, and tries to get the best out of it
  *
  * @param  string $label A label
  * @param  string $name  A field name
  * @return array         A label and a field name
  */
 private function ponder($name, $label)
 {
     // Check for the two possibilities
     if ($label and !$name) {
         $name = \Str::slug($label);
     } elseif (!$label and $name) {
         $label = $name;
     }
     // Attempt to translate the label
     $label = Helpers::translate($label);
     // Save values
     $this->name = $name;
     $this->label = $label;
 }
開發者ID:nigobo,項目名稱:laravel-play,代碼行數:21,代碼來源:Field.php


注:本文中的Helpers::translate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。