/**
  * This method gets called by the translation manager when the default locale
  * has been changed.
  *
  * @param      string The new default locale.
  *
  * @author     Dominik del Bondio <*****@*****.**>
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 public function localeChanged($newLocale)
 {
     $this->locale = $newLocale;
     $this->groupingSeparator = $this->locale->getNumberSymbolGroup();
     $this->decimalSeparator = $this->locale->getNumberSymbolDecimal();
     $format = $this->locale->getCurrencyFormat('__default');
     if (is_array($this->customFormat)) {
         $format = AgaviToolkit::getValueByKeyList($this->customFormat, AgaviLocale::getLookupPath($this->locale->getIdentifier()), $format);
     } elseif ($this->customFormat) {
         $format = $this->customFormat;
     }
     $this->setFormat($format);
 }
示例#2
0
 public function testGetValueByKeyList()
 {
     $array = array('one' => 'edno', 'two' => 'dve', 'three' => 'tri', 'four' => 'chetiri');
     $keys = array('one', 'two', 'three');
     $this->assertEquals('edno', AgaviToolkit::getValueByKeyList($array, $keys));
     $this->assertEquals('dve', AgaviToolkit::getValueByKeyList($array, array('two')));
     $this->assertEquals('dve', AgaviToolkit::getValueByKeyList($array, array('two'), 'default'));
     $this->assertEquals(NULL, AgaviToolkit::getValueByKeyList($array, array('five')));
     $this->assertEquals('pet', AgaviToolkit::getValueByKeyList($array, array('five'), 'pet'));
 }
 /**
  * This method gets called by the translation manager when the default locale
  * has been changed.
  *
  * @param      string The new default locale.
  *
  * @author     Dominik del Bondio <*****@*****.**>
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 public function localeChanged($newLocale)
 {
     $this->locale = $newLocale;
     $format = null;
     // ze default
     if (is_array($this->customFormat)) {
         $format = AgaviToolkit::getValueByKeyList($this->customFormat, AgaviLocale::getLookupPath($this->locale->getIdentifier()));
     } elseif ($this->customFormat && !$this->translationDomain) {
         $format = $this->customFormat;
     }
     if ($format === null || $this->isDateSpecifier($format)) {
         $format = $this->resolveSpecifier($this->locale, $format, $this->type);
     }
     $this->setFormat($format);
 }
 /**
  * This method gets called by the translation manager when the default locale
  * has been changed.
  *
  * @param      AgaviLocale The new default locale.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 public function localeChanged($newLocale)
 {
     $this->locale = $newLocale;
     $this->currentData = AgaviToolkit::getValueByKeyList($this->domainData, AgaviLocale::getLookupPath($this->locale->getIdentifier()), array());
 }