@param string $locale
@param bool $isForOutput

@return DoctrineFieldDescriptor[]
420674
protected function getFieldDescriptors($locale, $isForOutput = false)
    {
        $fieldDescriptors = [];

        $fieldDescriptors['id'] = new DoctrineFieldDescriptor(
            'id',
            'id',
            'SuluProductBundle:Addon',
            'public.id',
            [],
            true,
            false,
            'integer'
        );

        $fieldDescriptors['addonName'] = new DoctrineFieldDescriptor(
            'name',
            'addonName',
            'SuluProductBundle:ProductTranslation',
            'products.product-addon',
            [
                'SuluProductBundle:ProductAddon' => new DoctrineJoinDescriptor(
                    'SuluProductBundle:Product',
                    'SuluProductBundle:Addon.addon'
                ),
                'SuluProductBundle:ProductTranslation' => new DoctrineJoinDescriptor(
                    'SuluProductBundle:ProductTranslation',
                    'SuluProductBundle:ProductAddon.translations',
                    'SuluProductBundle:ProductTranslation.locale = \'' . $locale . '\''
                ),
            ],
            false,
            true,
            'string'
        );

        $fieldDescriptors['number'] = new DoctrineFieldDescriptor(
            'number',
            'number',
            'SuluProductBundle:ProductAddon',
            'product.number',
            [],
            false,
            true,
            'string'
        );

        // We dont want to have the productId in the fields action.
        if (!$isForOutput) {
            $fieldDescriptors['productId'] = new DoctrineFieldDescriptor(
                'id',
                'productId',
                'SuluProductBundle:Product',
                'addon.product',
                [
                    'SuluProductBundle:Product' => new DoctrineJoinDescriptor(
                        'SuluProductBundle:Product',
                        'SuluProductBundle:Addon.product'
                    ),
                ],
                false,
                false,
                'integer'
            );
        }

        return $fieldDescriptors;
    }
860835
public function allByLocale($locale, $perPage = 0)
    {
        $translations = $this->model->where('locale', $locale);
        return $perPage ? $translations->paginate($perPage) : $translations->get();
    }
793455
public function load($locale, $group, $namespace = null)
    {
        $results = [];
        foreach ($this->loaders as $loader) {
            $results = array_merge($results, $loader->load($locale, $group, $namespace));
        }

        return $results;
    }
324641
public function translationsFromFiles($locale)
    {
        $grouped = [];
        foreach ($this->hints as $name => $hint) {
            $languageDirectory = $hint . DIRECTORY_SEPARATOR . $locale;
            if (!is_dir($languageDirectory)) {
                continue;
            }
            $files = $this->filesystem->allFiles($languageDirectory);
            foreach ($files as $filename) {
                $file         = str_replace('.' . $filename->getExtension(), '', $filename->getFilename());
                $translations = array_dot(require $filename->getRealPath());
                foreach ($translations as $key => $translation) {
                    $grouped[$name] [$file . '.' . $key] = $translation;
                }
            }
        }
        return $grouped;
    }
1370531
private function resolveLocales(array $locales, string $defaultLocale): array
    {
        if (empty($locales)) {
            return [$defaultLocale];
        }

        if (!in_array($defaultLocale, $locales)) {
            $locales[] = $defaultLocale;
        }

        return $locales;
    }
45799
protected function getNameForLocale($locale, &$names)
    {
        if (isset($names[$locale][1])) {
            $name = $names[$locale][1];
            unset($names[$locale][1]);
        } elseif (isset($names[$locale][4])) {
            $name = $names[$locale][4];
            unset($names[$locale][4]);
        } else {
            $name = array_shift($names[$locale]);
        }

        return $name;
    }
89871
public static function getStaticReforgedRunes( string $locale = 'en_US', string $version = null ) : array
	{
		$url = self::getStaticDataFileUrl(self::STATIC_RUNESREFORGED, null, $locale, $version);
		return self::loadStaticData($url);
	}
263658
public function getTranslatedPropertyNameAssoc($locale, $mapping)
    {
        return [
            'property'   => $this->getTranslatedPropertyName($locale, $mapping['property']),
            'assoc'      => $this->getTranslatedPropertyName($locale, $mapping['assoc']),
            'assocNulls' => $this->getTranslatedPropertyName($locale, $mapping['assocNulls']),
        ];
    }
401271
public function getAllByLocaleAndDomain($locale, $domain)
    {
        $unitsData = TransUnitQuery::create()
            ->filterByDomain($domain)
            ->joinWith('Translation')
            ->useTranslationQuery()
                ->filterByLocale($locale)
            ->endUse()
            ->setFormatter(ModelCriteria::FORMAT_ARRAY)
            ->find($this->getConnection())
        ;

        return $this->filterTransUnitData($unitsData);
    }
153800
protected function getDatabaseTranslations(Locale $locale)
    {
        $messages   = [];
        $collection = $this->repository->getCollection();
        
        $collection->map(function (Dictionary $dictionary) use ($locale, &$messages) {
            $messages[$dictionary->getIdentifier()] = $dictionary->translate($locale->getCode())->getValue();
        });
        
        return $messages;
    }
189669
protected function initFieldDescriptors($locale)
    {
        $this->fieldDescriptors = [];

        $mediaJoin = [
            self::$mediaEntityName => new DoctrineJoinDescriptor(
                self::$mediaEntityName,
                $this->productEntityName . '.media',
                null,
                DoctrineJoinDescriptor::JOIN_METHOD_INNER
            ),
        ];
        $fileVersionJoin = array_merge(
            $mediaJoin,
            [
                self::$fileEntityName => new DoctrineJoinDescriptor(
                    self::$fileEntityName,
                    self::$mediaEntityName . '.files'
                ),
                self::$fileVersionEntityName => new DoctrineJoinDescriptor(
                    self::$fileVersionEntityName,
                    self::$fileEntityName . '.fileVersions',
                    self::$fileVersionEntityName . '.version = ' . self::$fileEntityName . '.version'
                ),
            ]
        );
        $fileVersionMetaJoin = array_merge(
            $fileVersionJoin,
            [
                self::$fileVersionMetaEntityName => new DoctrineJoinDescriptor(
                    self::$fileVersionMetaEntityName,
                    self::$fileVersionEntityName . '.meta',
                    self::$fileVersionMetaEntityName . '.locale = \'' . $locale . '\''
                ),
            ]
        );

        $this->fieldDescriptors['product'] = new DoctrineFieldDescriptor(
            'id',
            'product',
            $this->productEntityName,
            null,
            [],
            true,
            false
        );

        $this->fieldDescriptors['id'] = new DoctrineFieldDescriptor(
            'id',
            'id',
            self::$mediaEntityName,
            'public.id',
            $mediaJoin,
            true,
            false
        );

        $this->fieldDescriptors['thumbnails'] = new DoctrineFieldDescriptor(
            'id',
            'thumbnails',
            self::$mediaEntityName,
            'media.media.thumbnails',
            $mediaJoin,
            false,
            true,
            'thumbnails',
            '',
            '',
            false
        );

        $this->fieldDescriptors['name'] = new DoctrineFieldDescriptor(
            'name',
            'name',
            self::$fileVersionEntityName,
            'public.name',
            $fileVersionJoin
        );

        $this->fieldDescriptors['size'] = new DoctrineFieldDescriptor(
            'size',
            'size',
            self::$fileVersionEntityName,
            'media.media.size',
            $fileVersionJoin,
            false,
            true,
            'bytes'
        );

        $this->fieldDescriptors['changed'] = new DoctrineFieldDescriptor(
            'changed',
            'changed',
            self::$fileVersionEntityName,
            'public.changed',
            $fileVersionJoin,
            true,
            false,
            'date'
        );

        $this->fieldDescriptors['created'] = new DoctrineFieldDescriptor(
            'created',
            'created',
            self::$fileVersionEntityName,
            'public.created',
            $fileVersionJoin,
            true,
            false,
            'date'
        );

        $this->fieldDescriptors['title'] = new DoctrineFieldDescriptor(
            'title',
            'title',
            self::$fileVersionMetaEntityName,
            'public.title',
            $fileVersionMetaJoin,
            false,
            true,
            'title'
        );

        $this->fieldDescriptors['description'] = new DoctrineFieldDescriptor(
            'description',
            'description',
            self::$fileVersionMetaEntityName,
            'media.media.description',
            $fileVersionMetaJoin
        );
    }
299724
public function findFooter(string $locale): ICollection
	{
		return $this->findMain(true)
			->findBy([
				'this->views->id' => PagesViewsMapper::FOOTER,
				'this->locale->name' => $locale
			]);
	}
207662
protected function getUnits($locale)
    {
        /** @var Status[] $units */
        $units = $this->get('sulu_product.unit_manager')->findAll($locale);

        $unitTitles = [];
        foreach ($units as $unit) {
            $unitTitles[] = [
                'id' => $unit->getId(),
                'name' => $unit->getName(),
            ];
        }

        return $unitTitles;
    }
753763
public static function getByLocale($locale)
    {
        if (!$locale) {
            return null;
        }

        if ($locale instanceof Locale) {
            return $locale;
        }

        if (!static::$locales_by_title) {
            static::$locales_by_title = [];
            foreach (Locale::getCached() as $localeObj) {
                static::$locales_by_title[$localeObj->Locale] = $localeObj;
            }
        }

        // Get filtered locale
        return isset(static::$locales_by_title[$locale]) ? static::$locales_by_title[$locale] : null;
    }
1087977
public static function prototype(?bool $isConsole = false) : array
  {
    return [
      'console' => $isConsole,
      'config' => Application::getConfig(),
      'events' => new Events,
      'route' => new Route,
      'view' => Template::class,
      'variables' => GlobalVariables::class
    ];
  }
902794
public function getByEntity($entityClass, $id, $locale, $object = null)
    {
        $metadata = $this->structureMetadataFactory->getStructureMetadata('page', $object->getStructureType());

        return [
            '_controller' => $metadata->getController(),
            'view' => $metadata->getView(),
            'object' => $object,
            'structure' => $this->documentToStructure($object),
        ];
    }
408914
public static function getDisplayCountries($locale)
    {
        if (!isset(self::$countries[$locale])) {
            self::$countries[$locale] = Intl::getRegionBundle()->getCountryNames($locale);
        }

        return self::$countries[$locale];
    }