Esempio n. 1
0
 /**
  * Gets the fallback locales.
  *
  * @return array $locales The fallback locales
  */
 public function getFallbackLocales()
 {
     if ($this->translator instanceof Translator) {
         return $this->translator->getFallbackLocales();
     }
     return array();
 }
 /**
  * Get the list of available locales for the PIM.
  *
  * @return array
  */
 public function getLocales()
 {
     $locales = [];
     $fallbackLocales = $this->translator->getFallbackLocales();
     $localeNames = Intl::getLocaleBundle()->getLocaleNames(self::MAIN_LOCALE);
     $mainProgress = $this->getProgress(self::MAIN_LOCALE);
     foreach ($localeNames as $code => $locale) {
         if ($this->isAvailableLocale($fallbackLocales, $locales, $code, $mainProgress)) {
             $locales[$code] = $locale;
         }
     }
     return $locales;
 }