当前位置: 首页>>代码示例>>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;未经允许,请勿转载。