18
18
19
19
// Then, to use any ReactGlobalize component (with JSX)
20
20
React.render(
21
- <FormatCurrency currency="USD" value= {150}/ >
21
+ <FormatCurrency currency="USD"> {150}</FormatCurrency >
22
22
);
23
23
// Which would render for example:
24
24
// <span>$150.00</span> when using the `en` (English) locale, or
@@ -40,12 +40,14 @@ It allows to format a currency. Your code can be completely independent of the l
40
40
41
41
[ currencyFormatter ] : https://github.com/jquery/globalize/blob/master/doc/api/currency/currency-formatter.md
42
42
43
+ #### Children
44
+
45
+ The numeric value to be formatted. Required.
46
+
43
47
#### Props
44
48
45
49
- ** currency** - required
46
50
- A 3-letter string currency code as defined by ISO 4217 (e.g., USD, EUR, CNY, etc).
47
- - ** value** - required
48
- - The numeric value to be formatted
49
51
- ** options**
50
52
- An optional set of options to further format the value. See the [ currencyFormatter] [ ] docs in Globalize for more info on specific options
51
53
- ** locale** - optional
@@ -55,13 +57,13 @@ It allows to format a currency. Your code can be completely independent of the l
55
57
56
58
- Default format with USD in English
57
59
58
- ` <FormatCurrency currency="USD" value= {150} / > `
60
+ ` <FormatCurrency currency="USD"> {150}</FormatCurrency > `
59
61
60
62
Result: ` <span>$150.00</span> ` when using the ` en ` (English) locale.
61
63
62
64
- Accounting format with EUR in Portuguese
63
65
64
- ` <FormatCurrency currency="EUR" value={-150} options={{ style: "accounting" }} / > `
66
+ ` <FormatCurrency currency="EUR" options={{ style: "accounting" }}>{-150}</FormatCurrency > `
65
67
66
68
Result: ` <span>(€150,00)</span> ` when using the ` pt ` (Portuguese) locale.
67
69
@@ -71,6 +73,10 @@ It allows to convert dates and times from their internal representations to text
71
73
72
74
[ dateFormatter ] : https://github.com/jquery/globalize/blob/master/doc/api/date/date-formatter.md
73
75
76
+ #### Children
77
+
78
+ The date object to be formatted. Required.
79
+
74
80
#### Props
75
81
76
82
- ** value** - required
@@ -84,13 +90,13 @@ It allows to convert dates and times from their internal representations to text
84
90
85
91
- Simple string skeleton
86
92
87
- ` <FormatDate value={new Date()} options={{skeleton: "GyMMMd"}} / > `
93
+ ` <FormatDate options={{skeleton: "GyMMMd"}}>{new Date()}</FormatDate > `
88
94
89
95
Result: ` <span>Feb 27, 2015 AD</span> ` when using the ` en ` (English) locale.
90
96
91
97
- Medium length date and time
92
98
93
- ` <FormatDate value={new Date()} options={{ datetime: "medium" }} / > `
99
+ ` <FormatDate options={{ datetime: "medium" }}>{new Date()}</FormatDate > `
94
100
95
101
Result: ` <span>27 de fev de 2015 11:17:10</span> ` when using the ` pt ` (Portuguese) locale.
96
102
@@ -101,6 +107,10 @@ It allows for the creation of internationalized messages (as defined by the [ICU
101
107
[ messageFormatter ] : https://github.com/jquery/globalize/blob/master/doc/api/message/message-formatter.md
102
108
[ ICU Message syntax ] : http://userguide.icu-project.org/formatparse/messages
103
109
110
+ #### Children
111
+
112
+ String or array path to traverse a set of messages store in JSON format. Required.
113
+
104
114
#### Props
105
115
106
116
- ** path** - required
@@ -139,7 +149,7 @@ Below message JSON used in these examples:
139
149
```
140
150
- Simple salutation
141
151
142
- Hi: ` <FormatMessage path= "salutations/hi" / > `
152
+ Hi: ` <FormatMessage>{ "salutations/hi"}</FormatMessage > `
143
153
144
154
Result:
145
155
@@ -149,11 +159,11 @@ Result:
149
159
150
160
- Variable Replacement
151
161
152
- Array: ` <FormatMessage path=" variables/hello" variables ={["Wolfgang", "Amadeus", "Mozart"]} / > `
162
+ Array: ` <FormatMessage variables={["Wolfgang", "Amadeus", "Mozart"]}>{"variables/hello"}</FormatMessage > `
153
163
154
164
Result: ` <span>Hello, Wolfgang Amadeus Mozart</span> ` when using the ` en ` (English) locale.
155
165
156
- Object in Portuguese: ` <FormatMessage path=" variables/hey" variables ={{first:"Wolfgang", middle:"Amadeus", last:"Mozart"}} / > `
166
+ Object in Portuguese: ` <FormatMessage variables={{first:"Wolfgang", middle:"Amadeus", last:"Mozart"}}>{"variables/hey"}</FormatMessage > `
157
167
158
168
Result: ` <span>Ei, Wolfgang Amadeus Mozart</span> ` when using the ` pt ` (Portuguese) locale.
159
169
@@ -163,6 +173,10 @@ It allows to convert numbers into textual representations. Your code can be comp
163
173
164
174
[ numberFormatter ] : https://github.com/jquery/globalize/blob/master/doc/api/number/number-formatter.md
165
175
176
+ #### Children
177
+
178
+ The number to be formatted. Required.
179
+
166
180
#### Props
167
181
168
182
- ** value** - required
@@ -176,13 +190,13 @@ It allows to convert numbers into textual representations. Your code can be comp
176
190
177
191
- Default format pi in English
178
192
179
- ` <FormatNumber locale="en" value= {Math.PI} / > `
193
+ ` <FormatNumber locale="en"> {Math.PI}</FormatNumber > `
180
194
181
195
Result: ` <span>3.142</span> ` when using the ` en ` (English) locale.
182
196
183
197
- Show at least 2 decimal places in Portuguese
184
198
185
- ` <FormatNumber value={10000} options={{ minimumFractionDigits: 2 }} / > `
199
+ ` <FormatNumber options={{ minimumFractionDigits: 2 }}>{10000}</FormatNumber > `
186
200
187
201
Result: ` <span>10.000,00</span> ` when using the ` pt ` (Portuguese) locale.
188
202
0 commit comments