/** * Gets all the translations for the provided locale * @param string $localeCode code of the locale * @return array an associative array with translation key - value pairs */ public function getTranslations($localeCode) { if (isset($this->translations[$localeCode])) { return $this->translations[$localeCode]; } $this->translations[$localeCode] = $this->cache->get(self::CACHE_TYPE, $localeCode); if ($this->translations[$localeCode]) { return $this->translations[$localeCode]; } $this->translations[$localeCode] = $this->io->getAllTranslations($localeCode); $this->cache->set(self::CACHE_TYPE, $localeCode, $this->translations[$localeCode]); return $this->translations[$localeCode]; }
/** * Gets all the translations for the provided locale * @param string $localeCode code of the locale * @return array an associative array with translation key - value pairs */ public function getAllTranslations($localeCode) { if (array_key_exists($localeCode, $this->translations)) { return $this->translations[$localeCode]; } $cache = $this->getCache(); $this->translations[$localeCode] = $cache->get(self::CACHE_TYPE, $localeCode); if ($this->translations[$localeCode]) { return $this->translations[$localeCode]; } $this->translations[$localeCode] = $this->io->getAllTranslations($localeCode); $cache->set(self::CACHE_TYPE, $localeCode, $this->translations[$localeCode]); return $this->translations[$localeCode]; }