Refactoring l10n
This commit is contained in:
parent
5f7148cc3c
commit
6f1ed6120f
42 changed files with 287 additions and 287 deletions
|
|
@ -5,7 +5,7 @@ import 'package:flutter_slidable/flutter_slidable.dart';
|
|||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
||||
import 'package:pedantic/pedantic.dart';
|
||||
|
||||
import '../../i18n/i18n.dart';
|
||||
import '../../l10n/l10n.dart';
|
||||
import '../../utils/app_route.dart';
|
||||
import '../../utils/date_time_extension.dart';
|
||||
import '../../views/chat.dart';
|
||||
|
|
@ -31,7 +31,7 @@ class ChatListItem extends StatelessWidget {
|
|||
}
|
||||
|
||||
if (room.membership == Membership.ban) {
|
||||
showToast(I18n.of(context).youHaveBeenBannedFromThisChat);
|
||||
showToast(L10n.of(context).youHaveBeenBannedFromThisChat);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -39,16 +39,16 @@ class ChatListItem extends StatelessWidget {
|
|||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
title: Text(I18n.of(context).archivedRoom),
|
||||
content: Text(I18n.of(context).thisRoomHasBeenArchived),
|
||||
title: Text(L10n.of(context).archivedRoom),
|
||||
content: Text(L10n.of(context).thisRoomHasBeenArchived),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text(I18n.of(context).close.toUpperCase(),
|
||||
child: Text(L10n.of(context).close.toUpperCase(),
|
||||
style: TextStyle(color: Colors.blueGrey)),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(I18n.of(context).delete.toUpperCase(),
|
||||
child: Text(L10n.of(context).delete.toUpperCase(),
|
||||
style: TextStyle(color: Colors.red)),
|
||||
onPressed: () async {
|
||||
await archiveAction(context);
|
||||
|
|
@ -56,7 +56,7 @@ class ChatListItem extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(I18n.of(context).rejoin.toUpperCase(),
|
||||
child: Text(L10n.of(context).rejoin.toUpperCase(),
|
||||
style: TextStyle(color: Colors.blue)),
|
||||
onPressed: () async {
|
||||
await SimpleDialogs(context)
|
||||
|
|
@ -122,14 +122,14 @@ class ChatListItem extends StatelessWidget {
|
|||
secondaryActions: <Widget>[
|
||||
if ([Membership.join, Membership.invite].contains(room.membership))
|
||||
IconSlideAction(
|
||||
caption: I18n.of(context).leave,
|
||||
caption: L10n.of(context).leave,
|
||||
color: Colors.red,
|
||||
icon: Icons.archive,
|
||||
onTap: () => archiveAction(context),
|
||||
),
|
||||
if ([Membership.leave, Membership.ban].contains(room.membership))
|
||||
IconSlideAction(
|
||||
caption: I18n.of(context).delete,
|
||||
caption: L10n.of(context).delete,
|
||||
color: Colors.red,
|
||||
icon: Icons.delete_forever,
|
||||
onTap: () => archiveAction(context),
|
||||
|
|
@ -151,7 +151,7 @@ class ChatListItem extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
room.getLocalizedDisplayname(I18n.of(context)),
|
||||
room.getLocalizedDisplayname(L10n.of(context)),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
|
@ -181,13 +181,13 @@ class ChatListItem extends StatelessWidget {
|
|||
Expanded(
|
||||
child: room.membership == Membership.invite
|
||||
? Text(
|
||||
I18n.of(context).youAreInvitedToThisChat,
|
||||
L10n.of(context).youAreInvitedToThisChat,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
room.lastEvent.getLocalizedBody(I18n.of(context),
|
||||
room.lastEvent.getLocalizedBody(L10n.of(context),
|
||||
withSenderNamePrefix: true, hideReply: true),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import 'package:famedlysdk/famedlysdk.dart';
|
|||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:fluffychat/components/message_content.dart';
|
||||
import 'package:fluffychat/components/reply_content.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/utils/date_time_extension.dart';
|
||||
import 'package:fluffychat/utils/event_extension.dart';
|
||||
import 'package:fluffychat/utils/string_color.dart';
|
||||
|
|
@ -114,7 +114,7 @@ class Message extends StatelessWidget {
|
|||
RaisedButton(
|
||||
color: color.withAlpha(100),
|
||||
child: Text(
|
||||
I18n.of(context).requestPermission,
|
||||
L10n.of(context).requestPermission,
|
||||
style: TextStyle(color: textColor),
|
||||
),
|
||||
onPressed: () => SimpleDialogs(context)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/components/dialogs/simple_dialogs.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/material.dart';
|
||||
|
|
@ -65,19 +65,19 @@ class ParticipantListItem extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
Map<Membership, String> membershipBatch = {
|
||||
Membership.join: "",
|
||||
Membership.ban: I18n.of(context).banned,
|
||||
Membership.invite: I18n.of(context).invited,
|
||||
Membership.leave: I18n.of(context).leftTheChat,
|
||||
Membership.ban: L10n.of(context).banned,
|
||||
Membership.invite: L10n.of(context).invited,
|
||||
Membership.leave: L10n.of(context).leftTheChat,
|
||||
};
|
||||
final String permissionBatch = user.powerLevel == 100
|
||||
? I18n.of(context).admin
|
||||
: user.powerLevel >= 50 ? I18n.of(context).moderator : "";
|
||||
? L10n.of(context).admin
|
||||
: user.powerLevel >= 50 ? L10n.of(context).moderator : "";
|
||||
List<PopupMenuEntry<String>> items = <PopupMenuEntry<String>>[];
|
||||
|
||||
if (user.id != Matrix.of(context).client.userID) {
|
||||
items.add(
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).sendAMessage), value: "message"),
|
||||
child: Text(L10n.of(context).sendAMessage), value: "message"),
|
||||
);
|
||||
}
|
||||
if (user.canChangePowerLevel &&
|
||||
|
|
@ -85,7 +85,7 @@ class ParticipantListItem extends StatelessWidget {
|
|||
user.powerLevel != 100) {
|
||||
items.add(
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).makeAnAdmin), value: "admin"),
|
||||
child: Text(L10n.of(context).makeAnAdmin), value: "admin"),
|
||||
);
|
||||
}
|
||||
if (user.canChangePowerLevel &&
|
||||
|
|
@ -93,29 +93,29 @@ class ParticipantListItem extends StatelessWidget {
|
|||
user.powerLevel != 50) {
|
||||
items.add(
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).makeAModerator), value: "moderator"),
|
||||
child: Text(L10n.of(context).makeAModerator), value: "moderator"),
|
||||
);
|
||||
}
|
||||
if (user.canChangePowerLevel && user.powerLevel != 0) {
|
||||
items.add(
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).revokeAllPermissions), value: "user"),
|
||||
child: Text(L10n.of(context).revokeAllPermissions), value: "user"),
|
||||
);
|
||||
}
|
||||
if (user.canKick) {
|
||||
items.add(
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).kickFromChat), value: "kick"),
|
||||
child: Text(L10n.of(context).kickFromChat), value: "kick"),
|
||||
);
|
||||
}
|
||||
if (user.canBan && user.membership != Membership.ban) {
|
||||
items.add(
|
||||
PopupMenuItem(child: Text(I18n.of(context).banFromChat), value: "ban"),
|
||||
PopupMenuItem(child: Text(L10n.of(context).banFromChat), value: "ban"),
|
||||
);
|
||||
} else if (user.canBan && user.membership == Membership.ban) {
|
||||
items.add(
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).removeExile), value: "unban"),
|
||||
child: Text(L10n.of(context).removeExile), value: "unban"),
|
||||
);
|
||||
}
|
||||
return PopupMenuButton(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:famedlysdk/famedlysdk.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/material.dart';
|
||||
|
|
@ -62,7 +62,7 @@ class PresenceListItem extends StatelessWidget {
|
|||
actions: <Widget>[
|
||||
if (presence.sender != Matrix.of(context).client.userID)
|
||||
FlatButton(
|
||||
child: Text(I18n.of(context).sendAMessage),
|
||||
child: Text(L10n.of(context).sendAMessage),
|
||||
onPressed: () async {
|
||||
final String roomId = await User(
|
||||
presence.sender,
|
||||
|
|
@ -77,7 +77,7 @@ class PresenceListItem extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(I18n.of(context).close),
|
||||
child: Text(L10n.of(context).close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
|
|||
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../i18n/i18n.dart';
|
||||
import '../../l10n/l10n.dart';
|
||||
import '../../utils/app_route.dart';
|
||||
import '../../views/chat.dart';
|
||||
import '../avatar.dart';
|
||||
|
|
@ -41,7 +41,7 @@ class PublicRoomListItem extends StatelessWidget {
|
|||
subtitle: Text(
|
||||
hasTopic
|
||||
? publicRoomEntry.topic
|
||||
: I18n.of(context).countParticipants(
|
||||
: L10n.of(context).countParticipants(
|
||||
publicRoomEntry.numJoinedMembers?.toString() ?? "0"),
|
||||
maxLines: 1,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:bubble/bubble.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StateMessage extends StatelessWidget {
|
||||
|
|
@ -21,7 +21,7 @@ class StateMessage extends StatelessWidget {
|
|||
color: Theme.of(context).backgroundColor.withOpacity(0.66),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
event.getLocalizedBody(I18n.of(context)),
|
||||
event.getLocalizedBody(L10n.of(context)),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).textTheme.bodyText2.color,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue