Skip to content

Commit e7efc31

Browse files
Dart Teamalan-knight
Dart Team
authored andcommitted
Clean up README.md, PR #189
PiperOrigin-RevId: 264724476
1 parent 1e8c64a commit e7efc31

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

pkgs/intl/README.md

+32-32
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You can explicitly set the global locale
2323

2424
or get it from the browser
2525

26-
import "package:intl/intl_browser.dart";
26+
import 'package:intl/intl_browser.dart';
2727
...
2828
findSystemLocale().then(runTheRestOfMyProgram);
2929

@@ -43,8 +43,8 @@ a specific locale, pass in the locale as a parameter to methods, or
4343
set the default locale.
4444

4545
```dart
46-
var format = new DateFormat.yMd("ar");
47-
var dateString = format.format(new DateTime.now());
46+
var format = DateFormat.yMd('ar');
47+
var dateString = format.format(DateTime.now());
4848
```
4949

5050
or
@@ -56,8 +56,8 @@ print(myMessage(dateString, locale: 'ar');
5656
or
5757

5858
```dart
59-
Intl.defaultLocale = "es";
60-
new DateFormat.jm().format(new DateTime.now());
59+
Intl.defaultLocale = 'es';
60+
DateFormat.jm().format(DateTime.now());
6161
```
6262

6363
## Initialization
@@ -85,11 +85,11 @@ Messages to be localized are written as functions that return the result of
8585
an [Intl.message][Intl.message] call.
8686

8787
String continueMessage() => Intl.message(
88-
"Hit any key to continue",
89-
name: "continueMessage",
88+
'Hit any key to continue',
89+
name: 'continueMessage',
9090
args: [],
91-
desc: "Explains that we will not proceed further until "
92-
"the user presses a key");
91+
desc: 'Explains that we will not proceed further until '
92+
'the user presses a key');
9393
print(continueMessage());
9494

9595
This provides, in addition to the basic message string, a name, a description
@@ -118,11 +118,11 @@ the formatting outside the function and pass the formatted string into
118118
the message.
119119

120120
greetingMessage(name) => Intl.message(
121-
"Hello $name!",
122-
name: "greetingMessage",
121+
'Hello $name!',
122+
name: 'greetingMessage',
123123
args: [name],
124-
desc: "Greet the user as they first open the application",
125-
examples: const {'name': "Emily"});
124+
desc: 'Greet the user as they first open the application',
125+
examples: const {'name': 'Emily'});
126126
print(greetingMessage('Dan'));
127127

128128
There is one special class of complex expressions allowed in the
@@ -134,12 +134,12 @@ message string, for plurals and genders.
134134
zero: 'There are no emails left for $userName.',
135135
one: 'There is $howMany email left for $userName.',
136136
other: 'There are $howMany emails left for $userName.')}''',
137-
name: "remainingEmailsMessage",
137+
name: 'remainingEmailsMessage',
138138
args: [howMany, userName],
139-
desc: "How many emails remain after archiving.",
139+
desc: How many emails remain after archiving.',
140140
examples: const {'howMany': 42, 'userName': 'Fred'});
141141

142-
print(remainingEmailsMessage(1, "Fred"));
142+
print(remainingEmailsMessage(1, 'Fred'));
143143

144144
However, since the typical usage for a plural or gender is for it to
145145
be at the top-level, we can also omit the [Intl.message][Intl.message] call and
@@ -151,9 +151,9 @@ provide its parameters to the [Intl.plural][Intl.plural] call instead.
151151
zero: 'There are no emails left for $userName.',
152152
one: 'There is $howMany email left for $userName.',
153153
other: 'There are $howMany emails left for $userName.',
154-
name: "remainingEmailsMessage",
154+
name: 'remainingEmailsMessage',
155155
args: [howMany, userName],
156-
desc: "How many emails remain after archiving.",
156+
desc: 'How many emails remain after archiving.',
157157
examples: const {'howMany': 42, 'userName': 'Fred'});
158158

159159
Similarly, there is an [Intl.gender][Intl.gender] message, and plurals
@@ -165,9 +165,9 @@ and genders can be nested.
165165
male: '$userName is unavailable because he is not online.',
166166
female: '$userName is unavailable because she is not online.',
167167
other: '$userName is unavailable because they are not online',
168-
name: "notOnlineMessage",
168+
name: 'notOnlineMessage',
169169
args: [userName, userGender],
170-
desc: "The user is not available to hangout.",
170+
desc: 'The user is not available to hangout.',
171171
examples: const {{'userGender': 'male', 'userName': 'Fred'},
172172
{'userGender': 'female', 'userName' : 'Alice'}});
173173

@@ -209,9 +209,9 @@ for a specific locale. Once that's done, any
209209
will automatically print the translated version instead of the
210210
original.
211211

212-
import "my_prefix_messages_all.dart";
212+
import 'my_prefix_messages_all.dart';
213213
...
214-
initializeMessages("dk").then(printSomeMessages);
214+
initializeMessages('dk').then(printSomeMessages);
215215

216216
Once the future returned from the initialization call returns, the
217217
message data is available.
@@ -220,7 +220,7 @@ message data is available.
220220

221221
To format a number, create a NumberFormat instance.
222222

223-
var f = new NumberFormat("###.0#", "en_US");
223+
var f = NumberFormat('###.0#', 'en_US');
224224
print(f.format(12.345));
225225
==> 12.34
226226

@@ -246,22 +246,22 @@ instance. These can be created using a set of commonly used skeletons
246246
taken from ICU/CLDR or using an explicit pattern. For details on the
247247
supported skeletons and patterns see [DateFormat][DateFormat].
248248

249-
new DateFormat.yMMMMEEEEd().format(aDateTime);
249+
DateFormat.yMMMMEEEEd().format(aDateTime);
250250
==> 'Wednesday, January 10, 2012'
251-
new DateFormat("EEEEE", "en_US").format(aDateTime);
251+
DateFormat('EEEEE', 'en_US').format(aDateTime);
252252
==> 'Wednesday'
253-
new DateFormat("EEEEE", "ln").format(aDateTime);
253+
DateFormat('EEEEE', 'ln').format(aDateTime);
254254
==> 'mokɔlɔ mwa mísáto'
255255

256256
You can also parse dates using the same skeletons or patterns.
257257

258-
new DateFormat.yMd("en_US").parse("1/10/2012");
259-
new DateFormat("Hms", "en_US").parse('14:23:01');
258+
DateFormat.yMd('en_US').parse('1/10/2012');
259+
DateFormat('Hms', 'en_US').parse('14:23:01');
260260

261261
Skeletons can be combined, the main use being to print a full date and
262262
time, e.g.
263263

264-
new DateFormat.yMEd().add_jms().format(new DateTime.now());
264+
DateFormat.yMEd().add_jms().format(DateTime.now());
265265
==> 'Thu, 5/23/2013 10:21:47 AM'
266266

267267
Known limitations: Time zones are not yet supported. Dart
@@ -273,7 +273,7 @@ locale, you must load the appropriate data by calling.
273273

274274
import 'package:intl/date_symbol_data_local.dart';
275275
...
276-
initializeDateFormatting("de_DE", null).then(formatDates);
276+
initializeDateFormatting('de_DE', null).then(formatDates);
277277

278278
Once the future returned from the initialization call returns, the
279279
formatting data is available.
@@ -293,8 +293,8 @@ direction. The direction can be specified with the
293293
[RTL][BidiFormatter.RTL] and [LTR][BidiFormatter.LTR] constructors, or
294294
detected from the text.
295295

296-
new BidiFormatter.RTL().wrapWithUnicode('xyz');
297-
new BidiFormatter.RTL().wrapWithSpan('xyz');
296+
BidiFormatter.RTL().wrapWithUnicode('xyz');
297+
BidiFormatter.RTL().wrapWithSpan('xyz');
298298

299299
[intl_lib]: https://www.dartdocs.org/documentation/intl/latest/intl/intl-library.html
300300
[Intl]: https://www.dartdocs.org/documentation/intl/latest

0 commit comments

Comments
 (0)