mirror of
https://github.com/johrpan/memor.git
synced 2025-10-28 19:27:25 +01:00
Add german translation
This commit is contained in:
parent
4be8aa8ff5
commit
3b33e6879a
8 changed files with 117 additions and 28 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'localizations.dart';
|
||||
|
||||
/// Utilities for handling DateTime objects.
|
||||
extension DateUtils on DateTime {
|
||||
/// Create a new instance with identical values.
|
||||
|
|
@ -21,18 +23,20 @@ extension DateUtils on DateTime {
|
|||
time.minute,
|
||||
);
|
||||
|
||||
/// Get a string representation of the represented day suitable for display.
|
||||
String get dateString {
|
||||
/// Get a localized string representation of the represented day suitable for
|
||||
/// display.
|
||||
String dateString(BuildContext context) {
|
||||
final l10n = MemorLocalizations.of(context);
|
||||
final now = DateTime.now();
|
||||
if (this.year == now.year && this.month == now.month) {
|
||||
if (this.day == now.day) {
|
||||
return 'Today';
|
||||
return l10n.today;
|
||||
} else if (this.day == now.day + 1) {
|
||||
return 'Tomorrow';
|
||||
return l10n.tomorrow;
|
||||
}
|
||||
}
|
||||
|
||||
final format = DateFormat.yMd();
|
||||
final format = DateFormat.yMd(l10n.languageCode);
|
||||
return format.format(this);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue