本文整理汇总了PHP中trans_choice函数的典型用法代码示例。如果您正苦于以下问题:PHP trans_choice函数的具体用法?PHP trans_choice怎么用?PHP trans_choice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trans_choice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
示例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);
}
示例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)]);
}
示例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));
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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()]);
}
示例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()]);
}
示例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()]);
}
示例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;
}
示例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')));
}
}
示例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')));
}
}