Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
5caeb3ff
Commit
5caeb3ff
authored
Feb 10, 2017
by
Devon Carew
Committed by
GitHub
Feb 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the intl package (#8060)
parent
f16dea29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
38 deletions
+11
-38
executable.dart
packages/flutter_tools/lib/executable.dart
+5
-1
logger.dart
packages/flutter_tools/lib/src/base/logger.dart
+5
-3
utils.dart
packages/flutter_tools/lib/src/base/utils.dart
+1
-21
utils_test.dart
packages/flutter_tools/test/utils_test.dart
+0
-13
No files found.
packages/flutter_tools/lib/executable.dart
View file @
5caeb3ff
...
...
@@ -7,6 +7,7 @@ import 'dart:async';
import
'package:args/command_runner.dart'
;
import
'package:process/process.dart'
;
import
'package:stack_trace/stack_trace.dart'
;
import
'package:intl/intl_standalone.dart'
as
intl
;
import
'src/base/common.dart'
;
import
'src/base/config.dart'
;
...
...
@@ -94,7 +95,7 @@ Future<Null> main(List<String> args) async {
AppContext
_executableContext
=
new
AppContext
();
// Make the context current.
await
_executableContext
.
runInZone
(()
{
await
_executableContext
.
runInZone
(()
async
{
// Initialize the context with some defaults.
// NOTE: Similar lists also exist in `bin/fuchsia_builder.dart` and
// `test/src/context.dart`. If you update this list of defaults, look
...
...
@@ -120,6 +121,9 @@ Future<Null> main(List<String> args) async {
context
.
putIfAbsent
(
SimControl
,
()
=>
new
SimControl
());
context
.
putIfAbsent
(
Usage
,
()
=>
new
Usage
());
// Initialize the system locale.
await
intl
.
findSystemLocale
();
return
Chain
.
capture
<
Future
<
Null
>>(()
async
{
await
runner
.
run
(
args
);
_exit
(
0
);
...
...
packages/flutter_tools/lib/src/base/logger.dart
View file @
5caeb3ff
...
...
@@ -5,11 +5,11 @@
import
'dart:async'
;
import
'dart:convert'
show
ASCII
,
LineSplitter
;
import
'package:intl/intl.dart'
;
import
'package:stack_trace/stack_trace.dart'
;
import
'io.dart'
;
import
'platform.dart'
;
import
'utils.dart'
;
final
AnsiTerminal
terminal
=
new
AnsiTerminal
();
...
...
@@ -274,6 +274,8 @@ class _AnsiStatus extends Status {
}
static
final
List
<
String
>
_progress
=
<
String
>[
'-'
,
r'\'
,
'|'
,
r'/'
,
'-'
,
r'\'
,
'|'
,
'/'
];
static
final
NumberFormat
secondsFormat
=
new
NumberFormat
(
'0.0'
);
static
final
NumberFormat
millisecondsFormat
=
new
NumberFormat
.
decimalPattern
();
final
String
message
;
final
bool
expectSlowOperation
;
...
...
@@ -298,9 +300,9 @@ class _AnsiStatus extends Status {
if
(
expectSlowOperation
)
{
double
seconds
=
stopwatch
.
elapsedMilliseconds
/
Duration
.
MILLISECONDS_PER_SECOND
;
print
(
'
\
b
\
b
\
b
\
b
\
b
${seconds
.toStringAsFixed(1
).padLeft(4)}
s'
);
print
(
'
\
b
\
b
\
b
\
b
\
b
${seconds
Format.format(seconds
).padLeft(4)}
s'
);
}
else
{
print
(
'
\
b
\
b
\
b
\
b
\
b
${
printWithSeparators(stopwatch.elapsedMilliseconds).toString(
).padLeft(3)}
ms'
);
print
(
'
\
b
\
b
\
b
\
b
\
b
${
millisecondsFormat.format(stopwatch.elapsedMilliseconds
).padLeft(3)}
ms'
);
}
timer
.
cancel
();
...
...
packages/flutter_tools/lib/src/base/utils.dart
View file @
5caeb3ff
...
...
@@ -54,19 +54,6 @@ String toTitleCase(String str) {
/// Return the plural of the given word (`cat(s)`).
String
pluralize
(
String
word
,
int
count
)
=>
count
==
1
?
word
:
word
+
's'
;
/// Return the value printed with commas every 3 digits.
String
printWithSeparators
(
int
value
)
{
String
str
=
'
$value
'
;
int
index
=
3
;
while
(
index
<
str
.
length
)
{
str
=
str
.
substring
(
0
,
str
.
length
-
index
)
+
','
+
str
.
substring
(
str
.
length
-
index
);
index
+=
4
;
}
return
str
;
}
/// Return the name of an enum item.
String
getEnumName
(
dynamic
enumItem
)
{
String
name
=
'
$enumItem
'
;
...
...
@@ -95,14 +82,7 @@ String getSizeAsMB(int bytesLength) {
return
'
${(bytesLength / (1024 * 1024)).toStringAsFixed(1)}
MB'
;
}
String
getElapsedAsSeconds
(
Duration
duration
)
{
double
seconds
=
duration
.
inMilliseconds
/
Duration
.
MILLISECONDS_PER_SECOND
;
return
'
${seconds.toStringAsFixed(2)}
seconds'
;
}
String
getElapsedAsMilliseconds
(
Duration
duration
)
{
return
'
${duration.inMilliseconds}
ms'
;
}
String
getElapsedAsMilliseconds
(
Duration
duration
)
=>
'
${duration.inMilliseconds}
ms'
;
/// Return a relative path if [fullPath] is contained by the cwd, else return an
/// absolute path.
...
...
packages/flutter_tools/test/utils_test.dart
View file @
5caeb3ff
...
...
@@ -6,19 +6,6 @@ import 'package:flutter_tools/src/base/utils.dart';
import
'package:test/test.dart'
;
void
main
(
)
{
group
(
'utils'
,
()
{
test
(
'printWithSeparators'
,
()
{
expect
(
printWithSeparators
(
3
),
'3'
);
expect
(
printWithSeparators
(
33
),
'33'
);
expect
(
printWithSeparators
(
333
),
'333'
);
expect
(
printWithSeparators
(
3333
),
'3,333'
);
expect
(
printWithSeparators
(
33333
),
'33,333'
);
expect
(
printWithSeparators
(
333333
),
'333,333'
);
expect
(
printWithSeparators
(
3333333
),
'3,333,333'
);
expect
(
printWithSeparators
(
33333333
),
'33,333,333'
);
});
});
group
(
'SettingsFile'
,
()
{
test
(
'parse'
,
()
{
SettingsFile
file
=
new
SettingsFile
.
parse
(
'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment