6 declare(strict_types=1);
37 private $availableLocales;
56 private $deploymentConfig;
72 $this->localeLists = $localeLists;
73 $this->state = $state;
74 $this->availableLocales = $availableLocales;
75 $this->design = $design;
84 return $this->filterLocales($this->localeLists->getOptionLocales());
92 return $this->filterLocales($this->localeLists->getTranslatedOptionLocales());
129 private function filterLocales(array
$locales): array
132 || $this->deploymentConfig->getConfigData(Constants::CONFIG_PATH_SCD_ON_DEMAND_IN_PRODUCTION)) {
136 $theme = $this->design->getDesignTheme();
138 $availableLocales = $this->availableLocales->getList(
$theme->getCode(),
$theme->getArea());
139 }
catch (LocalizedException $e) {
140 $availableLocales = [];
143 return array_filter(
$locales,
function ($localeData) use ($availableLocales) {
144 return in_array($localeData[
'value'], $availableLocales);
__construct(ListsInterface $localeLists, State $state, AvailableLocalesInterface $availableLocales, DesignInterface $design, DeploymentConfig $deploymentConfig=null)
getTranslatedOptionLocales()