public function providerGetLocales() { $provider = array(); $options = array('name' => $this->name, 'plural' => $this->plural); $locale = new Locale($this->code, $options['name'], $options['plural']); $provider[] = array($locale, $options); $options = array('name' => $this->name, 'plural' => $this->plural, 'format' => array('date' => array('default' => 'Y-m-d H:i:s'))); $locale = new Locale($this->code . '2', $options['name'], $options['plural']); $locale->setDateFormat('default', 'Y-m-d H:i:s'); $provider[] = array($locale, $options); return $provider; }
/** * Sets the formats of the locale * * @param array $formats * @param zibo\library\i18n\locale\Locale $locale */ private function setFormats($formats, Locale $locale) { if (isset($formats[self::OPTION_DATE])) { foreach ($formats[self::OPTION_DATE] as $identifier => $format) { $locale->setDateFormat($identifier, $format); } } }
public function testGetDateFormatsReturnsAvailableDateFormats() { $locale = new Locale('en', 'en'); $locale->setDateFormat('id', 'd-m-Y'); $dateFormats = $locale->getDateFormats(); $this->assertTrue(is_array($dateFormats)); $this->assertEquals(array('id' => 'd-m-Y'), $dateFormats); }