66namespace Magento \Framework \Locale ;
77
88use Magento \Framework \App \Config \ScopeConfigInterface ;
9+ use Magento \Framework \App \DeploymentConfig ;
10+ use Magento \Framework \App \ObjectManager ;
911
1012class Resolver implements ResolverInterface
1113{
@@ -47,21 +49,29 @@ class Resolver implements ResolverInterface
4749 */
4850 protected $ emulatedLocales = [];
4951
52+ /**
53+ * @var DeploymentConfig
54+ */
55+ private $ deploymentConfig ;
56+
5057 /**
5158 * @param ScopeConfigInterface $scopeConfig
5259 * @param string $defaultLocalePath
5360 * @param string $scopeType
5461 * @param mixed $locale
62+ * @param DeploymentConfig|null $deploymentConfig
5563 */
5664 public function __construct (
5765 ScopeConfigInterface $ scopeConfig ,
5866 $ defaultLocalePath ,
5967 $ scopeType ,
60- $ locale = null
68+ $ locale = null ,
69+ DeploymentConfig $ deploymentConfig = null
6170 ) {
6271 $ this ->scopeConfig = $ scopeConfig ;
6372 $ this ->defaultLocalePath = $ defaultLocalePath ;
6473 $ this ->scopeType = $ scopeType ;
74+ $ this ->deploymentConfig = $ deploymentConfig ?: ObjectManager::getInstance ()->create (DeploymentConfig::class);
6575 $ this ->setLocale ($ locale );
6676 }
6777
@@ -88,7 +98,10 @@ public function setDefaultLocale($locale)
8898 public function getDefaultLocale ()
8999 {
90100 if (!$ this ->defaultLocale ) {
91- $ locale = $ this ->scopeConfig ->getValue ($ this ->getDefaultLocalePath (), $ this ->scopeType );
101+ $ locale = false ;
102+ if ($ this ->deploymentConfig ->isAvailable () && $ this ->deploymentConfig ->isDbAvailable ()) {
103+ $ locale = $ this ->scopeConfig ->getValue ($ this ->getDefaultLocalePath (), $ this ->scopeType );
104+ }
92105 if (!$ locale ) {
93106 $ locale = self ::DEFAULT_LOCALE ;
94107 }
0 commit comments