File tree Expand file tree Collapse file tree 2 files changed +3
-25
lines changed Expand file tree Collapse file tree 2 files changed +3
-25
lines changed Original file line number Diff line number Diff line change 1
1
var FormatMessage = require ( '../react-globalize' ) . FormatMessage ;
2
- var FormatNumber = require ( '../react-globalize' ) . FormatNumber ;
3
2
var React = require ( 'react' ) ;
3
+ var Globalize = require ( 'globalize' ) ;
4
4
5
5
module . exports = React . createClass ( {
6
6
getInitialState : function ( ) {
@@ -46,10 +46,7 @@ module.exports = React.createClass({
46
46
< br />
47
47
task count 0 - < FormatMessage locale = { this . state . locale } path = "task" variables = { { count : 0 } } />
48
48
< br />
49
- task count 1000 formatted - < FormatMessage ref = "formattedTask" locale = { this . state . locale } path = "task" variables = { {
50
- count : 1000 ,
51
- formattedCount : < FormatNumber locale = { this . state . locale } value = { 1000 } />
52
- } } />
49
+ task count 1000 formatted - < FormatMessage ref = "formattedTask" locale = { this . state . locale } path = "task" variables = { { count : 1000 , formattedCount : Globalize ( this . state . locale ) . formatNumber ( 1000 ) } } />
53
50
< br />
54
51
like count 0 with offset:1 - < FormatMessage locale = { this . state . locale } path = "likeIncludingMe" variables = { { count : 0 } } />
55
52
< br />
Original file line number Diff line number Diff line change @@ -6,25 +6,6 @@ function capitalizeFirstLetter(string) {
6
6
return string . charAt ( 0 ) . toUpperCase ( ) + string . slice ( 1 ) ;
7
7
}
8
8
9
- function isPlainObject ( value ) {
10
- return value && typeof value === "object" &&
11
- ! ( value . constructor &&
12
- ! value . constructor . prototype . hasOwnProperty ( "isPrototypeOf" ) ) &&
13
- ! React . isValidElement ( value ) ;
14
- }
15
-
16
- function supportReactElements ( value ) {
17
- if ( isPlainObject ( value ) ) {
18
- return Object . keys ( value ) . reduce ( function ( sum , i ) {
19
- sum [ i ] = supportReactElements ( value [ i ] ) ;
20
- return sum ;
21
- } , { } ) ;
22
- } else if ( React . isValidElement ( value ) ) {
23
- value = new ReactGlobalize [ value . type . displayName ] ( value . _store . props ) . render ( ) . _store . props . children ;
24
- }
25
- return value ;
26
- }
27
-
28
9
Object . getOwnPropertyNames ( Globalize ) . forEach ( function ( fn ) {
29
10
if ( fn . indexOf ( "format" ) === 0 ) {
30
11
var Fn = capitalizeFirstLetter ( fn ) ;
@@ -40,7 +21,7 @@ Object.getOwnPropertyNames(Globalize).forEach(function(fn) {
40
21
var instance = Globalize ;
41
22
var propArgs = argArray . map ( function ( element ) {
42
23
return componentProps [ element . replace ( / ( \s \/ \* | \* \/ ) / , "" ) . trim ( ) ] ;
43
- } ) . map ( supportReactElements ) ;
24
+ } ) ;
44
25
45
26
if ( componentProps [ "locale" ] ) {
46
27
instance = Globalize ( componentProps [ "locale" ] ) ;
You can’t perform that action at this time.
0 commit comments