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{
@@ -52,21 +54,29 @@ class Resolver implements ResolverInterface
5254 */
5355 private $ defaultLocalePath ;
5456
57+ /**
58+ * @var DeploymentConfig
59+ */
60+ private $ deploymentConfig ;
61+
5562 /**
5663 * @param ScopeConfigInterface $scopeConfig
5764 * @param string $defaultLocalePath
5865 * @param string $scopeType
5966 * @param mixed $locale
67+ * @param DeploymentConfig|null $deploymentConfig
6068 */
6169 public function __construct (
6270 ScopeConfigInterface $ scopeConfig ,
6371 $ defaultLocalePath ,
6472 $ scopeType ,
65- $ locale = null
73+ $ locale = null ,
74+ DeploymentConfig $ deploymentConfig = null
6675 ) {
6776 $ this ->scopeConfig = $ scopeConfig ;
6877 $ this ->defaultLocalePath = $ defaultLocalePath ;
6978 $ this ->scopeType = $ scopeType ;
79+ $ this ->deploymentConfig = $ deploymentConfig ?: ObjectManager::getInstance ()->create (DeploymentConfig::class);
7080 $ this ->setLocale ($ locale );
7181 }
7282
@@ -93,7 +103,10 @@ public function setDefaultLocale($locale)
93103 public function getDefaultLocale ()
94104 {
95105 if (!$ this ->defaultLocale ) {
96- $ locale = $ this ->scopeConfig ->getValue ($ this ->getDefaultLocalePath (), $ this ->scopeType );
106+ $ locale = false ;
107+ if ($ this ->deploymentConfig ->isAvailable () && $ this ->deploymentConfig ->isDbAvailable ()) {
108+ $ locale = $ this ->scopeConfig ->getValue ($ this ->getDefaultLocalePath (), $ this ->scopeType );
109+ }
97110 if (!$ locale ) {
98111 $ locale = self ::DEFAULT_LOCALE ;
99112 }
0 commit comments