Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: README.md

Issue 832073002: Make withLocale use a zone (Closed) Base URL: https://github.com/dart-lang/intl.git@master
Patch Set: Mention that defaultLocale is superceded by withLocale Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « CHANGELOG.md ('k') | lib/intl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 internationalization mechanisms. This library also defines the 11 internationalization mechanisms. This library also defines the
12 [DateFormat][DateFormat], [NumberFormat][NumberFormat], and 12 [DateFormat][DateFormat], [NumberFormat][NumberFormat], and
13 [BidiFormatter][BidiFormatter] classes. 13 [BidiFormatter][BidiFormatter] classes.
14 14
15 ## Current locale 15 ## Current locale
16 16
17 The package has a single current locale, called [defaultLocale][defaultLocale]. 17 The package has a single current locale, called [defaultLocale][defaultLocale].
18 Operations will use that locale unless told to do otherwise. 18 Operations will use that locale unless told to do otherwise.
19 19
20 To set the global locale, you can explicitly set it, e.g. 20 You can explicitly set the global locale
21 21
22 Intl.defaultLocale = 'pt_BR'; 22 Intl.defaultLocale = 'pt_BR';
23 23
24 or get it from the browser by 24 or get it from the browser
25 25
26 import "package:intl/intl_browser.dart"; 26 import "package:intl/intl_browser.dart";
27 ... 27 ...
28 findSystemLocale().then(runTheRestOfMyProgram); 28 findSystemLocale().then(runTheRestOfMyProgram);
29 29
30 To temporarily override the current locale, pass the operation 30 To override the current locale for a particular operation, pass the operation
31 to [withLocale][withLocale]. 31 to [withLocale][withLocale]. Note that this includes async tasks
32 spawned from that operation, and that the argument to
33 [withLocale][withLocale]
34 will supercede the [defaultLocale][defaultLocale] while the operation
35 is active. If you are using different locales within an application,
36 the [withLocale][withLocale] operation may be preferable to setting
37 [defaultLocale][defaultLocale].
32 38
33 Intl.withLocale('fr', () => print(myLocalizedMessage()); 39 Intl.withLocale('fr', () => print(myLocalizedMessage());
34 40
35 To override it for a very specific operation you can create a format object in 41 To specify the locale for an operation you can create a format object in
36 a specific locale, or pass in the locale as a parameter to methods. 42 a specific locale, or pass in the locale as a parameter to methods.
37 43
38 var format = new DateFormat.yMd("ar"); 44 var format = new DateFormat.yMd("ar");
39 var dateString = format.format(new DateTime.now()); 45 var dateString = format.format(new DateTime.now());
40 print(myMessage(dateString, locale: 'ar'); 46 print(myMessage(dateString, locale: 'ar');
41 47
42 ## Initialization 48 ## Initialization
43 49
44 All the different types of locale data require an async initialization step 50 All the different types of locale data require an async initialization step
45 to make 51 to make
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 [NumberFormat]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/ intl/intl.NumberFormat 297 [NumberFormat]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/ intl/intl.NumberFormat
292 [withLocale]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/in tl/intl.Intl#id_withLocale 298 [withLocale]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/in tl/intl.Intl#id_withLocale
293 [defaultLocale]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer /intl/intl.Intl#id_defaultLocale 299 [defaultLocale]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer /intl/intl.Intl#id_defaultLocale
294 [Intl.message]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/ intl/intl.Intl#id_message 300 [Intl.message]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/ intl/intl.Intl#id_message
295 [Intl.plural]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/i ntl/intl.Intl#id_plural 301 [Intl.plural]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/i ntl/intl.Intl#id_plural
296 [Intl.gender]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/i ntl/intl.Intl#id_gender 302 [Intl.gender]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/i ntl/intl.Intl#id_gender
297 [DateTime]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart :core.DateTime 303 [DateTime]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart :core.DateTime
298 [BidiFormatter]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer /intl/intl.BidiFormatter 304 [BidiFormatter]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer /intl/intl.BidiFormatter
299 [BidiFormatter.RTL]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vi ewer/intl/intl.BidiFormatter#id_BidiFormatter-RTL 305 [BidiFormatter.RTL]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vi ewer/intl/intl.BidiFormatter#id_BidiFormatter-RTL
300 [BidiFormatter.LTR]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vi ewer/intl/intl.BidiFormatter#id_BidiFormatter-LTR 306 [BidiFormatter.LTR]: https://api.dartlang.org/apidocs/channels/stable/dartdoc-vi ewer/intl/intl.BidiFormatter#id_BidiFormatter-LTR
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/intl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698