Commit 7f1f7594 by Carsten Brandt

small doc adjustments

parent 4d6d9525
......@@ -54,13 +54,15 @@ class Formatter extends Component
{
/**
* @var string the text to be displayed when formatting a `null` value.
* Defaults to `'<span class="not-set">(not set)</span>'`.
* Defaults to `'<span class="not-set">(not set)</span>'`, where `(not set)`
* will be translated according to [[locale]].
*/
public $nullDisplay;
/**
* @var array the text to be displayed when formatting a boolean value. The first element corresponds
* to the text displayed for `false`, the second element for `true`.
* Defaults to `['No', 'Yes']`.
* Defaults to `['No', 'Yes']`, where `Yes` and `No`
* will be translated according to [[locale]]..
*/
public $booleanFormat;
/**
......@@ -175,14 +177,12 @@ class Formatter extends Component
'decimalSeparator' => null,
];
/**
* @var boolean whether the php `intl` extension is loaded.
*/
private $_intlLoaded = false;
/**
* @inheritdoc
*/
......@@ -191,19 +191,15 @@ class Formatter extends Component
if ($this->timeZone === null) {
$this->timeZone = Yii::$app->timeZone;
}
if ($this->locale === null) {
$this->locale = Yii::$app->language;
}
if ($this->booleanFormat === null) {
$this->booleanFormat = [Yii::t('yii', 'No'), Yii::t('yii', 'Yes')];
}
if ($this->nullDisplay === null) {
$this->nullDisplay = '<span class="not-set">' . Yii::t('yii', '(not set)') . '</span>';
}
$this->_intlLoaded = extension_loaded('intl');
// TODO refactor number formatters
......
......@@ -76,16 +76,6 @@ class FormatterTest extends TestCase
$this->assertSame(date('Y-m-d', $value), $this->formatter->format($value, 'data'));
}
// public function testSetLocale(){
// $value = '12300';
// $this->formatter->setLocale('de-DE');
// $this->assertSame('12.300,00', $this->formatter->asDouble($value, 2));
// $value = time();
// $this->assertSame(date('d.m.Y', $value), $this->formatter->asDate($value));
// $this->formatter->setLocale('en-US');
//
// }
public function testAsRaw()
{
......@@ -201,6 +191,18 @@ class FormatterTest extends TestCase
}
// public function testSetLocale(){
// $value = '12300';
// $this->formatter->setLocale('de-DE');
// $this->assertSame('12.300,00', $this->formatter->asDouble($value, 2));
// $value = time();
// $this->assertSame(date('d.m.Y', $value), $this->formatter->asDate($value));
// $this->formatter->setLocale('en-US');
//
// }
// date format
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment