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


PHP Application::getLocale方法代码示例

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


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

示例1: __construct

 /**
  * Creates new instance.
  *
  * @param  \Illuminate\Foundation\Application                          $app
  * @param  \Arcanedev\Localization\Contracts\RouteTranslatorInterface  $routeTranslator
  * @param  \Arcanedev\Localization\Contracts\LocalesManagerInterface   $localesManager
  */
 public function __construct(Application $app, RouteTranslatorInterface $routeTranslator, LocalesManagerInterface $localesManager)
 {
     $this->app = $app;
     $this->routeTranslator = $routeTranslator;
     $this->localesManager = $localesManager;
     $this->localesManager->setDefaultLocale($this->app->getLocale());
 }
开发者ID:arcanedev,项目名称:localization,代码行数:14,代码来源:Localization.php

示例2: determine

 /**
  * Determine the locale for the current module.
  *
  * @return string
  */
 public function determine()
 {
     $default = $this->app->getLocale();
     if ($this->currentSection() === 'auth') {
         return $this->isValidBackLocale($this->app->request->segment(1)) ? $this->app->request->segment(1) : $default;
     }
     if ($this->currentSection() === 'back') {
         // User might not be set yet if called in a service provider so a fallback is provided
         if ($this->app->auth->user() !== null) {
             return $this->app->auth->user()->locale;
         }
         return $default;
     }
     return $this->isValidLocale($this->app->request->segment(1)) ? $this->app->request->segment(1) : $default;
 }
开发者ID:bjrnblm,项目名称:blender,代码行数:20,代码来源:CurrentLocale.php

示例3: initBaseController

 /**
  * Initialize the base controller sharing important data to all views
  *
  * @return void
  */
 public function initBaseController()
 {
     $lang = $this->app->getLocale();
     $now = $this->carbon->now();
     $this->view->share('lang', $lang);
     $this->view->share('now', $now);
 }
开发者ID:LaraGit,项目名称:larapress,代码行数:12,代码来源:Helpers.php

示例4: collectVisitData

 /**
  * Collects the data for the site view model
  *
  * @return array
  */
 protected function collectVisitData()
 {
     $request = $this->request;
     $user = $request->user();
     $userId = $user ? $user->getKey() : null;
     return ['user_id' => $userId, 'http_referer' => $request->server('HTTP_REFERER'), 'url' => $request->fullUrl(), 'request_method' => $request->method(), 'request_path' => $request->getPathInfo(), 'http_user_agent' => $request->server('HTTP_USER_AGENT'), 'http_accept_language' => $request->server('HTTP_ACCEPT_LANGUAGE'), 'locale' => $this->app->getLocale(), 'request_time' => $request->server('REQUEST_TIME')];
 }
开发者ID:kenarkose,项目名称:tracker,代码行数:12,代码来源:Tracker.php

示例5: setDefaultLocale

 /**
  * Set the default locale.
  *
  * @param  string  $defaultLocale
  *
  * @return self
  */
 public function setDefaultLocale($defaultLocale = null)
 {
     if (is_null($defaultLocale)) {
         $defaultLocale = $this->app->getLocale();
     }
     $this->isDefaultLocaleSupported($defaultLocale);
     $this->defaultLocale = $defaultLocale;
     // TODO: Refresh locales & supportedLocales collection [Locale entity => default property]
     return $this;
 }
开发者ID:rodrigocruz,项目名称:Localization,代码行数:17,代码来源:LocalesManager.php

示例6: __construct

 /**
  * Prep the PHPTAL object
  *
  * @param
  *            $app
  */
 public function __construct($app)
 {
     $this->app = $app;
     $this->config = $app['config'];
     $this->phptal = new \PHPTAL();
     // Override the defaults with information from config file
     $preFilters = $this->config->get('phptal.preFilters', []);
     $postFilters = $this->config->get('phptal.postFilters', []);
     $encoding = $this->config->get('phptal.translationEncoding', 'UTF-8');
     $outputMode = $this->config->get('phptal.outputMode', \PHPTAL::HTML5);
     $phpCodeDestination = $this->config->get('phptal.phpCodeDestination', $app['path.storage'] . '/framework/views');
     $forceReparse = $this->config->get('phptal.forceParse', true);
     $templateRepositories = $this->config->get('phptal.templateRepositories', $app['path.base'] . '/resources/views' . (TEMPLATE_ID ? '/' . TEMPLATE_ID : ''));
     $translationClass = $this->config->get('phptal.translationClass');
     $translationDomain = $this->config->get('phptal.translationDomain', 'messages');
     $translationLanguage = [$this->app->getLocale()];
     // Setting up translation settings
     $this->translationSettings['encoding'] = $encoding;
     if (!empty($translationClass)) {
         $this->setTranslator($translationLanguage, $translationDomain, $translationClass);
     }
     // Setting up all the filters
     if (!empty($preFilters)) {
         foreach ($preFilters as $filter) {
             $this->phptal->addPreFilter($filter);
         }
     }
     if (!empty($postFilters)) {
         $filterChain = new PHPTALFilterChain();
         foreach ($postFilters as $filter) {
             $filterChain->add($filter);
         }
         $this->phptal->setPostFilter($filterChain);
     }
     $this->phptal->setForceReparse($forceReparse);
     $this->phptal->setOutputMode($outputMode);
     $this->phptal->setTemplateRepository($templateRepositories);
     $this->phptal->setPhpCodeDestination($phpCodeDestination);
 }
开发者ID:marcoshoo,项目名称:phptal-laravel,代码行数:45,代码来源:PHPTALEngine.php

示例7: getLocale

 /**
  * Get the current application locale.
  *
  * @return string 
  * @static 
  */
 public static function getLocale()
 {
     return \Illuminate\Foundation\Application::getLocale();
 }
开发者ID:satriashp,项目名称:tour,代码行数:10,代码来源:_ide_helper.php

示例8: getCurrentLocale

 /**
  * Get current locale
  *
  * @return string
  */
 public function getCurrentLocale()
 {
     return $this->app->getLocale();
 }
开发者ID:Viktor-V,项目名称:LavaLang,代码行数:9,代码来源:Locale.php

示例9:

 function __construct(Application $app, Store $session)
 {
     $this->locale = $app->getLocale();
     $this->session = $session;
 }
开发者ID:smalldogs,项目名称:distance,代码行数:5,代码来源:DistanceTranslator.php

示例10: setTimeLocale

 /**
  * Sets the time locale
  *
  * @param string $locale
  * @return void
  */
 public function setTimeLocale($locale = null)
 {
     $locale = $locale ?: $this->session->get('_locale', $this->app->getLocale());
     setlocale(LC_TIME, $this->config->get('translatable.full_locales.' . $locale, null));
     Carbon::setLocale($locale);
 }
开发者ID:NuclearCMS,项目名称:Hierarchy,代码行数:12,代码来源:LocaleManager.php

示例11: systemInfo

 /**
  * @param Application $app
  * @return mixed
  */
 protected function systemInfo(Application $app)
 {
     return ['locale' => $app->getLocale(), 'systemLocales' => $this->system_locales()->toArray(), 'locales' => $this->system_locales()->filter(function ($item) {
         return $item->activated == true;
     })->toArray(), 'systemModules' => $this->system_modules()->toArray()];
 }
开发者ID:jaffle-be,项目名称:framework,代码行数:10,代码来源:SystemController.php


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