forked from firka/student-legacy
i18n
This commit is contained in:
parent
0e617dc763
commit
7e142da5bc
@ -2,6 +2,7 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:i18n_extension/i18n_widget.dart';
|
||||
import 'package:html/parser.dart';
|
||||
import 'format.i18n.dart';
|
||||
|
||||
extension StringFormatUtils on String {
|
||||
String specialChars() => this
|
||||
@ -37,10 +38,10 @@ extension DateFormatUtils on DateTime {
|
||||
|
||||
DateTime now = DateTime.now();
|
||||
if (this.difference(now).inDays == 0) {
|
||||
if (this.hour == 0 && this.minute == 0 && this.second == 0) return "Today"; // TODO: i18n
|
||||
if (this.hour == 0 && this.minute == 0 && this.second == 0) return "Today".i18n;
|
||||
return DateFormat("HH:mm").format(this);
|
||||
}
|
||||
if (this.difference(now).inDays == 1) return "Yesterday"; // TODO: i18n
|
||||
if (this.difference(now).inDays == 1) return "Yesterday".i18n;
|
||||
|
||||
String formatString;
|
||||
if (this.year == now.year)
|
||||
|
24
filcnaplo/lib/utils/format.i18n.dart
Normal file
24
filcnaplo/lib/utils/format.i18n.dart
Normal file
@ -0,0 +1,24 @@
|
||||
import 'package:i18n_extension/i18n_extension.dart';
|
||||
|
||||
extension Localization on String {
|
||||
static final _t = Translations.byLocale("hu_hu") +
|
||||
{
|
||||
"en_en": {
|
||||
"Today": "Today",
|
||||
"Yesterday": "Yesterday",
|
||||
},
|
||||
"hu_hu": {
|
||||
"Today": "Ma",
|
||||
"Yesterday": "Tegnap",
|
||||
},
|
||||
"de_de": {
|
||||
"Today": "Heute",
|
||||
"Yesterday": "Gestern",
|
||||
}
|
||||
};
|
||||
|
||||
String get i18n => localize(this, _t);
|
||||
String fill(List<Object> params) => localizeFill(this, params);
|
||||
String plural(int value) => localizePlural(value, this, _t);
|
||||
String version(Object modifier) => localizeVersion(modifier, this, _t);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user