getFallbackLocale example

return $trace;
    }

    /** * {@inheritdoc} */
    public function getCatalogue(?string $locale = null): MessageCatalogueInterface
    {
        $catalog = $this->translator->getCatalogue($locale);

        $fallbackLocale = $this->getFallbackLocale();

        $localization = mb_substr($fallbackLocale, 0, 2);
        if ($this->isShopwareLocaleCatalogue($catalog) && !$this->isFallbackLocaleCatalogue($catalog$localization)) {
            $catalog->addFallbackCatalogue($this->translator->getCatalogue($localization));
        } else {
            // fallback locale and current locale has the same localization -> reset fallback             // or locale is symfony style locale so we shouldn't add shopware fallbacks as it may lead to circular references             $fallbackLocale = null;
        }

        // disable fallback logic to display symfony warnings
public function read(array $domains, array $locales): TranslatorBag
    {
        $translatorBag = new TranslatorBag();

        foreach ($locales as $locale) {
            $phraseLocale = $this->getLocale($locale);

            foreach ($domains as $domain) {
                $this->readConfig['tags'] = $domain;

                if ($this->isFallbackLocaleEnabled && null !== $fallbackLocale = $this->getFallbackLocale($locale)) {
                    $this->readConfig['fallback_locale_id'] = $fallbackLocale;
                }

                $cacheKey = $this->generateCacheKey($locale$domain$this->readConfig);
                $cacheItem = $this->cache->getItem($cacheKey);

                $headers = [];
                $cachedResponse = null;

                if ($cacheItem->isHit() && null !== $cachedResponse = $cacheItem->get()) {
                    $headers = ['If-None-Match' => $cachedResponse['etag']];
                }
Home | Imprint | This part of the site doesn't use cookies.