Get supported locales collection.

@return \Arcanedev\Localization\Entities\SupportedLocaleCollection
190564
public function getSupported()
    {
        return new SupportedLocaleCollection(
            $this->filter(function(Locale $locale) {
                return in_array($locale->key(), $this->supported);
            })
        );
    }
1029902
public function getSiblingLocales()
    {
        $domain = $this->getDomain();
        $locales = $domain
            ? $domain->getLocales()
            : Locale::getCached();
        return $locales;
    }
769335
protected static function get_target_locales()
    {
        // if locales are explicitly set, use these
        if (is_array(self::config()->locales)) {
            return (array)self::config()->locales;
            // otherwise check the allowed locales. If these have been set, use these
        } else if (is_array(Translatable::get_allowed_locales())) {
            return (array)Translatable::get_allowed_locales();
        }

        // last resort is to take the existing content languages
        return array_keys(Translatable::get_existing_content_languages());
    }
1192184
public function getAvailable(): array
    {
        $result = [];

        $dbLanguages = $this->find('list', ['keyField' => 'code', 'valueField' => 'name'])
                            ->where(['trashed IS' => null])
                            ->toArray();
        $supportedLanguages = $this->getSupported();
        $result = array_diff_assoc($supportedLanguages, $dbLanguages);

        return $result;
    }
1080582
public static function addLocaleToCollection(Collection $collection, LocaleInterface $locale)
    {
        $exist = $collection->exists(function ($key, LocaleInterface $el) use ($locale) {
            return $el->isLocale($locale->getLocale());
        });
        if (!$exist) {
            $collection->add($locale);
        }

        return $collection;
    }
895926
public function setSupportedLocales(array $supportedLocales)
    {
        if ( ! is_array($supportedLocales) || empty($supportedLocales))
            throw new UndefinedSupportedLocalesException;

        $this->supportedLocales = $this->filterLocales($supportedLocales);

        return $this;
    }
8452
public function getFallbackLocales()
    {
        if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
            return $this->translator->getFallbackLocales();
        }

        return [];
    }
84140
@GET
    @Produces(MediaType.APPLICATION_JSON)
    @RequiresPermissions(I18nPermissions.LOCALE_READ)
    public Response getSupportedLocales() {
        List<LocaleRepresentation> locales = supportedLocaleFinder.findSupportedLocales();
        if (!locales.isEmpty()) {
			return Response.ok(locales).build();
		}
        return Response.noContent().build();
    }
1083045
protected function getLocaleChoices()
    {
        $localeChoices = [];

        if (!$this->request) {
            return [];
        }

        if (!$this->getRequest()->get('locale')) {
            $locale = $this->getRequest()->getLocale();
        } else {
            $locale = $this->getRequest()->get('locale');
        }

        if (is_array($locale) && array_key_exists('value', $locale)) {
            $locale = $locale['value'];
        }

        $localeList = Intl::getLocaleBundle()->getLocaleNames(substr($locale, 0, 2));

        foreach ($this->languages as $language) {
            $localeChoices[$localeList[$language['locale']]] = $language['locale'];
        }

        return $localeChoices;
    }
784589
@Override
    public Enumeration<Locale> getLocales() {
        if (null == this.locales) {
            this.locales = connection.getEncodingUtils().getLocales(this.request.getHeader("Accept-Language"));
        }
        return Collections.enumeration(this.locales);
    }
467494
public function getSupportedLanguages($currentID)
    {
        $environment  = $this->getEnvironment();
        $dataProvider = $environment->getDataProvider();

        // Check if current data provider supports multi language.
        if ($dataProvider instanceof MultiLanguageDataProviderInterface) {
            $supportedLanguages = $dataProvider->getLanguages($currentID);
        } else {
            $supportedLanguages = null;
        }

        // Check if we have some languages.
        if (null === $supportedLanguages) {
            return [];
        }

        $translator = $environment->getTranslator();

        // Make an array from the collection.
        $languages = [];
        foreach ($supportedLanguages as $value) {
            /** @var LanguageInformationInterface $value */
            $locale = $value->getLocale();

            $languages[$locale] = $translator->translate('LNG.' . $locale, 'languages');
        }

        return $languages;
    }
1283487
public function getLocales()
    {
        $this->start();
        try {
            $this->getUserControl()->checkRateLimit();
            $this->getUserControl()->checkGenericAccess(__FUNCTION__);
            $locales = $this->app->make(LocaleRepository::class)->getApprovedLocales();
            $result = $this->buildJsonResponse($this->localesToArray($locales));
        } catch (Exception $x) {
            $result = $this->buildErrorResponse($x);
        } catch (Throwable $x) {
            $result = $this->buildErrorResponse($x);
        }

        return $this->finish($result);
    }
1278555
public function translations()
    {
        $model = '\\'.get_class($this);

        if (isset($this->translatable))
        {
            return $model::where('translation_of', $this->id)->get();
        }

        return collect();
    }
1056277
public function availableLocales()
    {
        $locales = $this->getCore()->config('locale.translation-locales');

        if (is_array($locales)) {
            return $locales;
        }

        return $this->getLocaleRepository()->getAvailable();
    }
739058
public function getSupportedCollations()
    {
        if ($this->supportedCollations === null) {
            $supportedCollations = [];
            $rs = $this->executeQuery('SHOW COLLATION');
            while (($row = $rs->fetch(PDO::FETCH_ASSOC)) !== false) {
                if (!isset($row['Collation']) || !isset($row['Charset'])) {
                    throw new Exception(t('Unrecognized result of the "%s" database query.', 'SHOW COLLATION'));
                }
                $supportedCollations[strtolower($row['Collation'])] = strtolower($row['Charset']);
            }
            $this->supportedCollations = $supportedCollations;
        }

        return $this->supportedCollations;
    }
379430
public static function languagesLocaleCodes()
    {
        static $list;

        if ($list === null) {
            $list = [];
            foreach (static::codes() as $localeCode) {
                if ($languageCode = static::languageCode($localeCode)) {
                    $list[$languageCode][] = $localeCode;
                }
            }
        }

        return $list;
    }
950147
public function getLocales()
    {
        $entities = [];
        if ($this->entity->getLocales()) {
            foreach ($this->entity->getLocales() as $locale) {
                $entities[] = new ContactLocale($locale);
            }
        }

        return $entities;
    }