Browse Source

Merge pull request #5839 from cakephp/3.0-lazy-translators

Lazily setting locale name to translators.
Mark Story 11 years ago
parent
commit
0778188bfc
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/I18n/I18n.php

+ 3 - 1
src/I18n/I18n.php

@@ -215,7 +215,9 @@ class I18n
 
         if (!empty($locale)) {
             Locale::setDefault($locale);
-            static::translators()->setLocale($locale);
+            if (isset(static::$_collection)) {
+                static::translators()->setLocale($locale);
+            }
             return;
         }