• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP trans_choice函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中trans_choice函数的典型用法代码示例。如果您正苦于以下问题:PHP trans_choice函数的具体用法?PHP trans_choice怎么用?PHP trans_choice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: __construct

 /**
  * __construct
  *
  * @param GroupInterface $group
  * @param GroupForm     $groupForm
  */
 public function __construct(GroupInterface $group, GroupForm $groupForm)
 {
     parent::__construct($group, $groupForm);
     $this->title['parent'] = trans_choice('groups::global.groups', 2);
     // Establish Filters
     $this->beforeFilter('inGroup:Admins');
 }
开发者ID:Ayoubblog,项目名称:TypiCMS,代码行数:13,代码来源:AdminController.php


示例2: lmcTrans

 /**
  * translate given message with laravel trans function
  *
  * @param string $id
  * @param array $parameters
  * @param integer|null $count
  * @return string
  */
 function lmcTrans($id, $parameters = [], $count = null)
 {
     if (is_integer($count)) {
         return trans_choice('laravel-modules-core::' . $id, $count, $parameters);
     }
     return trans('laravel-modules-core::' . $id, $parameters);
 }
开发者ID:erenmustafaozdal,项目名称:laravel-modules-core,代码行数:15,代码来源:helpers.php


示例3: postAdd

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postAdd(Request $request, $product_id)
 {
     $deal = Deal::firstOrCreate(['user_id' => $request->user()->id, 'product_id' => $product_id]);
     $product = \App\Product::find($product_id);
     $request->session()->put("deals.{$product_id}", $product);
     return response()->json(['id' => $product_id, 'mobile' => trans('products.mobile', ['mobile' => $request->user()->mobile]), 'text' => trans_choice('products.deal', $product->deals_count)]);
 }
开发者ID:sotoplatero,项目名称:lacallemonte,代码行数:12,代码来源:DealController.php


示例4: testPluralsOffset

 public function testPluralsOffset()
 {
     $this->assertEquals('You do not like this yet', trans_choice('test::test.offset', 0));
     $this->assertEquals('You liked this', trans_choice('test::test.offset', 1));
     $this->assertEquals('You and one other person liked this', trans_choice('test::test.offset', 2));
     $this->assertEquals('You and 2 others liked this', trans_choice('test::test.offset', 3));
 }
开发者ID:skysplit,项目名称:laravel5-intl-translation,代码行数:7,代码来源:TranslationTest.php


示例5: duration_human

function duration_human($minutes, $output = 'days,hours,minutes', $short = false, $separator = ', ')
{
    $format = function ($value, $unit, $short) {
        $unitString = trans_choice("time.{$unit}", $value);
        return sprintf('<strong>%d</strong>%s', $value, $short ? $unitString[0] : " {$unitString}");
    };
    $strings = [];
    if ($short && $separator == ', ') {
        $separator = ' ';
    }
    $timespan = timespan(time() + $minutes * 60, time(), $output);
    foreach (array_filter($timespan) as $unit => $value) {
        $strings[] = $format($value, $unit, $short);
    }
    if (empty($strings)) {
        end($timespan);
        $unit = key($timespan);
        $strings[] = $format($timespan[$unit], $unit, $short);
    }
    $last = array_pop($strings);
    $count = count($strings);
    if ($count && $short) {
        return sprintf('%s%s%s', implode($separator, $strings), $separator, $last);
    } elseif ($count) {
        return sprintf('%s %s %s', implode($separator, $strings), trans('and'), $last);
    } else {
        return $last;
    }
}
开发者ID:TrackerNetwork,项目名称:DestinyStatus,代码行数:29,代码来源:helpers.php


示例6: compose

 /**
  * Bind data to the view.
  *
  * @param  View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     // Home. This menu item declares the menu and
     // sets it as an array of arrays.
     $menu = [['name' => trans('web::seat.home'), 'icon' => 'fa-home', 'route_segment' => 'home', 'route' => 'home']];
     // Key Management
     array_push($menu, ['name' => trans('web::seat.api_key_management'), 'icon' => 'fa-key', 'route_segment' => 'api-key', 'entries' => [['name' => trans('web::seat.add_api_key'), 'icon' => 'fa-plus', 'route' => 'api.key'], ['name' => trans('web::seat.list_keys'), 'icon' => 'fa-list', 'route' => 'api.key.list']]]);
     // Corporation
     array_push($menu, ['name' => trans_choice('web::seat.corporation', 2), 'icon' => 'fa-building', 'route_segment' => 'corporation', 'entries' => [['name' => trans('web::seat.all_corp'), 'icon' => 'fa-group', 'route' => 'corporation.list']]]);
     // Character
     array_push($menu, ['name' => trans_choice('web::seat.character', 2), 'icon' => 'fa-user', 'route_segment' => 'character', 'entries' => [['name' => trans('web::seat.all_char'), 'icon' => 'fa-group', 'route' => 'character.list'], ['name' => trans('web::seat.mail_timeline'), 'icon' => 'fa-envelope', 'route' => 'character.view.mail.timeline']]]);
     // Configuration
     if (auth()->user()->hasSuperuser()) {
         array_push($menu, ['name' => trans('web::seat.configuration'), 'icon' => 'fa-cogs', 'route_segment' => 'configuration', 'entries' => [['name' => trans('web::seat.access'), 'icon' => 'fa-shield', 'route' => 'configuration.access.roles'], ['name' => trans('web::seat.import'), 'icon' => 'fa-upload', 'route' => 'configuration.import.list'], ['name' => trans_choice('web::seat.user', 2), 'icon' => 'fa-user', 'route' => 'configuration.users'], ['name' => trans('web::seat.schedule'), 'icon' => 'fa-clock-o', 'route' => 'configuration.schedule'], ['name' => trans('web::seat.settings'), 'icon' => 'fa-cog', 'route' => 'seat.settings.view'], ['name' => trans('web::seat.security_logs'), 'icon' => 'fa-list', 'route' => 'configuration.security.logs']]]);
     }
     // Load any menus from any registered packages
     $package_menus = config('package.sidebar');
     foreach ($package_menus as $package_name => $menu_data) {
         $prepared_menu = $this->load_plugin_menu($package_name, $menu_data);
         if (!empty($prepared_menu)) {
             array_push($menu, $prepared_menu);
         }
     }
     array_push($menu, ['name' => trans('web::seat.other'), 'icon' => 'fa-circle', 'route_segment' => 'other']);
     $view->with('menu', $menu);
 }
开发者ID:freedenizen,项目名称:web,代码行数:33,代码来源:Sidebar.php


示例7: compose

 /**
  * Index page view composer.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $totalComponents = Component::enabled()->count();
     $majorOutages = Component::enabled()->status(4)->count();
     $isMajorOutage = $majorOutages / $totalComponents >= 0.5;
     // Default data
     $withData = ['system_status' => 'info', 'system_message' => trans_choice('cachet.service.bad', $totalComponents), 'favicon' => 'favicon-high-alert'];
     if ($isMajorOutage) {
         $withData = ['system_status' => 'danger', 'system_message' => trans_choice('cachet.service.major', $totalComponents), 'favicon' => 'favicon-high-alert'];
     } elseif (Component::enabled()->notStatus(1)->count() === 0) {
         // If all our components are ok, do we have any non-fixed incidents?
         $incidents = Incident::notScheduled()->orderBy('created_at', 'desc')->get();
         $incidentCount = $incidents->count();
         if ($incidentCount === 0 || $incidentCount >= 1 && (int) $incidents->first()->status === 4) {
             $withData = ['system_status' => 'success', 'system_message' => trans_choice('cachet.service.good', $totalComponents), 'favicon' => 'favicon'];
         }
     } else {
         if (Component::enabled()->whereIn('status', [2, 3])->count() > 0) {
             $withData['favicon'] = 'favicon-medium-alert';
         }
     }
     // Scheduled maintenance code.
     $scheduledMaintenance = Incident::scheduled()->orderBy('scheduled_at')->get();
     // Component & Component Group lists.
     $usedComponentGroups = Component::enabled()->where('group_id', '>', 0)->groupBy('group_id')->pluck('group_id');
     $componentGroups = ComponentGroup::whereIn('id', $usedComponentGroups)->orderBy('order')->get();
     $ungroupedComponents = Component::enabled()->where('group_id', 0)->orderBy('order')->orderBy('created_at')->get();
     $view->with($withData)->withComponentGroups($componentGroups)->withUngroupedComponents($ungroupedComponents)->withScheduledMaintenance($scheduledMaintenance);
 }
开发者ID:bashou,项目名称:Cachet,代码行数:36,代码来源:StatusPageComposer.php


示例8: toArray

 public function toArray()
 {
     $data = parent::toArray();
     if (!empty($data['photos'])) {
         $data['photos'] = $this->processPhotos($data['photos']);
     }
     $data['age'] = false;
     if (!empty($data['bdate'])) {
         $bdate = explode('.', $data['bdate']);
         if (count($bdate) >= 3) {
             $bdate = new \DateTime($bdate[2] . '-' . $bdate[1] . '-' . $bdate[0]);
             $now = new \DateTime();
             $diff = $now->diff($bdate);
             $year = $diff->y;
             $age = trans_choice('main.age', $year, [], 'message', 'ru');
             $data['age'] = $age;
         }
     }
     if ($data['age'] == false) {
         $year = rand(18, 25);
         $age = trans_choice('main.age', $year, [], 'message', 'ru');
         $data['age'] = $age;
     }
     return $data;
 }
开发者ID:stels-cs,项目名称:tinder-olega,代码行数:25,代码来源:VKUsers.php


示例9: editCustomRecord

 public function editCustomRecord($parameters)
 {
     $parameters['models'] = array_map(function ($object) {
         $object->name = trans_choice($object->name, 1);
         return $object;
     }, config('booking.models'));
     return $parameters;
 }
开发者ID:syscover,项目名称:booking,代码行数:8,代码来源:PlaceController.php


示例10: getList

 public function getList(Request $request)
 {
     $justAddedCustomerContact = false;
     if ($request->session()->get('customer.justaddedcustomer_contact')) {
         $justAddedCustomerContact = true;
         $request->session()->forget('customer.justaddedcustomer_contact');
     }
     return view('website.customer.customer_contacts.list')->with(['browserTitle' => trans_choice('customer_contact.customer_contact', 2), 'mainArea' => 'customer_contacts', 'subArea' => 'list', 'justAddedCustomerContact' => $justAddedCustomerContact, 'customer' => $this->customer->getByToken()]);
 }
开发者ID:manogi,项目名称:gfw-qm,代码行数:9,代码来源:CustomerContactController.php


示例11: getList

 public function getList(Request $request)
 {
     $justAddedProducer = false;
     if ($request->session()->get('customer.justaddedproducer')) {
         $justAddedProducer = true;
         $request->session()->forget('customer.justaddedproducer');
     }
     return view('website.customer.producers.list')->with(['browserTitle' => trans_choice('producer.producer', 2), 'mainArea' => 'producers', 'subArea' => 'list', 'justAddedProducer' => $justAddedProducer, 'customer' => $this->customer->getByToken()]);
 }
开发者ID:manogi,项目名称:gfw-qm,代码行数:9,代码来源:CustomerProducerController.php


示例12: getTasters

 public function getTasters(Request $request)
 {
     $justAddedTaster = false;
     if ($request->session()->get('user.justaddedtaster')) {
         $justAddedTaster = true;
         $request->session()->forget('user.justaddedtaster');
     }
     return view('website.user.tasters.list')->with(['browserTitle' => trans_choice('taster.taster', 2), 'mainArea' => 'tasters', 'subArea' => 'list', 'justAddedTaster' => $justAddedTaster, 'user' => $this->user->getByToken()]);
 }
开发者ID:manogi,项目名称:gfw-qm,代码行数:9,代码来源:UserController.php


示例13: customIndex

 public function customIndex($parameters)
 {
     if (isset($parameters['modal']) && $parameters['modal'] == 1) {
         $this->viewParameters['deleteSelectButton'] = false;
     }
     $shop = Shop::builder()->find($parameters['ref']);
     $customer = $shop->getCustomer;
     $parameters['customTransHeader'] = trans_choice('pulsar::pulsar.address', 1) . ' ' . trans('pulsar::pulsar.from') . ' ' . $shop->name_076 . ' (' . $customer->code_075 . ' - ' . $customer->company_name_075 . ')';
     return $parameters;
 }
开发者ID:syscover,项目名称:octopus,代码行数:10,代码来源:AddressController.php


示例14: postSignupEmail

 /**
  * Process request to send signup email
  * @param  App\Http\Requests\Auth\SignupEmail $request
  * @param  App\Services\EmailInteractionLimiter $limiter
  * @return Illuminate\Http\RedirectResponse
  */
 public function postSignupEmail(SignupEmail $request, EmailInteractionLimiter $limiter)
 {
     if ($limiter->allowed('signup')) {
         $this->dispatch(new SendSignupEmail($request->email));
         return back()->withInfo('An email will be sent to ' . $request->email . '. Please, follow the provided link to finish signup procedure.');
     } else {
         $expire = config('auth.email_lockout');
         return back()->withDanger(trans_choice('auth.lockout', $expire, compact('expire')));
     }
 }
开发者ID:adiachenko,项目名称:rabbits,代码行数:16,代码来源:SignupController.php


示例15: postEmail

 /**
  * Send email with password reset link to requested address
  *
  * @param  App\Http\Requests\Auth\PasswordEmail $request
  * @param  App\Services\EmailInteractionLimiter $limiter
  * @return Illuminate\Http\RedirectResponse
  */
 public function postEmail(PasswordEmail $request, EmailInteractionLimiter $limiter)
 {
     if ($limiter->allowed('passreset')) {
         $this->dispatch(new SendPasswordResetEmail($request->email));
         return back()->withInfo('An email will be sent to ' . $request->email . '. Please, follow the provided link to change your password.');
     } else {
         $expire = config('auth.email_lockout');
         return back()->withDanger(trans_choice('auth.lockout', $expire, compact('expire')));
     }
 }
开发者ID:adiachenko,项目名称:rabbits,代码行数:17,代码来源:PasswordController.php


示例16: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof ResourceNotFoundException) {
         return ApiResponse::resourceNotFound(trans_choice('messages.resource.empty', 1, ['resource' => $e->resource]));
     } elseif ($e instanceof NoResourceFoundException) {
         return ApiResponse::resourceNotFound(trans_choice('messages.resource.empty', 2, ['resource' => $e->resource]));
     } elseif ($e instanceof ForbiddenException) {
         return ApiResponse::forbidden(trans('messages.forbidden'));
     }
     return parent::render($request, $e);
 }
开发者ID:damnyan,项目名称:laravel,代码行数:18,代码来源:Handler.php


示例17: trans_rule

 /**
  * Translates the given message based on a count.
  * The count will be calculated according configured rule.
  *
  * @param string        $id
  * @param int           $number
  * @param array         $parameters
  * @param string        $domain
  * @param string|null   $locale
  * @param callable|null $rule
  *
  * @return string
  */
 function trans_rule($id, $number, array $parameters = [], $domain = 'messages', $locale = null, callable $rule = null)
 {
     if (!is_callable($rule)) {
         $locale = $locale ?: app()->getLocale();
         $rule = app('translation.rules')->get($locale);
     }
     if (is_callable($rule)) {
         $number = $rule($number);
     }
     return trans_choice($id, $number, $parameters, $domain, $locale);
 }
开发者ID:dn23rus,项目名称:laravel-translation-rules,代码行数:24,代码来源:helpers.php


示例18: update

 public function update($id, $data)
 {
     $resource = $this->repository->find($id);
     if (!$resource) {
         throw new ResourceNotFoundException(trans_choice('messages.resource.empty', 1, ['resource' => $this->repository->resource]));
     }
     if (!$resource->update($data)) {
         return ApiResponse::badRequest(trans('messages.resource.update.failed', ['resource' => $this->repository->resource]));
     }
     return ApiResponse::responseData($resource, trans('messages.resource.update.success', ['resource' => $this->repository->resource]));
 }
开发者ID:damnyan,项目名称:laravel,代码行数:11,代码来源:UpdateResourceTrait.php


示例19: showCustomRecord

 public function showCustomRecord($parameters)
 {
     // types
     $parameters['types'] = array_map(function ($object) {
         $object->name = trans_choice($object->name, 1);
         return $object;
     }, config('projects.types'));
     // projects
     $parameters['projects'] = Project::builder()->get();
     return $parameters;
 }
开发者ID:syscover,项目名称:projects,代码行数:11,代码来源:InvoicedController.php


示例20: showCustomRecord

 public function showCustomRecord($parameters)
 {
     $parameters['ruleFamilies'] = array_map(function ($object) {
         $object->name = trans_choice($object->name, 1);
         return $object;
     }, config('market.ruleFamilies'));
     $parameters['discountTypes'] = array_map(function ($object) {
         $object->name = trans($object->name);
         return $object;
     }, config('market.discountTypes'));
     return $parameters;
 }
开发者ID:syscover,项目名称:market,代码行数:12,代码来源:CustomerDiscountHistoryController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP trans_url函数代码示例发布时间:2022-05-23
下一篇:
PHP trans_bool函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap