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
be601c26
Unverified
Commit
be601c26
authored
Aug 23, 2018
by
Hans Muller
Committed by
GitHub
Aug 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct gen_date_localizations.dart supported locales computation (#20920)
parent
e235ccd7
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8253 additions
and
4898 deletions
+8253
-4898
gen_date_localizations.dart
dev/tools/gen_date_localizations.dart
+6
-6
date_localizations.dart
...lutter_localizations/lib/src/l10n/date_localizations.dart
+8229
-4892
translations_test.dart
packages/flutter_localizations/test/translations_test.dart
+18
-0
No files found.
dev/tools/gen_date_localizations.dart
View file @
be601c26
...
...
@@ -83,7 +83,7 @@ Future<Null> main(List<String> rawArgs) async {
// ignore_for_file: public_member_api_docs
'''
);
buffer
.
writeln
(
'const Map<String, dynamic> dateSymbols =
const
<String, dynamic> {'
);
buffer
.
writeln
(
'const Map<String, dynamic> dateSymbols = <String, dynamic> {'
);
symbolFiles
.
forEach
((
String
locale
,
File
data
)
{
if
(
materialLocales
.
contains
(
locale
))
buffer
.
writeln
(
_jsonToMapEntry
(
locale
,
json
.
decode
(
data
.
readAsStringSync
())));
...
...
@@ -92,11 +92,11 @@ Future<Null> main(List<String> rawArgs) async {
// Code that uses datePatterns expects it to contain values of type
// Map<String, String> not Map<String, dynamic>.
buffer
.
writeln
(
'const Map<String, Map<String, String>> datePatterns =
const
<String, Map<String, String>> {'
);
buffer
.
writeln
(
'const Map<String, Map<String, String>> datePatterns = <String, Map<String, String>> {'
);
patternFiles
.
forEach
((
String
locale
,
File
data
)
{
if
(
materialLocales
.
contains
(
locale
))
{
final
Map
<
String
,
dynamic
>
patterns
=
json
.
decode
(
data
.
readAsStringSync
());
buffer
.
writeln
(
"'
$locale
':
const
<String, String>{"
);
buffer
.
writeln
(
"'
$locale
': <String, String>{"
);
patterns
.
forEach
((
String
key
,
dynamic
value
)
{
assert
(
value
is
String
);
buffer
.
writeln
(
_jsonToMapEntry
(
key
,
value
));
...
...
@@ -134,10 +134,10 @@ String _jsonToMap(dynamic json) {
}
if
(
json
is
Iterable
)
return
'
const
<dynamic>[
${json.map(_jsonToMap).join(',')}
]'
;
return
'<dynamic>[
${json.map(_jsonToMap).join(',')}
]'
;
if
(
json
is
Map
<
String
,
dynamic
>)
{
final
StringBuffer
buffer
=
new
StringBuffer
(
'
const
<String, dynamic>{'
);
final
StringBuffer
buffer
=
new
StringBuffer
(
'<String, dynamic>{'
);
json
.
forEach
((
String
key
,
dynamic
value
)
{
buffer
.
writeln
(
_jsonToMapEntry
(
key
,
value
));
});
...
...
@@ -149,7 +149,7 @@ String _jsonToMap(dynamic json) {
}
Iterable
<
String
>
_materialLocales
()
sync
*
{
final
RegExp
filenameRE
=
new
RegExp
(
r'
.*
_(\w+)\.arb$'
);
final
RegExp
filenameRE
=
new
RegExp
(
r'
material
_(\w+)\.arb$'
);
final
Directory
materialLocalizationsDirectory
=
new
Directory
(
path
.
join
(
'packages'
,
'flutter_localizations'
,
'lib'
,
'src'
,
'l10n'
));
for
(
FileSystemEntity
entity
in
materialLocalizationsDirectory
.
listSync
())
{
final
String
filePath
=
entity
.
path
;
...
...
packages/flutter_localizations/lib/src/l10n/date_localizations.dart
View file @
be601c26
This diff is collapsed.
Click to expand it.
packages/flutter_localizations/test/translations_test.dart
View file @
be601c26
...
...
@@ -110,4 +110,22 @@ void main() {
expect
(
localizations
.
selectedRowCountTitle
(
10019
),
'10.019 articole selectate'
);
expect
(
localizations
.
selectedRowCountTitle
(
123456789
),
'123.456.789 de articole selectate'
);
});
testWidgets
(
'spot check formatMediumDate(), formatFullDate() translations'
,
(
WidgetTester
tester
)
async
{
MaterialLocalizations
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'en'
,
''
));
expect
(
localizations
.
formatMediumDate
(
new
DateTime
(
2015
,
7
,
23
)),
'Thu, Jul 23'
);
expect
(
localizations
.
formatFullDate
(
new
DateTime
(
2015
,
7
,
23
)),
'Thursday, July 23, 2015'
);
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'en'
,
'GB'
));
expect
(
localizations
.
formatMediumDate
(
new
DateTime
(
2015
,
7
,
23
)),
'Thu 23 Jul'
);
expect
(
localizations
.
formatFullDate
(
new
DateTime
(
2015
,
7
,
23
)),
'Thursday, 23 July 2015'
);
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'es'
,
''
));
expect
(
localizations
.
formatMediumDate
(
new
DateTime
(
2015
,
7
,
23
)),
'jue., 23 jul.'
);
expect
(
localizations
.
formatFullDate
(
new
DateTime
(
2015
,
7
,
23
)),
'jueves, 23 de julio de 2015'
);
localizations
=
await
GlobalMaterialLocalizations
.
delegate
.
load
(
const
Locale
(
'de'
,
''
));
expect
(
localizations
.
formatMediumDate
(
new
DateTime
(
2015
,
7
,
23
)),
'Do., 23. Juli'
);
expect
(
localizations
.
formatFullDate
(
new
DateTime
(
2015
,
7
,
23
)),
'Donnerstag, 23. Juli 2015'
);
});
}
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