OLD | NEW |
1 Intl | 1 Intl |
2 ==== | 2 ==== |
3 | 3 |
4 This package provides internationalization and localization facilities, | 4 This package provides internationalization and localization facilities, |
5 including message translation, plurals and genders, date/number formatting | 5 including message translation, plurals and genders, date/number formatting |
6 and parsing, and bidirectional text. | 6 and parsing, and bidirectional text. |
7 | 7 |
8 ## General | 8 ## General |
9 The most important library is [intl][intl_lib]. It defines the [Intl][Intl] | 9 The most important library is [intl][intl_lib]. It defines the [Intl][Intl] |
10 class, with the default locale and methods for accessing most of the | 10 class, with the default locale and methods for accessing most of the |
(...skipping 21 matching lines...) Expand all Loading... |
32 spawned from that operation, and that the argument to | 32 spawned from that operation, and that the argument to |
33 [withLocale][withLocale] | 33 [withLocale][withLocale] |
34 will supercede the [defaultLocale][defaultLocale] while the operation | 34 will supercede the [defaultLocale][defaultLocale] while the operation |
35 is active. If you are using different locales within an application, | 35 is active. If you are using different locales within an application, |
36 the [withLocale][withLocale] operation may be preferable to setting | 36 the [withLocale][withLocale] operation may be preferable to setting |
37 [defaultLocale][defaultLocale]. | 37 [defaultLocale][defaultLocale]. |
38 | 38 |
39 Intl.withLocale('fr', () => print(myLocalizedMessage()); | 39 Intl.withLocale('fr', () => print(myLocalizedMessage()); |
40 | 40 |
41 To specify the locale for an operation you can create a format object in | 41 To specify the locale for an operation you can create a format object in |
42 a specific locale, or pass in the locale as a parameter to methods. | 42 a specific locale, pass in the locale as a parameter to methods, or |
| 43 set the default locale. |
43 | 44 |
44 var format = new DateFormat.yMd("ar"); | 45 ```dart |
45 var dateString = format.format(new DateTime.now()); | 46 var format = new DateFormat.yMd("ar"); |
46 print(myMessage(dateString, locale: 'ar'); | 47 var dateString = format.format(new DateTime.now()); |
| 48 ``` |
| 49 |
| 50 or |
| 51 |
| 52 ```dart |
| 53 print(myMessage(dateString, locale: 'ar'); |
| 54 ``` |
| 55 » |
| 56 or |
| 57 |
| 58 ```dart |
| 59 Intl.defaultLocale = "es"' |
| 60 new DateFormat.jm().format(new DateTime.now()); |
| 61 ``` |
47 | 62 |
48 ## Initialization | 63 ## Initialization |
49 | 64 |
50 All the different types of locale data require an async initialization step | 65 All the different types of locale data require an async initialization step |
51 to make | 66 to make |
52 sure the data is available. This reduces the size of the application by only | 67 sure the data is available. This reduces the size of the application by only |
53 loading the | 68 loading the |
54 data that is actually required. | 69 data that is actually required. |
55 | 70 |
56 Each different area of internationalization (messages, dates, numbers) requires | 71 Each different area of internationalization (messages, dates, numbers) requires |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 [NumberFormat]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/
intl/intl.NumberFormat | 312 [NumberFormat]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/
intl/intl.NumberFormat |
298 [withLocale]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/in
tl/intl.Intl#id_withLocale | 313 [withLocale]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/in
tl/intl.Intl#id_withLocale |
299 [defaultLocale]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer
/intl/intl.Intl#id_defaultLocale | 314 [defaultLocale]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer
/intl/intl.Intl#id_defaultLocale |
300 [Intl.message]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/
intl/intl.Intl#id_message | 315 [Intl.message]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/
intl/intl.Intl#id_message |
301 [Intl.plural]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/i
ntl/intl.Intl#id_plural | 316 [Intl.plural]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/i
ntl/intl.Intl#id_plural |
302 [Intl.gender]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/i
ntl/intl.Intl#id_gender | 317 [Intl.gender]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/i
ntl/intl.Intl#id_gender |
303 [DateTime]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart
:core.DateTime | 318 [DateTime]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart
:core.DateTime |
304 [BidiFormatter]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer
/intl/intl.BidiFormatter | 319 [BidiFormatter]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer
/intl/intl.BidiFormatter |
305 [BidiFormatter.RTL]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vi
ewer/intl/intl.BidiFormatter#id_BidiFormatter-RTL | 320 [BidiFormatter.RTL]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vi
ewer/intl/intl.BidiFormatter#id_BidiFormatter-RTL |
306 [BidiFormatter.LTR]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vi
ewer/intl/intl.BidiFormatter#id_BidiFormatter-LTR | 321 [BidiFormatter.LTR]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vi
ewer/intl/intl.BidiFormatter#id_BidiFormatter-LTR |
OLD | NEW |