本文整理汇总了PHP中app::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP app::getLocale方法的具体用法?PHP app::getLocale怎么用?PHP app::getLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::getLocale方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showDate
/**
* @param $date
* @param string $format
* @return string
*/
function showDate($date, $format = 'date')
{
$dt = new Date($date);
if (app::getLocale() == 'en') {
if ($format == 'date') {
return $dt->format('Y-m-d');
}
if ($format == 'text') {
return $dt->format('l F j, Y');
}
if ($format == 'text-court') {
return $dt->format('l F j');
}
return $dt->format($format);
}
if ($format == 'date') {
return $dt->format('d-m-Y');
}
if ($format == 'text') {
return $dt->format('l j F Y');
}
if ($format == 'text-court') {
return $dt->format('l j F');
}
return $dt->format($format);
}
示例2: gl
/**
* @param $texte
* @return mixed
*/
function gl($texte)
{
return Traduction::gl($texte, app::getLocale());
}
示例3: renderNavigation
protected function renderNavigation()
{
$model = new Menu();
$menus = $model->get_all(app::getLocale());
$template_data = array('data' => json_decode($menus->toJson()));
return View::make('hbs::navigation', $template_data);
}
示例4: function
/*
$routes = $view->offsetGet('data');
$data = new stdClass;
$data->desktop = $routes[0];
$data->mobile = $routes[1];
$view->with(array(
'data' => $data,
));
*/
});
// home.hbs
View::composer(array('hbs::home', 'hbs::homeIE'), function ($view) {
// page data
$page = $view->offsetGet('data');
$viewName = $view->offsetGet('viewName');
$lang = app::getLocale();
$headline = array('cs' => 'DOCKonalý domov', 'en' => 'Perfect home', 'ru' => 'Идеальный дом');
View::share('imageSrc', '0.jpg');
View::share('headline', $headline[$lang]);
});
// navigationPage.hbs
View::composer('hbs::navigationPage', function ($view) {
// get page data
$page = $view->offsetGet('data');
$colSize = 1;
$children = $page->children;
if (!empty($children) && is_array($children)) {
$colNum = count($children) <= 4 ? count($children) : 3;
$colSize = 12 / $colNum;
}
// add data
示例5: function
| and give it the Closure to execute when that URI is requested.
|
*/
// ===============================================
// API SECTION
// ===============================================
Route::group(array('prefix' => 'api'), function () {
// API ROUTE ERROR handling
// -------------------------------------------------
Route::get('/{else}', function () {
// return 400 - bad request
return Response::json(array('error' => array('message' => "Bad Request", 'type' => "BadRequest")), 400);
})->where('else', '(.*)');
});
// ----------------------------------------------
// ===============================================
// FRONT
// ===============================================
Route::get('/{route?}', 'Vizioart\\Cookbook\\FrontController@resolveRoute')->where('route', '(.*)');
App::missing(function ($exception) {
$view_data = array('meta_title' => 'Page Not Found');
// --------------------------------------
$model = new Vizioart\Cookbook\Models\MenuModel();
$menus = $model->get_all(app::getLocale());
$template_data = array('data' => json_decode($menus->toJson()));
$view_data['navigation'] = View::make('hbs::navigation', $template_data);
// --------------------------------------
// page template (handlebars)
$view_data['content'] = View::make('hbs::404');
return Response::view('layouts.error', $view_data, 404);
});