@@ -34,246 +34,41 @@ not loaded:
34
34
* :phpfunction: `intl_get_error_code `
35
35
* :phpfunction: `intl_get_error_message `
36
36
37
- If you don't use Composer but the Symfony ClassLoader component, you need to
38
- load them manually by adding the following lines to your autoload code::
37
+ When the intl extension is not available, the following classes are used to
38
+ replace the intl classes:
39
+
40
+ * :class: `Symfony\\ Component\\ Intl\\ Collator\\ Collator `
41
+ * :class: `Symfony\\ Component\\ Intl\\ DateFormatter\\ IntlDateFormatter `
42
+ * :class: `Symfony\\ Component\\ Intl\\ Locale\\ Locale `
43
+ * :class: `Symfony\\ Component\\ Intl\\ NumberFormatter\\ NumberFormatter `
44
+ * :class: `Symfony\\ Component\\ Intl\\ Globals\\ IntlGlobals `
45
+
46
+ Composer automatically exposes these classes in the global namespace.
47
+
48
+ If you don't use Composer but the
49
+ :doc: `Symfony ClassLoader component</components/class_loader> `, you need to
50
+ expose them manually by adding the following lines to your autoload code::
39
51
40
52
if (!function_exists('intl_is_failure')) {
41
53
require '/path/to/Icu/Resources/stubs/functions.php';
42
54
43
55
$loader->registerPrefixFallback('/path/to/Icu/Resources/stubs');
44
56
}
45
57
46
- The component provides replacements for the following functions and classes:
47
-
48
58
.. note ::
49
59
50
60
The stub implementation only supports the locale ``en ``.
51
61
52
- Stubbed Classes
53
- ---------------
54
-
55
- The stubbed classes of the intl extension are limited to the locale "en" and
56
- will throw an exception if you try to use a different locale. For using other
57
- locales, `install the intl extension `_ instead.
58
-
59
- Locale
60
- ~~~~~~
61
-
62
- The only method supported in the :phpclass: `Locale ` class is
63
- :phpmethod: `Locale::getDefault `. This method will always return "en". All other
64
- methods will throw an exception when used.
65
-
66
- NumberFormatter
67
- ~~~~~~~~~~~~~~~
68
-
69
- Numbers can be formatted with the :phpclass: `NumberFormatter ` class.
70
- The following methods are supported. All other methods are not supported and
71
- will throw an exception when used.
72
-
73
- .. _`NumberFormatter::__construct()` :
74
-
75
- \_ _construct($locale = $style = null, $pattern = null)
76
- ......................................................
77
-
78
- The only supported locale is "en". The supported styles are
79
- ``NumberFormatter::DECIMAL `` and ``NumberFormatter::CURRENCY ``. The argument
80
- ``$pattern `` may not be used.
81
-
82
- ::create($locale = $style = null, $pattern = null)
83
- ..................................................
84
-
85
- See `NumberFormatter::__construct() `_.
86
-
87
- formatCurrency($value, $currency)
88
- .................................
89
-
90
- Fully supported.
91
-
92
- format($value, $type = NumberFormatter::TYPE_DEFAULT)
93
- .....................................................
94
-
95
- Only type ``NumberFormatter::TYPE_DEFAULT `` is supported.
96
-
97
- getAttribute($attr)
98
- ...................
99
-
100
- Fully supported.
101
-
102
- getErrorCode()
103
- ..............
104
-
105
- Fully supported.
106
-
107
- getErrorMessage()
108
- .................
109
-
110
- Fully supported.
111
-
112
- getLocale($type = Locale::ACTUAL_LOCALE)
113
- ........................................
114
-
115
- The parameter ``$type `` is ignored.
116
-
117
- parse($value, $type = NumberFormatter::TYPE_DOUBLE, &$position = null)
118
- ......................................................................
119
-
120
- The supported types are ``NumberFormatter::TYPE_DOUBLE ``,
121
- ``NumberFormatter::TYPE_INT32 `` and ``NumberFormatter::TYPE_INT64 ``. The
122
- parameter ``$position `` must always be ``null ``.
123
-
124
- setAttribute($attr, $value)
125
- ...........................
126
-
127
- The only supported attributes are ``NumberFormatter::FRACTION_DIGITS ``,
128
- ``NumberFormatter::GROUPING_USED `` and ``NumberFormatter::ROUNDING_MODE ``.
129
-
130
- The only supported rounding modes are ``NumberFormatter::ROUND_HALFEVEN ``,
131
- ``NumberFormatter::ROUND_HALFDOWN `` and ``NumberFormatter::ROUND_HALFUP ``.
132
-
133
- IntlDateFormatter
134
- ~~~~~~~~~~~~~~~~~
135
-
136
- Dates can be formatted with the :phpclass: `IntlDateFormatter ` class. The
137
- following methods are supported. All other methods are not supported and will
138
- throw an exception when used.
139
-
140
- .. _`IntlDateFormatter::__construct()` :
141
-
142
- \_ _construct($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null)
143
- ........................................................................................................................
144
-
145
- The only supported locale is "en". The parameter ``$calendar `` can only be
146
- ``IntlDateFormatter::GREGORIAN ``.
147
-
148
- ::create($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null)
149
- ....................................................................................................................
150
-
151
- See `IntlDateFormatter::__construct() `_.
152
-
153
- format($timestamp)
154
- ..................
155
-
156
- Fully supported.
157
-
158
- getCalendar()
159
- .............
160
-
161
- Fully supported.
162
-
163
- getDateType()
164
- .............
165
-
166
- Fully supported.
167
-
168
- getErrorCode()
169
- ..............
170
-
171
- Fully supported.
172
-
173
- getErrorMessage()
174
- .................
175
-
176
- Fully supported.
177
-
178
- getLocale($type = Locale::ACTUAL_LOCALE)
179
- ........................................
180
-
181
- The parameter ``$type `` is ignored.
182
-
183
- getPattern()
184
- ............
185
-
186
- Fully supported.
187
-
188
- getTimeType()
189
- .............
190
-
191
- Fully supported.
192
-
193
- getTimeZoneId()
194
- ...............
195
-
196
- Fully supported.
197
-
198
- isLenient()
199
- ...........
200
-
201
- Always returns ``false ``.
202
-
203
- parse($value, &$position = null)
204
- ................................
205
-
206
- The parameter ``$position `` must always be ``null ``.
207
-
208
- setLenient($lenient)
209
- ....................
210
-
211
- Only accepts ``false ``.
212
-
213
- setPattern($pattern)
214
- ....................
215
-
216
- Fully supported.
217
-
218
- setTimeZoneId($timeZoneId)
219
- ..........................
220
-
221
- Fully supported.
222
-
223
- setTimeZone($timeZone)
224
- ......................
225
-
226
- Fully supported.
227
-
228
- Collator
229
- ~~~~~~~~
230
-
231
- Localized strings can be sorted with the :phpclass: `\C ollator ` class. The
232
- following methods are supported. All other methods are not supported and will
233
- throw an exception when used.
234
-
235
- .. _`Collator::__construct()` :
236
-
237
- \_ _construct($locale)
238
- .....................
239
-
240
- The only supported locale is "en".
241
-
242
- create($locale)
243
- ...............
244
-
245
- See `Collator::__construct() `_.
246
-
247
- asort(&$array, $sortFlag = Collator::SORT_REGULAR)
248
- ..................................................
249
-
250
- Fully supported.
251
-
252
- getErrorCode()
253
- ..............
254
-
255
- Fully supported.
256
-
257
- getErrorMessage()
258
- .................
259
-
260
- Fully supported.
261
-
262
- getLocale($type = Locale::ACTUAL_LOCALE)
263
- ........................................
264
-
265
- The parameter ``$type `` is ignored.
266
-
267
- ResourceBundle
268
- ~~~~~~~~~~~~~~
62
+ Writing and Reading Resource Bundles
63
+ ------------------------------------
269
64
270
65
The :phpclass: `ResourceBundle ` class is not and will not be supported. Instead,
271
66
this component ships a set of readers and writers for reading and writing arrays
272
67
(or array-like objects) from/to resource bundle files. The following classes
273
68
are supported:
274
69
275
70
TextBundleWriter
276
- ................
71
+ ~~~~~~~~~~~~~~~~
277
72
278
73
Writes an array or an array-like object to a plain text resource bundle. The
279
74
resulting .txt file can be converted to a binary .res file with the
@@ -397,7 +192,7 @@ locale will be merged. In order to suppress this behavior, the last parameter
397
192
398
193
echo $reader->readEntry('/path/to/bundle', 'en', array('Data', 'entry1'), false);
399
194
400
- Included Resource Bundles
195
+ Provided Resource Bundles
401
196
-------------------------
402
197
403
198
The ICU data is located in several "resource bundles". You can access a PHP
0 commit comments