Refactoring l10n
This commit is contained in:
parent
5f7148cc3c
commit
6f1ed6120f
42 changed files with 287 additions and 287 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Provides extra functionality for formatting the time.
|
||||
|
|
@ -34,7 +34,7 @@ extension DateTimeExtension on DateTime {
|
|||
/// Returns a simple time String.
|
||||
/// TODO: Add localization
|
||||
String localizedTimeOfDay(BuildContext context) {
|
||||
return I18n.of(context).timeOfDay(_z(this.hour % 12), _z(this.hour),
|
||||
return L10n.of(context).timeOfDay(_z(this.hour % 12), _z(this.hour),
|
||||
_z(this.minute), this.hour > 11 ? 'pm' : 'am');
|
||||
}
|
||||
|
||||
|
|
@ -57,26 +57,26 @@ extension DateTimeExtension on DateTime {
|
|||
} else if (sameWeek) {
|
||||
switch (this.weekday) {
|
||||
case 1:
|
||||
return I18n.of(context).monday;
|
||||
return L10n.of(context).monday;
|
||||
case 2:
|
||||
return I18n.of(context).tuesday;
|
||||
return L10n.of(context).tuesday;
|
||||
case 3:
|
||||
return I18n.of(context).wednesday;
|
||||
return L10n.of(context).wednesday;
|
||||
case 4:
|
||||
return I18n.of(context).thursday;
|
||||
return L10n.of(context).thursday;
|
||||
case 5:
|
||||
return I18n.of(context).friday;
|
||||
return L10n.of(context).friday;
|
||||
case 6:
|
||||
return I18n.of(context).saturday;
|
||||
return L10n.of(context).saturday;
|
||||
case 7:
|
||||
return I18n.of(context).sunday;
|
||||
return L10n.of(context).sunday;
|
||||
}
|
||||
} else if (sameYear) {
|
||||
return I18n.of(context).dateWithoutYear(
|
||||
return L10n.of(context).dateWithoutYear(
|
||||
this.month.toString().padLeft(2, '0'),
|
||||
this.day.toString().padLeft(2, '0'));
|
||||
}
|
||||
return I18n.of(context).dateWithYear(
|
||||
return L10n.of(context).dateWithYear(
|
||||
this.year.toString(),
|
||||
this.month.toString().padLeft(2, '0'),
|
||||
this.day.toString().padLeft(2, '0'));
|
||||
|
|
@ -93,7 +93,7 @@ extension DateTimeExtension on DateTime {
|
|||
bool sameDay = sameYear && now.month == this.month && now.day == this.day;
|
||||
|
||||
if (sameDay) return localizedTimeOfDay(context);
|
||||
return I18n.of(context).dateAndTimeOfDay(
|
||||
return L10n.of(context).dateAndTimeOfDay(
|
||||
localizedTimeShort(context), localizedTimeOfDay(context));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import 'dart:io';
|
|||
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:fluffychat/components/matrix.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/views/chat.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
|
@ -31,7 +31,7 @@ abstract class FirebaseController {
|
|||
}
|
||||
if (token?.isEmpty ?? true) {
|
||||
showToast(
|
||||
I18n.of(context).noGoogleServicesWarning,
|
||||
L10n.of(context).noGoogleServicesWarning,
|
||||
duration: Duration(seconds: 15),
|
||||
);
|
||||
return;
|
||||
|
|
@ -106,7 +106,7 @@ abstract class FirebaseController {
|
|||
if (context != null && Matrix.of(context).activeRoomId == roomId) {
|
||||
return null;
|
||||
}
|
||||
final i18n = context == null ? I18n('en') : I18n.of(context);
|
||||
final i18n = context == null ? L10n('en') : L10n.of(context);
|
||||
|
||||
// Get the client
|
||||
Client client;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'date_time_extension.dart';
|
||||
|
||||
|
|
@ -8,6 +8,6 @@ extension PresenceExtension on Presence {
|
|||
if (statusMsg?.isNotEmpty ?? false) {
|
||||
return statusMsg;
|
||||
}
|
||||
return I18n.of(context).lastActiveAgo(time.localizedTimeShort(context));
|
||||
return L10n.of(context).lastActiveAgo(time.localizedTimeShort(context));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue