translateFactory = $translateFactory; $this->storeManager = $storeManager; $this->deploymentConfig = $deploymentConfig; } /** * Read translations for the given 'path' from application initial configuration. * * @param string $path * @return mixed */ public function get($path = '') { if (!$this->deploymentConfig->isDbAvailable()) { return []; } if (!$this->data) { /** @var Translate $translate */ $translate = $this->translateFactory->create(); $select = $translate->getConnection()->select() ->from($translate->getMainTable(), ['string', 'translate', 'store_id', 'locale']) ->order('store_id'); $translations = []; foreach ($translate->getConnection()->fetchAll($select) as $item) { $store = $this->storeManager->getStore($item['store_id']); $translations[$item['locale']][$store->getCode()][$item['string']] = $item['translate']; } $this->data = new DataObject($translations); } return $this->data->getData($path) ?: []; } }