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 11var FormatMessage = require ( '../react-globalize' ) . FormatMessage ;
2- var FormatNumber = require ( '../react-globalize' ) . FormatNumber ;
32var React = require ( 'react' ) ;
3+ var Globalize = require ( 'globalize' ) ;
44
55module . exports = React . createClass ( {
66 getInitialState : function ( ) {
@@ -46,10 +46,7 @@ module.exports = React.createClass({
4646 < br />
4747 task count 0 - < FormatMessage locale = { this . state . locale } path = "task" variables = { { count : 0 } } />
4848 < 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 ) } } />
5350 < br />
5451 like count 0 with offset:1 - < FormatMessage locale = { this . state . locale } path = "likeIncludingMe" variables = { { count : 0 } } />
5552 < br />
Original file line number Diff line number Diff line change @@ -6,25 +6,6 @@ function capitalizeFirstLetter(string) {
66 return string . charAt ( 0 ) . toUpperCase ( ) + string . slice ( 1 ) ;
77}
88
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-
289Object . getOwnPropertyNames ( Globalize ) . forEach ( function ( fn ) {
2910 if ( fn . indexOf ( "format" ) === 0 ) {
3011 var Fn = capitalizeFirstLetter ( fn ) ;
@@ -40,7 +21,7 @@ Object.getOwnPropertyNames(Globalize).forEach(function(fn) {
4021 var instance = Globalize ;
4122 var propArgs = argArray . map ( function ( element ) {
4223 return componentProps [ element . replace ( / ( \s \/ \* | \* \/ ) / , "" ) . trim ( ) ] ;
43- } ) . map ( supportReactElements ) ;
24+ } ) ;
4425
4526 if ( componentProps [ "locale" ] ) {
4627 instance = Globalize ( componentProps [ "locale" ] ) ;
You can’t perform that action at this time.
0 commit comments