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


PHP Lang::choice方法代码示例

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


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

示例1: format

 public function format($isNow, $isFuture, $delta, $unit)
 {
     $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'uk');
     if ($isNow) {
         if ($isFuture) {
             if ($unit == "day" && $delta == 1) {
                 $txt = "завтра";
             } else {
                 if (($unit == "year" || $unit == "hour") && $delta == 1) {
                     $txt = "через " . " " . $unitStr;
                 } else {
                     $txt = "через " . $delta . " " . $unitStr;
                 }
             }
         } else {
             if ($unit == "second" && $delta < 10) {
                 $txt = 'щойно';
             } else {
                 if ($unit == "day" && $delta == 1) {
                     $txt = "вчора";
                 } else {
                     $txt = $delta . " " . $unitStr . " тому";
                 }
             }
         }
     } else {
         if ($isFuture) {
             $txt = $delta . " " . $unitStr . " потому";
         } else {
             $txt = "за " . " " . $delta . " " . $unitStr . " до";
         }
     }
     return $txt;
 }
开发者ID:martijn-heil,项目名称:localized-carbon,代码行数:34,代码来源:UkDiffFormatter.php

示例2: postInvite

 public function postInvite()
 {
     $form = $this->inviteForm;
     $form->handleRequest(Request::instance());
     if ($form->isValid()) {
         $data = $form->getData();
         $emails = array_map('trim', explode(",", $data['emails']));
         $subject = $data['subject'];
         $lender = Auth::user()->getLender();
         $custom_message = $data['note'];
         $allInvites = InviteQuery::create()->filterByLender($lender)->select('email')->find();
         $countInvites = 0;
         foreach ($emails as $email) {
             if (in_array($email, $allInvites->getData())) {
                 Flash::info(\Lang::get('comments.flash.already-invited', array('email' => $email)));
             } else {
                 $countInvites += 1;
                 $this->lenderService->lenderInviteViaEmail($lender, $email, $subject, $custom_message);
             }
         }
         Flash::success(\Lang::choice('comments.flash.invite-success', $countInvites, array('count' => $countInvites)));
         return Redirect::route('lender:invite');
     }
     return Redirect::route('lender:invite')->withForm($form);
 }
开发者ID:Junyue,项目名称:zidisha2,代码行数:25,代码来源:LenderInviteController.php

示例3: format

 public function format($isNow, $isFuture, $delta, $unit)
 {
     $unitStr = \Lang::choice('localized-carbon::units.' . ($isFuture || !$isNow ? '_' : '') . $unit, $delta, array(), 'sk');
     if ($isNow) {
         if ($isFuture) {
             if ($unit == 'second' && $delta < 10) {
                 $txt = 'za chvíľu';
             } else {
                 if ($unit == 'day' && $delta == 1) {
                     $txt = 'zajtra';
                 } else {
                     $txt = 'za ' . ($delta > 1 ? $delta . ' ' : '') . $unitStr;
                 }
             }
         } else {
             if ($unit == 'second' && $delta < 10) {
                 $txt = 'pred chvíľou';
             } else {
                 if ($unit == 'day' && $delta == 1) {
                     $txt = 'včera';
                 } else {
                     $txt = 'pred ' . ($delta > 1 ? $delta . ' ' : '') . $unitStr;
                 }
             }
         }
     } else {
         $txt = ($delta > 1 ? $delta . ' ' : '') . $unitStr;
         $txt .= $isFuture ? ' potom' : ' predtým';
     }
     return $txt;
 }
开发者ID:martijn-heil,项目名称:localized-carbon,代码行数:31,代码来源:SkDiffFormatter.php

示例4: format

 public function format($isNow, $isFuture, $delta, $unit)
 {
     $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'ar');
     $txt = $delta . ' ' . $unitStr;
     if ($isNow) {
         $when = $isFuture ? ' من الآن' : ' مرّت';
         return $txt . $when;
     }
     return $txt .= $isFuture ? 'بعد ' : 'قبل ';
 }
开发者ID:martijn-heil,项目名称:localized-carbon,代码行数:10,代码来源:ArDiffFormatter.php

示例5: format

 public function format($isNow, $isFuture, $delta, $unit)
 {
     $txt = $delta . ' ' . \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'nl');
     if ($isNow) {
         $txt .= $isFuture ? ' in de toekomst' : ' geleden';
         return $txt;
     }
     $txt .= $isFuture ? ' na' : ' voor';
     return $txt;
 }
开发者ID:martijn-heil,项目名称:localized-carbon,代码行数:10,代码来源:NlDiffFormatter.php

示例6: format

 public function format($isNow, $isFuture, $delta, $unit)
 {
     $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'fr');
     $txt = $delta . ' ' . $unitStr;
     if ($isNow) {
         $when = $isFuture ? 'Dans ' : 'Il y a ';
         return $when . $txt;
     }
     return $txt .= $isFuture ? ' après' : ' avant';
 }
开发者ID:skosm,项目名称:LaraShop,代码行数:10,代码来源:FrDiffFormatter.php

示例7: format

 public function format($isNow, $isFuture, $delta, $unit)
 {
     $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'pt');
     $txt = $delta . ' ' . $unitStr;
     if ($isNow) {
         $txt .= $isFuture ? ' a partir de agora' : ' atrás';
         return $txt;
     }
     $txt .= $isFuture ? ' depois' : ' antes';
     return $txt;
 }
开发者ID:martijn-heil,项目名称:localized-carbon,代码行数:11,代码来源:PtDiffFormatter.php

示例8: format

 public function format($isNow, $isFuture, $delta, $unit)
 {
     $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'bg');
     $txt = $delta . ' ' . $unitStr;
     if ($isNow) {
         $txt = ($isFuture ? 'след ' : 'преди ') . $txt;
         return $txt;
     }
     $txt .= $isFuture ? ' след това' : ' преди това';
     return $txt;
 }
开发者ID:martijn-heil,项目名称:localized-carbon,代码行数:11,代码来源:BgDiffFormatter.php

示例9: format

 public function format($isNow, $isFuture, $delta, $unit)
 {
     $unitStr = \Lang::choice("localized-carbon::units." . $unit, $delta, array(), 'tr');
     $txt = $delta . ' ' . $unitStr;
     if ($isNow) {
         $txt .= " " . ($isFuture ? 'sonra ' : 'önce ');
         return $txt;
     }
     $txt .= $isFuture ? ' sonrası' : ' öncesi';
     return $txt;
 }
开发者ID:martijn-heil,项目名称:localized-carbon,代码行数:11,代码来源:TrDiffFormatter.php

示例10: errors

 public function errors($key)
 {
     $errors = $this->getErorrBag();
     if ($errors->has()) {
         $alert = "<strong>" . \Lang::choice($key, count($errors)) . "</strong>";
         $html = '';
         foreach ($errors->all('<p><a href="#:key">:message</a></p>') as $message) {
             $html .= $message;
         }
         return "<div class='alert alert-danger'>{$alert}{$html}</div>";
     }
 }
开发者ID:kowali,项目名称:html,代码行数:12,代码来源:FormBuilder.php

示例11: getBuscador

 public function getBuscador()
 {
     $provincias = new Provincia();
     $areas = new AreasEmpleo();
     $experiencia[0] = Lang::get("forms.sinExperiencia");
     for ($i = 1; $i < 10; $i++) {
         $experiencia[$i] = $i . " " . Lang::choice("forms.anyo", $i);
     }
     $experiencia[10] = ">= 10 " . Lang::choice("forms.anyo", 10);
     $jornadas = new JornadasLaborales();
     $contratos = new ContratosLaborales();
     return View::make('gestor.buscador', array('contratos' => $contratos->vector(), 'jornadas' => $jornadas->vector(), 'experiencia' => $experiencia, 'areas' => $areas->vector(), 'provincias' => $provincias->arraySelect()));
 }
开发者ID:albafo,项目名称:web.Adehon,代码行数:13,代码来源:GestorController.php

示例12: create

 /**
  * Show the form for creating a new photo.
  *
  * @return \Illuminate\View\View
  */
 public function create()
 {
     $albumArray = $this->album->all()->toArray();
     $dropdown[0] = '';
     if (empty($albumArray)) {
         $dropdown[0] = \Lang::get('gallery::gallery.none') . \Lang::choice('gallery::gallery.album', 2);
     }
     foreach ($albumArray as $album) {
         $dropdown[$album['album_id']] = $album['album_name'];
     }
     $data = array('type' => 'photo', 'dropdown' => $dropdown);
     $this->layout->content = \View::make('gallery::new', $data)->nest('form', 'gallery::forms.new-photo', $data);
 }
开发者ID:jcbaldoni,项目名称:laravel-photo-gallery,代码行数:18,代码来源:PhotosController.php

示例13: smarty_block_t

/**
 * Smarty {t}{/t} block plugin
 *
 * Type:     block function<br>
 * Name:     t<br>
 * Purpose:  provides access to Laravel's translator<br>
 * Params:
 * <pre>
 * - _count         - used for pluralization
 * </pre>
 * All other params are passed to Laravel's translator as replacements
 *
 * @param array                    $params   parameters
 * @param string                   $content  contents of the block
 * @param Smarty_Internal_Template $template template object
 * @param boolean                  &$repeat  repeat flag
 * @return string content translated
 * @author Jakob Gahde <j5lx@fmail.co.uk>
 */
function smarty_block_t($params, $content, $template, &$repeat)
{
    if (is_null($content)) {
        return;
    }
    if (array_key_exists('_count', $params)) {
        $count = $params['_count'];
        unset($params['_count']);
        $translated = Lang::choice($content, $count, $params);
    } else {
        $translated = Lang::get($content, $params);
    }
    return $translated;
}
开发者ID:srit83,项目名称:laravel-smarty,代码行数:33,代码来源:block.t.php

示例14: smarty_block_lang

/**
 * @param array                    $params
 * @param string                   $content
 * @param Smarty_Internal_Template $smarty
 * @param boolean                  $repeat
 *
 * @return string
 *
 * @author Kovács Vince
 */
function smarty_block_lang($params, $content, Smarty_Internal_Template &$smarty, &$repeat)
{
    if (is_null($content)) {
        return '';
    }
    $content = trim($content);
    if (array_key_exists('_count', $params)) {
        $count = $params['_count'];
        unset($params['_count']);
        $translated = Lang::choice($content, $count, $params);
    } else {
        $translated = Lang::get($content, $params);
    }
    return $translated;
}
开发者ID:vi-kon,项目名称:laravel-smarty-view,代码行数:25,代码来源:block.lang.php

示例15: updateCard

 public function updateCard(Card $card)
 {
     $inputs = ['color' => Input::get('color'), 'content' => Input::get('content'), 'comment' => Input::get('comment'), 'worker_id' => Input::get('worker_id')];
     $valid = Validator::make($inputs, Card::$rules);
     if ($valid->passes()) {
         $card->color = $inputs['color'];
         $card->content = $inputs['content'];
         $card->comment = $inputs['comment'];
         $card->worker_id = $inputs['worker_id'];
         $card->save();
         return Redirect::route('card.list')->with('success', Lang::choice('messages.Cards', 1) . ' ' . trans('is updated'));
     } else {
         return Redirect::back()->withErrors($valid)->withInput();
     }
 }
开发者ID:rituzy,项目名称:iblog,代码行数:15,代码来源:CardController.php


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