<?php

namespace App\Traits;

use Symfony\Component\Intl\Locales;

Trait LanguagesTrait
{
    protected function getLanguages ()
    {
        $locales = Locales::getNames(null);
        $languages = [];
        foreach($this->getParameter('app.languages') as $language)
        {
            if(isset($locales[$language]))
            {
                $languages[$locales[$language]] = $language;
            }
        }

        return $languages;
    }
}
