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 var format = new DateFormat.yMd("ar"); |
kevmoo
2015/07/10 23:31:03
consider using
```dart
void noNeedToIndent() {}
`
Alan Knight
2015/07/11 00:07:34
Done.
| |
45 var dateString = format.format(new DateTime.now()); | 46 var dateString = format.format(new DateTime.now()); |
47 | |
48 or | |
49 | |
46 print(myMessage(dateString, locale: 'ar'); | 50 print(myMessage(dateString, locale: 'ar'); |
47 | 51 |
52 or | |
53 | |
54 Intl.defaultLocale = "es"' | |
55 new DateFormat.jm().format(new DateTime.now()); | |
56 | |
48 ## Initialization | 57 ## Initialization |
49 | 58 |
50 All the different types of locale data require an async initialization step | 59 All the different types of locale data require an async initialization step |
51 to make | 60 to make |
52 sure the data is available. This reduces the size of the application by only | 61 sure the data is available. This reduces the size of the application by only |
53 loading the | 62 loading the |
54 data that is actually required. | 63 data that is actually required. |
55 | 64 |
56 Each different area of internationalization (messages, dates, numbers) requires | 65 Each different area of internationalization (messages, dates, numbers) requires |
57 a separate initialization process. That way, if the application only needs to | 66 a separate initialization process. That way, if the application only needs to |
(...skipping 239 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 | 306 [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 | 307 [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 | 308 [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 | 309 [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 | 310 [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 | 311 [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 | 312 [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 | 313 [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 | 314 [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 | 315 [BidiFormatter.LTR]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vi ewer/intl/intl.BidiFormatter#id_BidiFormatter-LTR |
OLD | NEW |