Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes "setlocale" to LC_TIME after locking the front-end language.

  • Loading branch information...
commit e0157ad6b3e46c124533e295a13597208ebe641b 1 parent adaa35c
@marcoscoelho marcoscoelho authored
View
12 system/cms/core/MY_Controller.php
@@ -14,7 +14,7 @@ public function MY_Controller()
parent::__construct();
$this->benchmark->mark('my_controller_start');
-
+
// TODO: Remove all this migration check in the next major version after 1.3.0
// This extra check needs to be done to make the "multisite" changes run before the rest
// of the controller attempts to run
@@ -69,6 +69,7 @@ public function MY_Controller()
// With that done, load settings
$this->load->library(array('settings/settings'));
+ // Lock front-end language
if ( ! (is_a($this, 'Admin_Controller') && ($site_lang = AUTO_LANGUAGE)))
{
$site_public_lang = explode(',', Settings::get('site_public_lang'));
@@ -90,6 +91,15 @@ public function MY_Controller()
$pyro['lang'] = $langs[CURRENT_LANGUAGE];
$pyro['lang']['code'] = CURRENT_LANGUAGE;
+ // Set php locale time
+ if (isset($langs[CURRENT_LANGUAGE]['codes']) && sizeof($locale = (array) $langs[CURRENT_LANGUAGE]['codes']) > 1)
+ {
+ array_unshift($locale, LC_TIME);
+ call_user_func_array('setlocale', $locale);
+ unset($locale);
+ }
+
+ // Reload languages
if (AUTO_LANGUAGE !== CURRENT_LANGUAGE)
{
$this->config->set_item('language', $langs[CURRENT_LANGUAGE]['folder']);
View
9 system/cms/hooks/pick_language.php
@@ -65,15 +65,6 @@ function pick_language()
// Set the language config. Selects the folder name from its key of 'en'
$CI_config->set_item('language', $config['supported_languages'][$lang]['folder']);
- // Set php locale time
- if (isset($config['supported_languages'][$lang]['codes']) &&
- sizeof($locale = (array) $config['supported_languages'][$lang]['codes']) > 1)
- {
- array_unshift($locale, LC_TIME);
- call_user_func_array('setlocale', $locale);
- unset($locale);
- }
-
// Sets a constant to use throughout ALL of CI.
define('AUTO_LANGUAGE', $lang);
}
Please sign in to comment.
Something went wrong with that request. Please try again.