Fetches the publisher with the name "Unknown Publisher".
@param string $locale Locale of translatable fields
@return Publisher Publisher with the name "Unknown Publisher"
511254
private function getUnknownPublisher($locale)
    {
        $translation = $this->em
            ->getRepository('VipaJournalBundle:PublisherTranslation')
            ->findOneBy(['name' => 'Unknown Publisher']);
        $publisher = $translation !== null ? $translation->getTranslatable() : null;

        if (!$publisher) {
            $publisher = $this->createPublisher('Unknown Publisher', 'http://example.com', $locale);
            $publisher->setCurrentLocale(mb_substr($locale, 0, 2, 'UTF-8'))->setAbout('-');
            $this->em->persist($publisher);
        }

        return $publisher;
    }
397690
public function findAllByLocale($locale)
    {
        try {
            $qb = $this->getUnitQuery($locale)
                ->orderBy('unitTranslations.name', 'ASC');

            return $qb->getQuery()->getResult();
        } catch (NoResultException $exc) {
            return null;
        }
    }
851493
public function getOrCreateTranslationForLocale($locale)
    {
        foreach ($this->getTranslations() as $propelTranslation) {
            if ($propelTranslation->getLocale() == $locale) {
                return $propelTranslation;
            }
        }

        $propelTranslation = new PropelTranslation();
        $propelTranslation->setLocale($locale);
        $this->addTranslation($propelTranslation);

        return $propelTranslation;
    }
987961
private function getCatalogue($locale)
    {
        if (empty($this->catalogues[$locale])) {
            $this->loadCatalogue($locale, $this->dir);
        }

        return $this->catalogues[$locale];
    }
1127827
public function getTranslation($locale)
    {
        /** @var TaxClassTranslation $translation */
        foreach ($this->getTranslations() as $translation) {
            if ($translation->getLocale() === $locale) {
                return $translation;
            }
        }

        return null;
    }
348157
public function getDeliveryCostFormatted($locale = null)
    {
        $formatter = $this->getFormatter($locale);

        return $formatter->format((float)$this->entity->getDeliveryCost());
    }
673468
public function getTotalPriceFormatted($locale = null)
    {
        return $this->priceFormatter->format((float)$this->entity->getTotalPrice(), null, $locale);
    }
858016
public function getLocaleName(string $locale, ?string $displayLocale = null): ?string
    {
        return Locales::getName($locale, $displayLocale);
    }
690270
protected function checkLocale($locale)
    {
        $languageFound = null;
        $language = strstr($locale, '_', true);

        foreach ($this->configuration['locales'] as $availableLocale) {
            // If locale matches, the exact matching was found.
            if ($availableLocale === $locale) {
                return $availableLocale;
            }

            // Check if language (without locale) matches.
            if ($language == $availableLocale) {
                $languageFound = $availableLocale;
            }
        }

        if ($languageFound) {
            return $languageFound;
        }

        return null;
    }
386315
public static final function configuration(string $locale) {
    if (!empty($locale)) {
      Lang::$locale = $locale;
    } else {
      Lang::$locale = Lang::STANDARD_LOCALE;
    }
    return null;
  }
1093002
public function getTitle($locale = null, Array $options = [])
    {
        $removeExtension = !!igorw\get_in($options, ['removeExtension'], false);

        $cache = !$removeExtension;

        if ($cache) {
            try {
                return $this->get_data_from_cache(self::CACHE_TITLE);
            } catch (\Exception $e) {

            }
        }

        $title = '';

        $fields = $this->getDatabox()->get_meta_structure();

        $fields_to_retrieve = [];

        foreach ($fields as $field) {
            if (in_array($field->get_thumbtitle(), ['1', $locale])) {
                $fields_to_retrieve [] = $field->get_name();
            }
        }

        if (count($fields_to_retrieve) > 0) {
            $retrieved_fields = $this->get_caption()->get_highlight_fields($fields_to_retrieve);
            $titles = [];
            foreach ($retrieved_fields as $value) {
                foreach ($value['values'] as $v) {
                    $titles[] = $v['value'];
                }
            }
            $title = trim(implode(' - ', $titles));
        }

        if (trim($title) === '') {
            $title = trim($this->get_original_name($removeExtension));
        }

        $title = $title != "" ? $title : $this->app->trans('reponses::document sans titre');

        if ($cache) {
            $this->set_data_to_cache(self::CACHE_TITLE, $title);
        }

        return $title;
    }
245809
public function resolveDomainForLocale($locale)
    {
        foreach ($this->localeDomainConfig as $domain => $domainLocale) {
            if ($locale === $domainLocale) {
                return $domain;
            }
        }

        return $this->defaultLocale;
    }
1227704
public static function getLanguage($locale)
    {
        return isset(self::$locales[$locale])
            ? self::$locales[$locale]
            : $locale;
    }
515524
public static function getValidator(string $locale = 'en_US'): Factory {
    $translator       = new Translator($locale, new MessageSelector());
    $validatorFactory = new Factory($translator);

    return $validatorFactory;
  }
1071317
protected function getFormatter($locale) {
		if (! isset($this->formatters[$locale])) {
			$this->formatters[$locale] = new IntlDateFormatter($locale, IntlDateFormatter::SHORT, IntlDateFormatter::SHORT);
		}
		
		return $this->formatters[$locale];
	}
1058703
private function getProductQuery($locale)
    {
        $qb = $this->createQueryBuilder('product')
            ->addSelect('prices')
            ->addSelect('parent')
            ->addSelect('translations')
            ->addSelect('status')
            ->addSelect('type')
            ->addSelect('currency')
            ->addSelect('media')
            ->leftJoin('product.parent', 'parent')
            ->leftJoin('product.translations', 'translations', 'WITH', 'translations.locale = :locale')
            ->leftJoin('product.status', 'status')
            ->leftJoin('status.translations', 'statusTranslations', 'WITH', 'statusTranslations.locale = :locale')
            ->leftJoin('product.type', 'type')
            ->leftJoin('product.prices', 'prices')
            ->leftJoin('prices.currency', 'currency')
            ->leftJoin('product.media', 'media')
            ->setParameter('locale', $locale);

        return $qb;
    }
691361
public function getBrandingsWithLocale($locale)
    {
        $result = array();
        foreach ($this->brandings as $branding) {
            if ($branding->hasLocale($locale)) {
                $result[] = $branding;
            }
        }

        return $result;
    }