当前位置: 首页>>代码示例>>PHP>>正文


PHP App::getLocale方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\App::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getLocale方法的具体用法?PHP App::getLocale怎么用?PHP App::getLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\App的用法示例。


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

示例1: contact

 public function contact()
 {
     $title = 'Contact';
     $name = App::getLocale() == 'fr' ? 'name_fr' : 'name_en';
     if (App::getLocale() == 'fr') {
         $iams = [1 => 'Indépendant', 2 => 'Particulier', 3 => 'Organisme public'];
     } else {
         $iams = [1 => 'Professional client', 2 => 'Private client', 3 => 'Public body'];
     }
     $objects = Object::lists($name, 'id');
     return view('pages.contact', compact('title', 'objects', 'iams'));
 }
开发者ID:fabricedeplancke,项目名称:laravel,代码行数:12,代码来源:PagesController.php

示例2: handle

 /**
  * @param $request
  * @param Closure $next
  * @return \Illuminate\Http\JsonResponse
  */
 public function handle($request, Closure $next)
 {
     $localCode = strtoupper(App::getLocale());
     $vrfArr = array('id', 'firstName', 'lastName', 'email', 'title', 'content');
     $verify = true;
     switch ($localCode) {
         case "VI":
             $fail = "Vui lòng điền đầy đủ thông tin và thử lại.";
             break;
         case "EN":
             $fail = "Please enter fully information.";
             break;
         default:
             $fail = "Please enter fully information.";
             break;
     }
     for ($i = 0; $i < count($vrfArr); $i++) {
         if ($request->input($vrfArr[$i]) == null || $request->input($vrfArr[$i]) == '') {
             $verify = false;
         }
     }
     if ($verify == false) {
         return response()->json(['info' => 'Fail', 'Content' => $vrfArr], 200);
     } else {
         return $next($request);
     }
 }
开发者ID:hailongitzero,项目名称:VCTravel,代码行数:32,代码来源:VerifyReview.php

示例3: getInputs

 public function getInputs($inputs)
 {
     $inputs['datetime_ini'] = HelperRepository::date($inputs['datetime_ini'], App::getLocale());
     $inputs['datetime_end'] = HelperRepository::date($inputs['datetime_end'], App::getLocale());
     $inputs['cost'] = HelperRepository::money($inputs['cost'], App::getLocale());
     return $inputs;
 }
开发者ID:alientronics,项目名称:fleetany-web,代码行数:7,代码来源:EntryRepositoryEloquent.php

示例4: rootsForMenu

 /**
  * Get online root elements
  *
  * @param  int    $menuId
  * @return object
  */
 public function rootsForMenu($menuId)
 {
     return $this->model->whereHas('translations', function (Builder $q) {
         $q->where('status', 1);
         $q->where('locale', App::getLocale());
     })->with('translations')->whereMenuId($menuId)->orderBy('position')->get();
 }
开发者ID:Houbsi,项目名称:Menu,代码行数:13,代码来源:EloquentMenuItemRepository.php

示例5: getPaymentMethods

 /**
  * Return available payment methods by country and payment group
  * Method parameters can be set via config
  *
  * @param string [Optional] $country
  * @param array [Optional] $payment_groups_names
  * @return array
  */
 public static function getPaymentMethods($country = null, $payment_groups_names = null)
 {
     $payment_methods_info = WebToPay::getPaymentMethodList(intval(config('paysera.projectid')), config('paysera.currency'));
     $country_code = !is_null($country) ? $country : strtolower(config('paysera.country'));
     $payment_methods_info->setDefaultLanguage(App::getLocale());
     $result = [];
     $country_payment_methods_info = $payment_methods_info->getCountry($country_code);
     $result['country_code'] = $country_payment_methods_info->getCode();
     $result['country_title'] = $country_payment_methods_info->getTitle();
     $payment_methods_groups_all = $country_payment_methods_info->getGroups();
     if ($payment_groups_names == null) {
         $payment_groups_names = config('paysera.payment_groups');
     }
     foreach ($payment_groups_names as $payment_groups_name) {
         $payment_methods_groups[$payment_groups_name] = $payment_methods_groups_all[$payment_groups_name];
         $result['payment_groups'][$payment_groups_name]['title'] = $payment_methods_groups_all[$payment_groups_name]->getTitle(App::getLocale());
         foreach ($payment_methods_groups_all[$payment_groups_name]->getPaymentMethods() as $key => $method) {
             $tmp = [];
             $tmp['title'] = $method->getTitle(App::getLocale());
             $tmp['key'] = $key;
             $tmp['currency'] = $method->getBaseCurrency();
             $tmp['logo_url'] = $method->getLogoUrl();
             $tmp['object'] = $method;
             $result['payment_groups'][$payment_groups_name]['methods'][$key] = $tmp;
         }
     }
     return $result;
 }
开发者ID:adumskis,项目名称:laravel-paysera,代码行数:36,代码来源:PayseraManager.php

示例6: getLocaleOf

 public function getLocaleOf($page)
 {
     $locale = App::getLocale();
     //$data = Texts::all()->where('slug','=', $page)->where('lang','=', $locale);
     $data = DB::table('texts')->where('slug', '=', $page)->where('lang', '=', $locale)->first();
     return $data;
 }
开发者ID:chinatown34,项目名称:not_interesting_shit,代码行数:7,代码来源:Texts.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $localCode = strtoupper(App::getLocale());
     $commonModel = new Models\CommonModel();
     switch ($localCode) {
         case "VI":
             $fail = "Vui lòng nhập email và thử lại.";
             $fail1 = "Email của bạn quá dài, vui lòng nhập lại.";
             $fail2 = "Email của bạn đã được đăng ký.";
             break;
         case "EN":
             $fail = "Please input your email!";
             $fail1 = "Your email is too long!";
             $fail2 = "This email already subscribe";
             break;
         default:
             $fail = "Please input your email!";
             $fail1 = "Your email is too long!";
             $fail2 = "This email already subscribe";
             break;
     }
     if ($request->input('email') == null || $request->input('email') == '') {
         return response()->json(['info' => 'Fail', 'Content' => $fail], 200);
     } elseif (strlen($request->input('email')) > 50) {
         return response()->json(['info' => 'Fail', 'Content' => $fail1], 200);
     } else {
         $exist = $commonModel->checkExistEmail($request->input('email'));
         if ($exist > 0) {
             return response()->json(['info' => 'Fail', 'Content' => $fail2], 200);
         } else {
             return $next($request);
         }
     }
 }
开发者ID:hailongitzero,项目名称:VCTravel,代码行数:41,代码来源:VerifyEmail.php

示例8: __construct

 public function __construct(Model $model = null, ElegantModelFieldInterface $field, $context = null, $locale = null)
 {
     $this->locale = $locale ?: App::getLocale();
     $this->model = $model;
     $this->field = $field;
     $this->context = $context;
 }
开发者ID:pixelindustries,项目名称:elegant-asgard,代码行数:7,代码来源:AbstractPresenter.php

示例9: __construct

 public function __construct($lang = null)
 {
     // set langcode
     if (is_null($lang)) {
         $lang = App::getLocale();
     }
     $this->langCode = $lang . '_' . strtoupper($lang);
 }
开发者ID:approached,项目名称:laravel-date-international,代码行数:8,代码来源:DateIntlBuilder.php

示例10: allOnline

 /**
  * Get all online menus
  * @return object
  */
 public function allOnline()
 {
     $locale = App::getLocale();
     return $this->model->whereHas('translations', function (Builder $q) use($locale) {
         $q->where('locale', "{$locale}");
         $q->where('status', 1);
     })->with('translations')->orderBy('created_at', 'DESC')->get();
 }
开发者ID:bitsoflove,项目名称:Menu,代码行数:12,代码来源:EloquentMenuRepository.php

示例11: __get

 /**
  * Returns the language translation for the given key, based on the app's current
  * locale setting.
  *
  * @param string $key
  * @return mixed
  */
 public function __get($key)
 {
     $lang = App::getLocale();
     if (isset($this->translated[$lang][$key])) {
         return $this->trans($lang, $key);
     }
     return parent::__get($key);
 }
开发者ID:tectonic,项目名称:laravel-localisation,代码行数:15,代码来源:TranslationRetriever.php

示例12: scopeLanguage

 /**
  * @param $query
  * @param bool|false $data
  */
 public function scopeLanguage($query, $data = false)
 {
     if ($data === true) {
         $query->where('lang', App::getLocale())->orWhere('lang', '');
     } else {
         $query->where('lang', '=', App::getLocale());
     }
 }
开发者ID:Vatia13,项目名称:megaportal,代码行数:12,代码来源:Article.php

示例13: getInputs

 public function getInputs($inputs)
 {
     $inputs['pickup_date'] = HelperRepository::date($inputs['pickup_date'], App::getLocale());
     $inputs['deliver_date'] = HelperRepository::date($inputs['deliver_date'], App::getLocale());
     $inputs['fuel_cost'] = HelperRepository::money($inputs['fuel_cost'], App::getLocale());
     $inputs['fuel_amount'] = HelperRepository::money($inputs['fuel_amount'], App::getLocale());
     return $inputs;
 }
开发者ID:alientronics,项目名称:fleetany-web,代码行数:8,代码来源:TripRepositoryEloquent.php

示例14: strtoupper

 function __construct()
 {
     $this->appid = Config::get('sweet-captcha::SWEETCAPTCHA_APP_ID');
     $this->key = Config::get('sweet-captcha::SWEETCAPTCHA_KEY');
     $this->secret = Config::get('sweet-captcha::SWEETCAPTCHA_SECRET');
     $this->path = Config::get('sweet-captcha::SWEETCAPTCHA_PUBLIC_URL');
     $this->language = strtoupper(Config::get('sweet-captcha::SWEETCAPTCHA_LANGUAGE') != '' ? Config::get('sweet-captcha::SWEETCAPTCHA_LANGUAGE') : App::getLocale());
 }
开发者ID:jordij,项目名称:sweet-captcha,代码行数:8,代码来源:SweetCaptcha.php

示例15: handle

 /**
  * @param QuizWasCreated $event
  */
 public function handle(QuizWasCreated $event)
 {
     $quiz = Quiz::find($event->quiz->id);
     $title = $quiz->name;
     $link = App::getLocale() . '/quiz/' . $quiz->id;
     $user = User::find($event->user->id);
     $username = $user->name;
     $this->mailer->compose($user->email, $username, $title, $link)->send();
 }
开发者ID:nilsenj,项目名称:itway,代码行数:12,代码来源:QuizWasCreatedListener.php


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