/**
  * Gets all available locales
  * @return array all Locale objects
  */
 public function getLocales()
 {
     $file = new File(self::FILE);
     if ($file->exists()) {
         require $file;
     }
     if (isset($locales)) {
         return $locales;
     }
     $locales = $this->io->getLocales();
     $parent = $file->getParent();
     $parent->create();
     $php = $this->generatePhp($locales);
     $file->write($php);
     return $locales;
 }
Example #2
0
 /**
  * Gets the preferred order of the locales
  * @return array Array with locale codes
  */
 public function getOrder()
 {
     $orderConfig = Zibo::getInstance()->getConfigValue(self::CONFIG_LOCALE_ORDER);
     if (empty($orderConfig)) {
         $order = array();
         $locales = $this->io->getAllLocales();
         foreach ($locales as $locale) {
             $order[] = $locale->getCode();
         }
     } else {
         $order = explode(',', $orderConfig);
     }
     return $order;
 }