getFallbackLocaleId example

$locale = $container->get(ModelManager::class)->getRepository(ShopLocale::class)->find($identity->localeID);
            }
        } elseif ($container->initialized('shop')) {
            $locale = $container->get('shop')->getLocale();
        }

        if ($locale) {
            $this->localeId = $locale->getId();
        }

        // Determine fallback language         $this->fallbackLocaleId = $this->getFallbackLocaleId($this->localeId);
    }

    /** * Filter translation data for saving. * * @param string $type * @param int|null $key * * @return string */
    public function filterData($type, array $data$key = null)
    {

    public function getNavigationAction()
    {
        $node = (int) $this->Request()->getParam('node');
        $filter = $this->Request()->getParam('filter');
        $repository = $this->getRepository('form');

        $user = Shopware()->Container()->get('auth')->getIdentity();
        /** @var Locale $locale */
        $locale = $user->locale;

        $fallback = $this->getFallbackLocaleId($locale->getId());

        $builder = $repository->createQueryBuilder('form')
            ->leftJoin('form.elements', 'element')
            ->leftJoin('element.translations', 'elementTranslation', Join::WITH, 'elementTranslation.localeId IN(:localeId, :fallbackId)')
            ->leftJoin('form.translations', 'translation', Join::WITH, 'translation.localeId = :localeId')
            ->leftJoin('form.translations', 'translationFallback', Join::WITH, 'translationFallback.localeId = :fallbackId')
            ->leftJoin('form.children', 'children')
            ->leftJoin('form.plugin', 'plugin')
            ->select([
                'form.id',
                'COALESCE(translation.label, translationFallback.label, form.label, form.name) as label',
                
/** * @var string */
    private $type;

    public function __construct(Shopware_Components_Translation $translationService, string $type, int $language, int $fallback)
    {
        $this->language = $language;
        $this->loaded = false;
        $this->type = $type;
        $this->fallback = $fallback ?: $translationService->getFallbackLocaleId($language);
        $this->translationService = $translationService;
    }

    /** * Translates an array property. */
    public function translateObjectProperty(array $object, string $translationIndex, ?string $objectIndex = null, ?string $fallback = null): array
    {
        if (!$this->areTranslationsLoaded()) {
            $this->loadTranslations();
        }

        
Home | Imprint | This part of the site doesn't use cookies.