Exemplo n.º 1
0
 /**
  * Get translations for country states in the current shop language
  * Also includes fallback translations
  * Used internally in sAdmin
  *
  * @param null $state
  * @return array States translations
  */
 public function sGetCountryStateTranslation($state = null)
 {
     if (Shopware()->Shop()->get('skipbackend')) {
         return empty($state) ? array() : $state;
     }
     $languageId = $this->contextService->getShopContext()->getShop()->getId();
     $fallbackId = $this->contextService->getShopContext()->getShop()->getFallbackId();
     $translator = new Shopware_Components_Translation();
     $translationData = $translator->readBatchWithFallback($languageId, $fallbackId, 'config_country_states');
     if (empty($state)) {
         return $translationData;
     }
     if ($translationData[$state["id"]]) {
         $state["statename"] = $translationData[$state["id"]]["name"];
     }
     return $state;
 }
Exemplo n.º 2
0
 /**
  * Loads translations including fallbacks
  *
  * @param $languageId
  * @param $type
  * @return array
  */
 protected function readTranslationWithFallback($languageId, $type)
 {
     $fallbackLanguageId = Shopware()->Db()->fetchOne("SELECT fallback_id FROM s_core_shops WHERE id = ?", array($languageId));
     return $this->translationComponent->readBatchWithFallback($languageId, $fallbackLanguageId, $type);
 }