public function getNames($displayLocale = null) { if (null === $displayLocale) { $displayLocale = Locale::getDefault(); } $names = $this->reader->readEntry($this->path, $displayLocale, array('Names')); if ($names instanceof \Traversable) { $names = iterator_to_array($names); } $collator = new \Collator($displayLocale); $collator->asort($names); return $names; }
public function getNames($displayLocale = null) { if (null === $displayLocale) { $displayLocale = Locale::getDefault(); } // ==================================================================== // For reference: It is NOT possible to return names indexed by // numeric code here, because some numeric codes map to multiple // 3-letter codes (e.g. 32 => "ARA", "ARP", "ARS") // ==================================================================== $names = $this->reader->readEntry($this->path, $displayLocale, array('Names')); if ($names instanceof \Traversable) { $names = iterator_to_array($names); } $index = static::INDEX_NAME; array_walk($names, function (&$value) use($index) { $value = $value[$index]; }); // Sorting by value cannot be done during bundle generation, because // binary bundles are always sorted by keys $collator = new \Collator($displayLocale); $collator->asort($names); return $names; }
/** * @return \IntlDateFormatter */ private function getDateFormatter() { return \IntlDateFormatter::create(Locale::getDefault(), \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE); }