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


PHP static::locale方法代码示例

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


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

示例1: setLocale

 /**
  * Установка языка
  *
  * @param string $lang
  * @return boolean
  */
 public static function setLocale($lang)
 {
     if (!static::locale_exists($lang)) {
         return false;
     }
     static::$locale = $lang;
     return true;
 }
开发者ID:AlexanderGrom,项目名称:knee,代码行数:14,代码来源:lang.php

示例2: setLocale

 public function setLocale(Locale $locale)
 {
     static::$locale = $locale;
     app()->setLocale($locale->iso6391());
     setlocale(LC_ALL, $locale->locale());
     Carbon::setLocale($locale->iso6391());
     return $this;
 }
开发者ID:adminarchitect,项目名称:localizer,代码行数:8,代码来源:Localizer.php

示例3: init

 /**
  * Initializes the framework.
  * This can only be called once.
  *
  * @access public
  * @return void
  */
 public static function init($config)
 {
     if (static::$initialized) {
         throw new \FuelException("You can't initialize Fuel more than once.");
     }
     // BC FIX FOR APPLICATIONS <= 1.6.1, makes Redis_Db available as Redis,
     // like it was in versions before 1.7
     class_exists('Redis', false) or class_alias('Redis_Db', 'Redis');
     static::$_paths = array(APPPATH, COREPATH);
     // Is Fuel running on the command line?
     static::$is_cli = (bool) defined('STDIN');
     \Config::load($config);
     // Start up output buffering
     static::$is_cli or ob_start(\Config::get('ob_callback', null));
     if (\Config::get('caching', false)) {
         \Finder::instance()->read_cache('FuelFileFinder');
     }
     static::$profiling = \Config::get('profiling', false);
     static::$profiling and \Profiler::init();
     // set a default timezone if one is defined
     try {
         static::$timezone = \Config::get('default_timezone') ?: date_default_timezone_get();
         date_default_timezone_set(static::$timezone);
     } catch (\Exception $e) {
         date_default_timezone_set('UTC');
         throw new \PHPErrorException($e->getMessage());
     }
     static::$encoding = \Config::get('encoding', static::$encoding);
     MBSTRING and mb_internal_encoding(static::$encoding);
     static::$locale = \Config::get('locale', static::$locale);
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
     }
     // Run Input Filtering
     \Security::clean_input();
     \Event::register('fuel-shutdown', 'Fuel::finish');
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     // Load in the routes
     \Config::load('routes', true);
     \Router::add(\Config::get('routes'));
     // Set locale, log warning when it fails
     if (static::$locale) {
         setlocale(LC_ALL, static::$locale) or logger(\Fuel::L_WARNING, 'The configured locale ' . static::$locale . ' is not installed on your system.', __METHOD__);
     }
     static::$initialized = true;
     // fire any app created events
     \Event::instance()->has_events('app_created') and \Event::instance()->trigger('app_created', '', 'none');
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:61,代码来源:fuel.php

示例4: bootCity

 /**
  * Boot city.
  */
 public static function bootCity()
 {
     static::$locale = config('app.locale', 'en');
     static::$countries = app('translator.countries');
 }
开发者ID:znck,项目名称:countries,代码行数:8,代码来源:Country.php

示例5: setLocale

 /**
  * Set the locale
  *
  * @param string $locale
  */
 public static function setLocale($locale)
 {
     static::$locale = $locale;
 }
开发者ID:irpug,项目名称:facal,代码行数:9,代码来源:FaCalUtils.php

示例6: init

 /**
  * Initializes the framework.  This can only be called once.
  *
  * @access	public
  * @return	void
  */
 public static function init($config)
 {
     if (static::$initialized) {
         throw new \Exception("You can't initialize Fuel more than once.");
     }
     register_shutdown_function('fuel_shutdown_handler');
     set_exception_handler('fuel_exception_handler');
     set_error_handler('fuel_error_handler');
     // Start up output buffering
     ob_start();
     static::$profiling = isset($config['profiling']) ? $config['profiling'] : false;
     if (static::$profiling) {
         \Profiler::init();
         \Profiler::mark(__METHOD__ . ' Start');
     }
     static::$cache_dir = isset($config['cache_dir']) ? $config['cache_dir'] : APPPATH . 'cache/';
     static::$caching = isset($config['caching']) ? $config['caching'] : false;
     static::$cache_lifetime = isset($config['cache_lifetime']) ? $config['cache_lifetime'] : 3600;
     if (static::$caching) {
         static::$path_cache = static::cache('Fuel::path_cache');
     }
     \Config::load($config);
     static::$_paths = array_merge(\Config::get('module_paths', array()), array(APPPATH, COREPATH));
     static::$is_cli = (bool) (php_sapi_name() == 'cli');
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
         \Uri::detect();
     }
     // Run Input Filtering
     \Security::clean_input();
     static::$env = \Config::get('environment');
     static::$locale = \Config::get('locale');
     //Load in the packages
     foreach (\Config::get('always_load.packages', array()) as $package) {
         static::add_package($package);
     }
     // Set some server options
     setlocale(LC_ALL, static::$locale);
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     static::$initialized = true;
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:huglester,项目名称:fuel-uploadify,代码行数:53,代码来源:fuel.php

示例7: init

 /**
  * Initializes the framework.  This can only be called once.
  *
  * @access	public
  * @return	void
  */
 public static function init($config)
 {
     if (static::$initialized) {
         throw new \FuelException("You can't initialize Fuel more than once.");
     }
     static::$_paths = array(APPPATH, COREPATH);
     // Is Fuel running on the command line?
     static::$is_cli = (bool) defined('STDIN');
     \Config::load($config);
     // Start up output buffering
     ob_start(\Config::get('ob_callback', null));
     static::$profiling = \Config::get('profiling', false);
     if (static::$profiling) {
         \Profiler::init();
         \Profiler::mark(__METHOD__ . ' Start');
     }
     static::$cache_dir = \Config::get('cache_dir', APPPATH . 'cache/');
     static::$caching = \Config::get('caching', false);
     static::$cache_lifetime = \Config::get('cache_lifetime', 3600);
     if (static::$caching) {
         \Finder::instance()->read_cache('Fuel::paths');
     }
     // set a default timezone if one is defined
     static::$timezone = \Config::get('default_timezone') ?: date_default_timezone_get();
     date_default_timezone_set(static::$timezone);
     static::$encoding = \Config::get('encoding', static::$encoding);
     MBSTRING and mb_internal_encoding(static::$encoding);
     static::$locale = \Config::get('locale', static::$locale);
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
     }
     // Run Input Filtering
     \Security::clean_input();
     \Event::register('shutdown', 'Fuel::finish');
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     // Load in the routes
     \Config::load('routes', true);
     \Router::add(\Config::get('routes'));
     // Set locale, log warning when it fails
     if (static::$locale) {
         setlocale(LC_ALL, static::$locale) or logger(\Fuel::L_WARNING, 'The configured locale ' . static::$locale . ' is not installed on your system.', __METHOD__);
     }
     static::$initialized = true;
     // fire any app created events
     \Event::instance()->has_events('app_created') and \Event::instance()->trigger('app_created', '', 'none');
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:beingsane,项目名称:TTII_2012,代码行数:58,代码来源:fuel.php

示例8: setDefaultLocale

 /**
  * set locale system-wide
  * @param \Zend\Mvc\MvcEvent $e
  */
 public function setDefaultLocale(MvcEvent $e)
 {
     static::$alias = $e->getRouteMatch()->getParam(self::LOCALE_ROUTE_PARAM);
     static::$locale = static::getLocaleByAlias(static::$alias);
     if (Locale::setDefault(static::$locale) === false) {
         throw new \RuntimeException(sprintf('Not valid locale %s to set it as default', static::$locale));
     }
     // Set translator
     $translator = $e->getApplication()->getServiceManager()->get('MvcTranslator');
     $parsedLocale = \Locale::parseLocale(static::$locale);
     $languageAndRegion = $parsedLocale['language'] . '-' . $parsedLocale['region'];
     $translator->setLocale($languageAndRegion);
 }
开发者ID:joacub,项目名称:libra-locale,代码行数:17,代码来源:Module.php

示例9: init

 /**
  * Initializes the framework.  This can only be called once.
  *
  * @access	public
  * @return	void
  */
 public static function init($config)
 {
     \Config::load($config);
     if (static::$initialized) {
         throw new \Fuel_Exception("You can't initialize Fuel more than once.");
     }
     register_shutdown_function('fuel_shutdown_handler');
     set_exception_handler('fuel_exception_handler');
     set_error_handler('fuel_error_handler');
     // Start up output buffering
     ob_start(\Config::get('ob_callback', null));
     static::$profiling = \Config::get('profiling', false);
     if (static::$profiling) {
         \Profiler::init();
         \Profiler::mark(__METHOD__ . ' Start');
     }
     static::$cache_dir = \Config::get('cache_dir', APPPATH . 'cache/');
     static::$caching = \Config::get('caching', false);
     static::$cache_lifetime = \Config::get('cache_lifetime', 3600);
     if (static::$caching) {
         static::$path_cache = static::cache('Fuel::path_cache');
     }
     // set a default timezone if one is defined
     static::$timezone = \Config::get('default_timezone') ?: date_default_timezone_get();
     date_default_timezone_set(static::$timezone);
     // set the encoding and locale to use
     static::$encoding = \Config::get('encoding', static::$encoding);
     static::$locale = \Config::get('locale', static::$locale);
     static::$_paths = array(APPPATH, COREPATH);
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
         \Uri::detect();
     }
     // Run Input Filtering
     \Security::clean_input();
     static::$env = \Config::get('environment');
     \Event::register('shutdown', 'Fuel::finish');
     //Load in the packages
     foreach (\Config::get('always_load.packages', array()) as $package => $path) {
         is_string($package) and $path = array($package => $path);
         static::add_package($path);
     }
     // Load in the routes
     \Config::load('routes', true);
     \Router::add(\Config::get('routes'));
     // Set  locale
     static::$locale and setlocale(LC_ALL, static::$locale);
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     static::$initialized = true;
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:nathanharper,项目名称:divine-economy,代码行数:62,代码来源:fuel.php

示例10: setUpBeforeClass

 /**
  * This method is called before the first test of this test class is run.
  */
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     static::$helperCtorArgs = array(static::$locale = Locale::factory(array('default' => 'en', 'fallback' => 'en', 'available' => array('en' => true, 'en_US' => true))));
 }
开发者ID:gridguyz,项目名称:zork,代码行数:8,代码来源:LocaleTest.php

示例11: init

 /**
  * Initializes the framework.  This can only be called once.
  *
  * @access	public
  * @return	void
  */
 public static function init($config)
 {
     if (static::$initialized) {
         throw new \FuelException("You can't initialize Fuel more than once.");
     }
     static::$_paths = array(APPPATH, COREPATH);
     // Is Fuel running on the command line?
     static::$is_cli = (bool) defined('STDIN');
     \Config::load($config);
     // Start up output buffering
     ob_start(\Config::get('ob_callback', null));
     static::$profiling = \Config::get('profiling', false);
     if (static::$profiling) {
         \Profiler::init();
         \Profiler::mark(__METHOD__ . ' Start');
     }
     static::$cache_dir = \Config::get('cache_dir', APPPATH . 'cache/');
     static::$caching = \Config::get('caching', false);
     static::$cache_lifetime = \Config::get('cache_lifetime', 3600);
     if (static::$caching) {
         \Finder::instance()->read_cache('Fuel::paths');
     }
     // set a default timezone if one is defined
     static::$timezone = \Config::get('default_timezone') ?: date_default_timezone_get();
     date_default_timezone_set(static::$timezone);
     static::$encoding = \Config::get('encoding', static::$encoding);
     MBSTRING and mb_internal_encoding(static::$encoding);
     static::$locale = \Config::get('locale', static::$locale);
     if (!static::$is_cli) {
         if (\Config::get('base_url') === null) {
             \Config::set('base_url', static::generate_base_url());
         }
     }
     // Run Input Filtering
     \Security::clean_input();
     \Event::register('shutdown', 'Fuel::finish');
     //Load in the packages
     foreach (\Config::get('always_load.packages', array()) as $package => $path) {
         is_string($package) and $path = array($package => $path);
         \Package::load($path);
     }
     // Always load classes, config & language set in always_load.php config
     static::always_load();
     // Load in the routes
     \Config::load('routes', true);
     \Router::add(\Config::get('routes'));
     // Set  locale
     static::$locale and setlocale(LC_ALL, static::$locale);
     static::$initialized = true;
     if (static::$profiling) {
         \Profiler::mark(__METHOD__ . ' End');
     }
 }
开发者ID:reganhimself,项目名称:KeeleProgrammers,代码行数:59,代码来源:fuel.php

示例12: setLocale

 /**
  * Set main locale to be used
  *
  * @param  string Used locale
  * @return string ISO key
  */
 public static function setLocale($locale = '')
 {
     // Set main locale
     static::$locale = self::validateLocale($locale);
 }
开发者ID:nurcahyo,项目名称:juriya,代码行数:11,代码来源:I18n.php

示例13: getLocale

 /**
  * Return the actual locale
  * @return null
  */
 public static final function getLocale()
 {
     /** If not has defined the locale */
     if (static::$locale == NULL && $_SESSION['parvus-locale'] == NULL) {
         static::getConfig();
         /** If the default locale not exist */
         if (static::$config['default'] == NULL) {
             throw new \RuntimeException('Default language not found in app/config/Language.php', E_ERROR);
         }
         /** Save in session */
         $_SESSION['parvus-locale'] = static::$config['default'];
     }
     /** Save in the class */
     static::$locale = $_SESSION['parvus-locale'];
     /** Return the locale */
     return static::$locale;
 }
开发者ID:adrianobnu,项目名称:parvus-framework,代码行数:21,代码来源:Language.php

示例14: setContext

 public static function setContext($locale, $parent)
 {
     static::$locale = $locale;
     static::$parent = $parent;
 }
开发者ID:rainlab,项目名称:translate-plugin,代码行数:5,代码来源:MLCmsObject.php

示例15: scopeJoinTranslation

 /**
  * Inner join with the translation table.
  *
  * @param \Illuminate\Database\Eloquent\Builder $query
  * @param null                                  $locale
  *
  * @return this
  */
 public static function scopeJoinTranslation(Builder $query, $locale = null)
 {
     $instance = new static();
     $translationModelName = $instance->getTranslationModelName();
     $translationModel = new $translationModelName();
     if (is_null($locale)) {
         $locale = $instance->locale();
     }
     return $query->join($translationModel->getTable() . ' as t', 't.' . $instance->getRelationKey(), '=', $instance->getTable() . '.' . $instance->getKeyName())->where($instance->getLocaleKey(), $locale);
 }
开发者ID:approached,项目名称:laravel-translatable,代码行数:18,代码来源:Translatable.php


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