Returns the query for operators.

@param string $locale The locale to load

@return \Doctrine\ORM\QueryBuilder
432089
protected function getOperatorQuery($locale)
    {
        $qb = $this->createQueryBuilder('operator')
            ->addSelect('operatorValues')
            ->addSelect('translations')
            ->addSelect('operatorValueTranslations')
            ->leftJoin('operator.translations', 'translations', 'WITH', 'translations.locale = :locale')
            ->leftJoin('operator.values', 'operatorValues')
            ->leftJoin(
                'operatorValues.translations',
                'operatorValueTranslations',
                'WITH',
                'operatorValueTranslations.locale = :locale'
            )
            ->setParameter('locale', $locale);

        return $qb;
    }
247055
public function getByLocale(LocaleEntity $locale)
    {
        $app = Application::getFacadeApplication();
        $result = $this->find($locale);
        if ($result === null) {
            $em = $this->getEntityManager();
            try {
                $numTranslatable = (int) $app->make(TranslatableRepository::class)
                    ->createQueryBuilder('t')
                        ->select('count(t.id)')
                        ->getQuery()->getSingleScalarResult();
            } catch (NoResultException $x) {
                $numTranslatable = 0;
            }
            if ($numTranslatable === 0) {
                $numApprovedTranslations = 0;
            } else {
                try {
                    $numApprovedTranslations = (int) $app->make(TranslationRepository::class)
                    ->createQueryBuilder('t')
                        ->select('count(t.id)')
                        ->where('t.locale = :locale')->setParameter('locale', $locale)
                        ->andWhere('t.current = 1')
                        ->getQuery()->getSingleScalarResult();
                } catch (NoResultException $x) {
                    $numApprovedTranslations = 0;
                }
            }
            $result = LocaleStatsEntity::create($locale, $numTranslatable, $numApprovedTranslations);
            $em->persist($result);
            $em->flush($result);
        }

        return $result;
    }
323109
public function getScalarResult(QueryBuilder $qb, $locale = null)
    {
        return $this->getTranslatedQuery($qb, $locale)->getScalarResult();
    }
355741
protected function getPrefix($locale)
    {
        foreach ($this->localeResolver->getDomainConfig() as $_domain => $_locale) {
            if ($_locale === $locale) {
                $urlPrefix = sprintf('%s://%s', $this->request ? $this->request->getScheme() : 'http', $_domain);
                if ($this->request && $this->request->getPort()) {
                    $urlPrefix .= ':'.$this->request->getPort();
                }

                return $urlPrefix;
            }
        }
    }
144083
public function locale($locale = null)
    {
        // Set the locale if a valid local is passed
        if ($locale
            && ($locales = Config::get('decoy.site.locales'))
            && is_array($locales)
            && isset($locales[$locale])) {
            return Session::put('locale', $locale);
        }

        // Return the current locale or default to first one.  Store it in a local var
        // so that multiple calls don't have to do any complicated work.  We're assuming
        // the locale won't change within a single request.
        if (!$this->locale) {
            $this->locale = Session::get('locale', $this->defaultLocale());
        }

        return $this->locale;
    }
115399
private function createQueryBuilderWithLocaleCode(string $localeCode): QueryBuilder
    {
        $queryBuilder = $this->createQueryBuilder('o');
        $queryBuilder
            ->addSelect('translation')
            ->leftJoin('o.translations', 'translation')
            ->andWhere('translation.locale = :localeCode')
            ->setParameter('localeCode', $localeCode)
        ;

        return $queryBuilder;
    }
1084132
public function find(string $operation, string $locale)
    {
        $model = $this->notifications->first(function ($value) use($operation, $locale) {
            return $value->code === $locale && ($value->title === $operation || $value->name === $operation);
        });

        return $model ? $model->content : false;
    }
677461
protected function getFilterQuery($locale)
    {
        $qb = $this->createQueryBuilder('filter')
            ->addSelect('conditionGroups')
            ->addSelect('translations')
            ->addSelect('conditions')
            ->leftJoin(
                'filter.translations',
                'translations',
                'WITH',
                'translations.locale = :locale'
            )
            ->leftJoin('filter.conditionGroups', 'conditionGroups')
            ->leftJoin('conditionGroups.conditions', 'conditions')
            ->setParameter('locale', $locale);

        return $qb;
    }
118918
public function translate($locale = null)
    {
        if (!$locale) {
            $locale = \localizer\locale()->id();
        } else {
            $locale = (int)$locale;
        }

        return $this->getTranslation($locale);
    }
1185231
public function locale($locale = null)
    {
        if ($locale) {
            // Normalize the language
            self::$locale = strtolower(str_replace([' ', '_'], '-', $locale));
        }

        return self::$locale;
    }
919616
private function getShippingQuery($locale = null)
    {
        $qb = $this->createQueryBuilder('shipping')
            ->leftJoin('shipping.deliveryAddress', 'deliveryAddress')
            ->leftJoin('shipping.status', 'status')
            ->leftJoin('shipping.shippingItems', 'shippingItems')
            ->leftJoin('shippingItems.item', 'items');

        if ($locale) {
            $qb->leftJoin('status.translations', 'statusTranslations', 'WITH', 'statusTranslations.locale = :locale')
                ->setParameter('locale', $locale);
        }
        return $qb;
    }
507807
protected function getTranslationOrNew( $locale )
    {
        if( ( $translation = $this->getTranslation( $locale, false ) ) === null )
        {
            $translation = $this->getNewTranslation( $locale );
        }

        return $translation;
    }
1326448
protected function getCurrentLocale($locale = null)
    {
        return null !== $locale
            ? LocaleUtils::formatLocale($locale)
            : $this->getLocale();
    }
650461
public function locale($locale = null)
    {
        if ($locale) {
            $this->_locale = $locale;
        }
        if ($this->_locale) {
            return $this->_locale;
        }
        if (isset($this->_params['locale'])) {
            return $this->_params['locale'];
        }
    }
427528
public function getAllByLocaleAndDomain($locale, $domain)
    {
        return $this->createQueryBuilder('tu')
            ->select('tu, te')
            ->leftJoin('tu.translations', 'te')
            ->where('tu.domain = :domain')
            ->andWhere('te.locale = :locale')
            ->setParameter('domain', $domain)
            ->setParameter('locale', $locale)
            ->getQuery()
            ->getArrayResult();
    }
1006623
protected function getTranslationOrNew($locale)
    {
        if (($translation = $this->getTranslation($locale)) === null) {
            $translation = $this->createNewTranslation($locale);
        }

        return $translation;
    }
1239739
public function get($locale = 'en')
	{
		if (isset($this->stopwords[$locale])) {
			return $this->stopwords[$locale];
		}

		$this->stopwords[$locale] = [];

		$filename = $this->path . '/' . $locale . '.php';

		if (file_exists($filename)) {
			$this->stopwords[$locale] = require $filename;
		}

		return $this->stopwords[$locale];
	}