private function getCustomizedCatalog(MessageCatalogueInterface $catalog): MessageCatalogueInterface
    {
        $request = $this->requestStack->getMasterRequest();
        if (!$request) {
            return $catalog;
        }

        $snippetSetId = $request->attributes->get(SalesChannelRequest::ATTRIBUTE_DOMAIN_SNIPPET_SET_ID);
        if ($snippetSetId === null) {
            return $catalog;
        }

        if (array_key_exists($snippetSetId, $this->isCustomized)) {
            return $this->isCustomized[$snippetSetId];
        }

        $cacheItem = $this->cache->getItem('translation.catalog.' . $snippetSetId);
        if ($cacheItem->isHit()) {
            $snippets = $cacheItem->get();
        } else {
            $snippets = $this->snippetService->getStorefrontSnippets($catalog, $snippetSetId);

            $cacheItem->set($snippets);
            $this->cache->save($cacheItem);
        }

        $newCatalog = clone $catalog;
        $newCatalog->add($snippets);

        return $this->isCustomized[$snippetSetId] = $newCatalog;
    }
private function getCustomizedCatalog(MessageCatalogueInterface $catalog): MessageCatalogueInterface
    {
        $request = $this->requestStack->getMasterRequest();
        if (!$request) {
            return $catalog;
        }

        $snippetSetId = $request->attributes->get(SalesChannelRequest::ATTRIBUTE_DOMAIN_SNIPPET_SET_ID);
        if ($snippetSetId === null) {
            return $catalog;
        }

        if (array_key_exists($snippetSetId, $this->isCustomized)) {
            return $this->isCustomized[$snippetSetId];
        }

        $cacheItem = $this->cache->getItem('translation.catalog.' . $snippetSetId);
        if ($cacheItem->isHit()) {
            $snippets = $cacheItem->get();
        } else {
            $snippets = $this->snippetService->getStorefrontSnippets($catalog, $snippetSetId);

            $cacheItem->set($snippets);
            $this->cache->save($cacheItem);
        }

        $newCatalog = clone $catalog;
        $newCatalog->add($snippets);

        return $this->isCustomized[$snippetSetId] = $newCatalog;
    }
private function getCustomizedCatalog ( MessageCatalogueInterface $ catalog ) : MessageCatalogueInterface { $ request = $ this -> requestStack -> getMasterRequest ( ) ; if ( ! $ request ) { return $ catalog ; } $ snippetSetId = $ request -> attributes -> get ( SalesChannelRequest :: ATTRIBUTE_DOMAIN_SNIPPET_SET_ID ) ; if ( $ snippetSetId === null ) { return $ catalog ; } if ( array_key_exists ( $ snippetSetId , $ this -> isCustomized ) ) { return $ this -> isCustomized [ $ snippetSetId ] ; } $ cacheItem = $ this -> cache -> getItem ( 'translation.catalog.' . $ snippetSetId ) ; if ( $ cacheItem -> isHit ( ) ) { $ snippets = $ cacheItem -> get ( ) ; } else { $ snippets = $ this -> snippetService -> getStorefrontSnippets ( $ catalog , $ snippetSetId ) ; $ cacheItem -> set ( $ snippets ) ; $ this -> cache -> save ( $ cacheItem ) ; } $ newCatalog = clone $ catalog ; $ newCatalog -> add ( $ snippets ) ; return $ this -> isCustomized [ $ snippetSetId ] = $ newCatalog ; }
Add language specific snippets provided by the admin
Add language specific snippets provided by the admin