@param array $locales

@return array
439066
private function convertSingleEntryToDefault(array $locales): array
    {
        foreach ($locales as $group => $segments) {
            // If single locale is passed, it's considered the default for this group
            if (!is_array($segments)) {
                $locales[$group] = $segments = ['/' => $segments];
            }
        }

        return $locales;
    }
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;
    }
840489
private function getProductUnits($locale)
    {
        /** @var Unit[] $productUnits */
        $productUnits = $this->get('sulu_product.unit_repository')->findAllByLocale($locale);

        $result = [];

        foreach ($productUnits as $productUnit) {
            $result[] = [
                'id' => $productUnit->getId(),
                'name' => $productUnit->getTranslation($locale)->getName(),
            ];
        }

        return $result;
    }
157193
public function findForLocalesAndDomains(array $locales, array $domains)
    {
        $builder = $this->createQueryBuilder();

        if (count($locales) > 0) {
            $builder->field('locale')->in($locales);
        }

        if (count($domains) > 0) {
            $builder->field('domain')->in($domains);
        }

        $cursor = $builder->getQuery()->execute();

        $files = array();
        foreach ($cursor as $result) {
            $files[] = $result;
        }

        return $files;
    }
487592
protected function getEscapedLocales($locales)
    {
        $escapedLocales = array();
        foreach ($locales as $locale) {
            $escapedLocales[] = str_replace('-', '\-', $locale);
        }

        return implode('|', $escapedLocales);
    }
27541
public function getLocalization($localization)
    {
        $localizations = $this->getLocalizations();
        if (!empty($localizations)) {
            foreach ($localizations as $webspaceLocalization) {
                $result = $webspaceLocalization->findLocalization($localization);

                if ($result) {
                    return $result;
                }
            }
        }

        return;
    }
633946
public function findUsagesByLocales( array $locales )
    {
        $select = $this->sql()
                       ->select()
                       ->columns( array(
                           'id',
                           'name',
                           'locale',
                           'usage' => new Sql\Expression(
                                'COUNT( ?.? )',
                                array(
                                    static::$paragraphJoinTableName,
                                    'paragraphId',
                                ),
                                array(
                                    Sql\Expression::TYPE_IDENTIFIER,
                                    Sql\Expression::TYPE_IDENTIFIER,
                                )
                            ),
                        ) )
                       ->join(
                            static::$paragraphJoinTableName,
                            static::$tableName . '.id = ' .
                            static::$paragraphJoinTableName . '.tagId',
                            array(),
                            Sql\Select::JOIN_INNER
                        )
                       ->join(
                            static::$paragraphTableName,
                            static::$paragraphTableName . '.id = ' .
                            static::$paragraphJoinTableName . '.paragraphId',
                            array(),
                            Sql\Select::JOIN_INNER
                        )
                       ->where( array(
                            'paragraph.type' => 'content',
                            new Sql\Predicate\PredicateSet(
                                array(
                                    new Sql\Predicate\IsNull( 'locale' ),
                                    new Sql\Predicate\In( 'locale', $locales ),
                                ),
                                Sql\Predicate\PredicateSet::OP_OR
                            ),
                        ) )
                       ->group( array(
                           static::$tableName . '.id',
                           static::$tableName . '.name',
                           static::$tableName . '.locale',
                        ) )
                       ->order( array(
                           static::$tableName . '.name',
                           static::$tableName . '.locale',
                       ) );

        return $this->sql()
                    ->prepareStatementForSqlObject( $select )
                    ->execute();
    }
797950
public function getLocalization($locale)
    {
        $dataCollection = $this->getLocalizations();
        $data = $dataCollection->get($locale);

        return $data;
    }
43054
private function inSupportedLocales(array $matches)
    {
        foreach (array_keys($matches) as $locale) {
            if ($this->isSupported($locale)) return $locale;

            // Search for acceptable locale by 'regional' => 'fr_FR' match.
            foreach ($this->supportedLocales as $key => $entity) {
                /** @var \Arcanedev\Localization\Entities\Locale $entity */
                if ($entity->regional() == $locale) return $key;
            }
        }

        return null;
    }
389845
public function getFieldDescriptors($locale)
    {
        if ($locale !== $this->currentLocale) {
            $this->initializeFieldDescriptors($locale);
        }

        return $this->fieldDescriptors;
    }
963639
private function loadData($locale)
    {
        if (!empty($this->ids)) {
            return $this->mediaManager->getByIds($this->ids, $locale);
        } else {
            return [];
        }
    }
811671
private function getTaxClasses($locale)
    {
        $itemManager = $this->get('sulu_sales_core.item_manager');
        /** @var TaxClass[] $taxClasses */
        $taxClasses = $this->get('sulu_product.tax_class_repository')->findAll();

        $result = [];

        foreach ($taxClasses as $taxClass) {
            $result[] = [
                'id' => $taxClass->getId(),
                'name' => $taxClass->getTranslation($locale)->getName(),
                'tax' => $itemManager->retrieveTaxForClass($taxClass)
            ];
        }

        return $result;
    }
1008757
public function getApiObjects($entities, $locale)
    {
        return array_map(
            function($entity) use ($locale) {
                return $this->getApiObject($entity, $locale);
            },
            $entities
        );
    }
1198183
public static function getLocales(string $bundle) :array {

		// declare an array to hold the list
		$locales = array();
		// set the locales path
		$locales_path = "../Private/Bundles/{$bundle}/Locales/";
		// if the directory exists
		if(file_exists($locales_path) && is_dir($locales_path)) {
			// for each file in the directory
			foreach(scandir($locales_path) as $locales_file) {
				// if the file is a normal one
				if(substr($locales_file,0,1) != '.' ) {
					// push it into the array of locales
					$locales[] = $locales_path . $locales_file ;
				}
			}
		}
		// return all found locales
		return($locales);
		
	}
56366
protected function lookupLocale(array $locales, string $locale, string $defaultLocale): string
    {
        // for some odd reason locale_lookup returns empty string but not default locale if input locales are empty
        return empty($locales) === true ? $defaultLocale : locale_lookup($locales, $locale, false, $defaultLocale);
    }
1331731
protected function convertToTerLocales(array $locales) {
		$terLocales = array();
		foreach ($locales as $locale) {
			$terLocales[] = isset($this->isoReverseMapping[$locale]) ? $this->isoReverseMapping[$locale] : $locale;
		}
		return $terLocales;
	}
546263
public function findAll($locale)
    {
        $units = $this->unitRepository->findAllByLocale($locale);

        array_walk(
            $units,
            function (&$unit) use ($locale) {
                $unit = new Unit($unit, $locale);
            }
        );

        return $units;
    }