Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
7f1f7594
Commit
7f1f7594
authored
Sep 07, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small doc adjustments
parent
4d6d9525
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
18 deletions
+16
-18
Formatter.php
framework/base/Formatter.php
+4
-8
FormatterTest.php
tests/unit/framework/base/FormatterTest.php
+12
-10
No files found.
framework/base/Formatter.php
View file @
7f1f7594
...
...
@@ -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
...
...
tests/unit/framework/base/FormatterTest.php
View file @
7f1f7594
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment