當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。