Skip to content
Permalink
Browse files

rename I18n::environmentLocale to I18n::defaultLocale

This better reflects woat the method/property means - it's the locale
before the application did anything
  • Loading branch information...
AD7six committed Sep 19, 2014
1 parent 78e6420 commit 8b764b25a61bc47dc786fef3c7682f8bb605ad57
@@ -41,7 +41,7 @@ class I18n {
*
* @var string
*/
protected static $_environmentLocale;
protected static $_defaultLocale;
/**
* Returns the translators collection instance. It can be used
@@ -203,7 +203,7 @@ public static function config($name, callable $loader) {
* @return string|null The name of the default locale.
*/
public static function locale($locale = null) {
static::environmentLocale();
static::defaultLocale();
if (!empty($locale)) {
Locale::setDefault($locale);
@@ -227,11 +227,11 @@ public static function locale($locale = null) {
*
* @return string
*/
public static function environmentLocale() {
if (static::$_environmentLocale === null) {
static::$_environmentLocale = Locale::getDefault() ?: 'en_US';
public static function defaultLocale() {
if (static::$_defaultLocale === null) {
static::$_defaultLocale = Locale::getDefault() ?: 'en_US';
}
return static::$_environmentLocale;
return static::$_defaultLocale;
}
/**
@@ -75,7 +75,7 @@ class TranslateBehavior extends Behavior {
* @param array $config The config for this behavior.
*/
public function __construct(Table $table, array $config = []) {
$config += ['defaultLocale' => I18n::environmentLocale()];
$config += ['defaultLocale' => I18n::defaultLocale()];
parent::__construct($table, $config);
$this->_table = $table;
@@ -41,7 +41,7 @@ class TranslateBehaviorTest extends TestCase {
public function tearDown() {
parent::tearDown();
I18n::locale(I18n::environmentLocale());
I18n::locale(I18n::defaultLocale());
TableRegistry::clear();
}

0 comments on commit 8b764b2

Please sign in to comment.
You can’t perform that action at this time.