本文整理汇总了PHP中Lang::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP Lang::getLocale方法的具体用法?PHP Lang::getLocale怎么用?PHP Lang::getLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::getLocale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->beforeFilter('csrf', array('on' => 'post'));
$this->model = new News();
$this->info = $this->model->makeInfo($this->module);
$this->access = $this->model->validAccess($this->info['id']);
$this->lang = \Lang::getLocale() == '' ? CNF_LANG : \Lang::getLocale();
$this->data = array('pageTitle' => $this->info['title'], 'pageNote' => $this->info['note'], 'pageModule' => 'news', 'return' => self::returnUrl());
}
示例2: __construct
/**
* Create a new authentication controller instance.
*
* @param Guard $auth
* @param Registrar $registrar
* @param SocialiteContract $socialite
*/
public function __construct(Guard $auth, Registrar $registrar, SocialiteContract $socialite)
{
$this->auth = $auth;
$this->registrar = $registrar;
$this->request = app('route')->getCurrentRequest();
$this->socialite = $socialite;
if (!empty($locale = \Lang::getLocale()) && $locale != \Config::get('app.locale')) {
$this->redirectTo = '/' . $locale . $this->redirectTo;
}
$this->middleware('guest', ['except' => 'getLogout']);
}
示例3: send
public function send(ContactFormRequest $request)
{
// upload photo file
$filePath = $this->upload($request->file('image'));
$fullName = $request->get('firstname') . ' ' . $request->get('lastname');
\Mail::send('emails.contact', array('fullName' => $fullName, 'email' => $request->get('email'), 'body' => $request->get('message'), 'file' => $filePath), function ($message) {
$message->from('noreplay@lazy-ants.com');
$message->to('alex@lazy-ants.com', 'Alex')->subject('You get new Feedback, boom!');
});
return \Redirect::route('contact_show', array('locale' => \Lang::getLocale()))->with('message', 'Thanks for your feedback, we\'ll get to you asap!');
}
示例4: chooser
public function chooser(Request $request)
{
$select = $request->input('locale');
$user = User::find(Auth::id());
if ($user) {
$user->update(['locale' => $select]);
}
$url = $request->url;
$replacedUrl = str_replace(\Lang::getLocale(), $select, $url);
return redirect()->to($replacedUrl)->withCookie(cookie('locale', $select, 525600));
}
示例5: prepareData
public static function prepareData(User $user)
{
$name = null;
$genderNumber = 0;
$userInfo = $user->userInfo;
if ($userInfo) {
$name = trim($userInfo->first_name . ' ' . $userInfo->last_name);
$genderNumber = $userInfo->genderNumber();
}
if (empty($name)) {
$name = trans('emails.user');
}
$data = array('name' => $name, 'genderNumber' => $genderNumber, 'lang' => Lang::getLocale());
return $data;
}
示例6: sendExpiryEmails
protected function sendExpiryEmails($days)
{
$users = $this->getUsers($days);
foreach ($users as $user) {
/* @var $user \User */
$subj = Lang::get('emails.subscription.subject');
$name = null;
$genderNumber = 0;
$userInfo = $user->userInfo;
if ($userInfo) {
$name = trim($userInfo->first_name . ' ' . $userInfo->last_name);
$genderNumber = $userInfo->genderNumber();
}
if (empty($name)) {
$name = trans('emails.user');
}
$data = array('days' => $days, 'name' => $name, 'genderNumber' => $genderNumber, 'lang' => Lang::getLocale(), 'url' => '#');
Mail::send('emails.announcements.expires', $data, function (Message $message) use($user, $subj) {
$message->to($user->email)->subject($subj);
});
}
}
示例7: langScript
/**
* Prepara el codigo para cargar en la variable lang, las traducciones del Formavalidator
* @return string
*/
private function langScript()
{
//Obtenemos el locale
//
$code = '';
$url = asset('assets/formvalidation/dist/js/language/');
//dd(Lang::getLocale());
switch (Lang::getLocale()) {
case "es":
$lang = 'es_ES';
break;
case "fr":
$lang = 'fr_FR';
break;
default:
$lang = '';
}
if (!$lang == '') {
$code = "<script type=\"text/javascript\" src=\"" . $url . "/" . $lang . ".js\"></script>";
}
$code = "";
return $code;
}
示例8: registerMedia
public function registerMedia()
{
$this->templateScripts = ['CURRENT_URL' => $this->request->url(), 'SITE_URL' => url(), 'BASE_URL' => url(\CMS::backendPath()), 'BACKEND_PATH' => \CMS::backendPath(), 'BACKEND_RESOURCES' => \CMS::backendResourcesURL(), 'PUBLIC_URL' => url(), 'LOCALE' => \Lang::getLocale(), 'ROUTE' => $this->getRouter()->currentRouteAction(), 'ROUTE_PATH' => $this->getRouterPath(), 'USER_ID' => \Auth::id(), 'MESSAGE_ERRORS' => view()->shared('errors')->getBag('default'), 'MESSAGE_SUCCESS' => (array) $this->session->get('success', [])];
}
示例9:
<?php
$locale = Lang::getLocale();
PackageManager::add('elfinder')->js('elfinder.lib', resources_url('/libs/elfinder/js/elfinder.min.js'), 'global')->js("elfinder.{$locale}", resources_url("/libs/elfinder/js/i18n/elfinder.{$locale}.js"), 'elfinder.lib')->css('elfinder.lib', resources_url('/libs/elfinder/css/elfinder.min.css'));
示例10: url
<!DOCTYPE HTML>
<html>
<title>用户登录</title>
@include('__header')
<body>
<table class="body-table" style="background:rgba(0,0,0,0) url(/css/<?php
echo Lang::getLocale();
?>
_bg.jpg) no-repeat scroll 0 0 / cover;">
<tr>
<td class="nav-left">
<div class="nav-item dropdown-container" style="margin-left:21px;">
<a href="javascript:;" pushstate="no" class="nav-item bold-medium" style="height:40px;line-height:40px;">
<?php
echo Lang::get('login.Language');
?>
:<?php
echo Lang::get('login.Location');
?>
<span class="octicon" style="font-size:13px;"></span>
</a>
<div class="pop-layout" style="top:38px;left:-7px;">
<b class="angle-up" style="left:32%;top:-5px;"></b>
<div class="content-board radius-4 shadow-3">
<div class="dropdown-menu" style="height:85px;width:204px;">
<ul>
<li><a class="radius-3" native="yes" href="?locale=cn">简体中文</a></li>
<li><a class="radius-3" native="yes" href="?locale=tw">繁體中文</a></li>
<li><a class="radius-3" native="yes" href="?locale=kr">한국어</a></li>
<li><a class="radius-3" native="yes" href="?locale=jp">日本語</a></li>
示例11: __construct
public function __construct()
{
$this->lang = \Lang::getLocale();
$this->admin = \Auth::user()->get();
}
示例12: showHome
public function showHome()
{
$lang = Lang::getLocale();
$title = 'Afta FlightSchool';
return View::make('home')->with('title', $title)->with('lang', $lang);
}
示例13:
<!--datepicker Script -->
<?php
$set_lang = Lang::getLocale();
if ($set_lang == 'ar') {
$set_lang = 'es';
}
?>
<script type="text/javascript">
$('.date_of_birth').datepicker({
language: '<?php
echo $set_lang;
?>
',
format: 'yyyy-mm-dd',
todayBtn: 1,
todayHighlight: 1,
showMeridian: 1,
autoclose: 1
});
</script>
<!--end datepicker Script -->
示例14:
<?php
$ngApp = $this->ngApp ? $this->ngApp === true ? 'ng-app' : 'ng-app="' . $this->ngApp . '"' : '';
$lang = Lang::getLocale() ?: 'en';
?>
@section('doctype')
<!DOCTYPE html>
<!--[if IEMobile 7]><html class="iem7" lang="<?php
echo $lang;
?>
" dir="ltr" <?php
echo $ngApp;
?>
><![endif]-->
<!--[if lt IE 7]><html class="ie6" lang="<?php
echo $lang;
?>
" dir="ltr" <?php
echo $ngApp;
?>
><![endif]-->
<!--[if (IE 7)&(!IEMobile)]><html class="ie7" lang="<?php
echo $lang;
?>
" dir="ltr" <?php
echo $ngApp;
?>
><![endif]-->
<!--[if IE 8]><html class="ie8" lang="<?php
echo $lang;
?>
示例15: getIndex
public function getIndex($group = null)
{
$locales = $this->locales;
$currentLocale = \Lang::getLocale();
$primaryLocale = $this->primaryLocale;
$translatingLocale = $this->translatingLocale;
$groups = array('' => noEditTrans($this->packagePrefix . 'messages.choose-group')) + $this->manager->getGroupList();
if ($group != null && !array_key_exists($group, $groups)) {
return \Redirect::action(ManagerServiceProvider::CONTROLLER_PREFIX . get_class($this) . '@getIndex');
}
$numChanged = $this->getTranslation()->where('group', $group)->where('status', Translation::STATUS_CHANGED)->count();
// to allow proper handling of nested directory structure we need to copy the keys for the group for all missing
// translations, otherwise we don't know what the group and key looks like.
//$allTranslations = $this->getTranslation()->where('group', $group)->orderBy('key', 'asc')->get();
$displayWhere = $this->displayLocales ? ' AND locale IN (\'' . implode("','", explode(',', $this->displayLocales)) . "')" : '';
$ltm_translations = $this->manager->getTranslationsTableName();
$allTranslations = $this->getTranslation()->hydrateRaw($sql = <<<SQL
SELECT * FROM {$ltm_translations} WHERE `group` = ? {$displayWhere}
UNION ALL
SELECT DISTINCT
NULL id,
NULL status,
locale,
`group`,
`key`,
NULL value,
NULL created_at,
NULL updated_at,
NULL source,
NULL saved_value,
NULL is_deleted,
NULL was_used
FROM
(SELECT * FROM (SELECT DISTINCT locale FROM {$ltm_translations} WHERE 1=1 {$displayWhere}) lcs
CROSS JOIN (SELECT DISTINCT `group`, `key` FROM {$ltm_translations} WHERE `group` = ? {$displayWhere}) grp) m
WHERE NOT EXISTS(SELECT * FROM {$ltm_translations} t WHERE t.locale = m.locale AND t.`group` = m.`group` AND t.`key` = m.`key`)
ORDER BY `key` ASC
SQL
, [$group, $group], $this->getConnectionName());
$numTranslations = count($allTranslations);
$translations = array();
foreach ($allTranslations as $translation) {
$translations[$translation->key][$translation->locale] = $translation;
}
$this->manager->cacheGroupTranslations($group, $this->displayLocales, $translations);
$stats = $this->getConnection()->select(<<<SQL
SELECT (mx.total_keys - lcs.total) missing, lcs.changed, lcs.cached, lcs.deleted, lcs.locale, lcs.`group`
FROM
(SELECT sum(total) total, sum(changed) changed, sum(cached) cached, sum(deleted) deleted, `group`, locale
FROM
(SELECT count(value) total,
sum(CASE WHEN status = 1 THEN 1 ELSE 0 END) changed,
sum(CASE WHEN status = 2 AND value IS NOT NULL THEN 1 ELSE 0 END) cached,
sum(is_deleted) deleted,
`group`, locale
FROM {$ltm_translations} lt WHERE 1=1 {$displayWhere} GROUP BY `group`, locale
UNION ALL
SELECT DISTINCT 0, 0, 0, 0, `group`, locale FROM (SELECT DISTINCT locale FROM {$ltm_translations} WHERE 1=1 {$displayWhere}) lc
CROSS JOIN (SELECT DISTINCT `group` FROM {$ltm_translations}) lg) a
GROUP BY `group`, locale) lcs
JOIN (SELECT count(DISTINCT `key`) total_keys, `group` FROM {$ltm_translations} WHERE 1=1 {$displayWhere} GROUP BY `group`) mx
ON lcs.`group` = mx.`group`
WHERE lcs.total < mx.total_keys OR lcs.changed > 0 OR lcs.cached > 0 OR lcs.deleted > 0
SQL
);
// returned result set lists mising, changed, group, locale
$summary = [];
foreach ($stats as $stat) {
if (!isset($summary[$stat->group])) {
$item = $summary[$stat->group] = new \stdClass();
$item->missing = '';
$item->changed = '';
$item->cached = '';
$item->deleted = '';
$item->group = $stat->group;
}
$item = $summary[$stat->group];
if ($stat->missing) {
$item->missing .= $stat->locale . ":" . $stat->missing . " ";
}
if ($stat->changed) {
$item->changed .= $stat->locale . ":" . $stat->changed . " ";
}
if ($stat->cached) {
$item->cached .= $stat->locale . ":" . $stat->cached . " ";
}
if ($stat->deleted) {
$item->deleted .= $stat->locale . ":" . $stat->deleted . " ";
}
}
$mismatches = null;
$mismatchEnabled = $this->manager->config('mismatch_enabled');
if ($mismatchEnabled) {
// get mismatches
$mismatches = $this->getConnection()->select(<<<SQL
SELECT DISTINCT lt.*, ft.ru, ft.en
FROM (SELECT * FROM {$ltm_translations} WHERE 1=1 {$displayWhere}) lt
JOIN
(SELECT DISTINCT mt.`key`, BINARY mt.ru ru, BINARY mt.en en
FROM (SELECT lt.`group`, lt.`key`, group_concat(CASE lt.locale WHEN '{$primaryLocale}' THEN VALUE ELSE NULL END) en, group_concat(CASE lt.locale WHEN '{$translatingLocale}' THEN VALUE ELSE NULL END) ru
//.........这里部分代码省略.........