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
02e9afef
Unverified
Commit
02e9afef
authored
Aug 02, 2018
by
Michael Goderbauer
Committed by
GitHub
Aug 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Der Datumsauswahldialog spricht jetzt deutsch (#20115)
parent
47d7a720
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
8 deletions
+48
-8
material_localizations.dart
...flutter_localizations/lib/src/material_localizations.dart
+6
-8
date_time_test.dart
packages/flutter_localizations/test/date_time_test.dart
+42
-0
No files found.
packages/flutter_localizations/lib/src/material_localizations.dart
View file @
02e9afef
...
...
@@ -104,23 +104,21 @@ class GlobalMaterialLocalizations implements MaterialLocalizations {
_translationBundle
=
translationBundleForLocale
(
locale
);
assert
(
_translationBundle
!=
null
);
const
String
kMediumDatePattern
=
'E, MMM
\
u00a0d'
;
if
(
intl
.
DateFormat
.
localeExists
(
_localeName
))
{
_fullYearFormat
=
new
intl
.
DateFormat
.
y
(
_localeName
);
_mediumDateFormat
=
new
intl
.
DateFormat
(
kMediumDatePattern
,
_localeName
);
_mediumDateFormat
=
new
intl
.
DateFormat
.
MMMEd
(
_localeName
);
_longDateFormat
=
new
intl
.
DateFormat
.
yMMMMEEEEd
(
_localeName
);
_yearMonthFormat
=
new
intl
.
DateFormat
(
'yMMMM'
,
_localeName
);
_yearMonthFormat
=
new
intl
.
DateFormat
.
yMMMM
(
_localeName
);
}
else
if
(
intl
.
DateFormat
.
localeExists
(
locale
.
languageCode
))
{
_fullYearFormat
=
new
intl
.
DateFormat
.
y
(
locale
.
languageCode
);
_mediumDateFormat
=
new
intl
.
DateFormat
(
kMediumDatePattern
,
locale
.
languageCode
);
_mediumDateFormat
=
new
intl
.
DateFormat
.
MMMEd
(
locale
.
languageCode
);
_longDateFormat
=
new
intl
.
DateFormat
.
yMMMMEEEEd
(
locale
.
languageCode
);
_yearMonthFormat
=
new
intl
.
DateFormat
(
'yMMMM'
,
locale
.
languageCode
);
_yearMonthFormat
=
new
intl
.
DateFormat
.
yMMMM
(
locale
.
languageCode
);
}
else
{
_fullYearFormat
=
new
intl
.
DateFormat
.
y
();
_mediumDateFormat
=
new
intl
.
DateFormat
(
kMediumDatePattern
);
_mediumDateFormat
=
new
intl
.
DateFormat
.
MMMEd
(
);
_longDateFormat
=
new
intl
.
DateFormat
.
yMMMMEEEEd
();
_yearMonthFormat
=
new
intl
.
DateFormat
(
'yMMMM'
);
_yearMonthFormat
=
new
intl
.
DateFormat
.
yMMMM
(
);
}
if
(
intl
.
NumberFormat
.
localeExists
(
_localeName
))
{
...
...
packages/flutter_localizations/test/date_time_test.dart
View file @
02e9afef
...
...
@@ -114,5 +114,47 @@ void main() {
expect
(
await
formatTimeOfDay
(
tester
,
const
Locale
(
'zh'
,
''
),
const
TimeOfDay
(
hour:
9
,
minute:
32
)),
'上午 9:32'
);
});
});
group
(
'date formatters'
,
()
{
Future
<
Map
<
DateType
,
String
>>
formatDate
(
WidgetTester
tester
,
Locale
locale
,
DateTime
dateTime
)
async
{
final
Completer
<
Map
<
DateType
,
String
>>
completer
=
new
Completer
<
Map
<
DateType
,
String
>>();
await
tester
.
pumpWidget
(
new
MaterialApp
(
supportedLocales:
<
Locale
>[
locale
],
locale:
locale
,
localizationsDelegates:
const
<
LocalizationsDelegate
<
dynamic
>>[
GlobalMaterialLocalizations
.
delegate
,
],
home:
new
Builder
(
builder:
(
BuildContext
context
)
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
completer
.
complete
(<
DateType
,
String
>{
DateType
.
year
:
localizations
.
formatYear
(
dateTime
),
DateType
.
medium
:
localizations
.
formatMediumDate
(
dateTime
),
DateType
.
full
:
localizations
.
formatFullDate
(
dateTime
),
DateType
.
monthYear
:
localizations
.
formatMonthYear
(
dateTime
),
});
return
new
Container
();
}),
));
return
completer
.
future
;
}
testWidgets
(
'formats dates in English'
,
(
WidgetTester
tester
)
async
{
final
Map
<
DateType
,
String
>
formatted
=
await
formatDate
(
tester
,
const
Locale
(
'en'
,
''
),
new
DateTime
(
2018
,
8
,
1
));
expect
(
formatted
[
DateType
.
year
],
'2018'
);
expect
(
formatted
[
DateType
.
medium
],
'Wed, Aug 1'
);
expect
(
formatted
[
DateType
.
full
],
'Wednesday, August 1, 2018'
);
expect
(
formatted
[
DateType
.
monthYear
],
'August 2018'
);
});
testWidgets
(
'formats dates in German'
,
(
WidgetTester
tester
)
async
{
final
Map
<
DateType
,
String
>
formatted
=
await
formatDate
(
tester
,
const
Locale
(
'de'
,
''
),
new
DateTime
(
2018
,
8
,
1
));
expect
(
formatted
[
DateType
.
year
],
'2018'
);
expect
(
formatted
[
DateType
.
medium
],
'Mi., 1. Aug.'
);
expect
(
formatted
[
DateType
.
full
],
'Mittwoch, 1. August 2018'
);
expect
(
formatted
[
DateType
.
monthYear
],
'August 2018'
);
});
});
});
}
enum
DateType
{
year
,
medium
,
full
,
monthYear
}
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