Add localizations
This commit is contained in:
parent
1f230c0a63
commit
a776ac1513
28 changed files with 3406 additions and 249 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/utils/event_extension.dart';
|
||||
import 'package:fluffychat/utils/date_time_extension.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
|
|
@ -27,7 +28,8 @@ class ChatListItem extends StatelessWidget {
|
|||
}
|
||||
|
||||
if (room.membership == Membership.ban) {
|
||||
Toast.show("You have been banned from this chat", context, duration: 5);
|
||||
Toast.show(I18n.of(context).youHaveBeenBannedFromThisChat, context,
|
||||
duration: 5);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -35,16 +37,16 @@ class ChatListItem extends StatelessWidget {
|
|||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
title: Text("Archived Room"),
|
||||
content: Text("This room has been archived."),
|
||||
title: Text(I18n.of(context).archivedRoom),
|
||||
content: Text(I18n.of(context).thisRoomHasBeenArchived),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Close".toUpperCase(),
|
||||
child: Text(I18n.of(context).close.toUpperCase(),
|
||||
style: TextStyle(color: Colors.blueGrey)),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("Forget".toUpperCase(),
|
||||
child: Text(I18n.of(context).delete.toUpperCase(),
|
||||
style: TextStyle(color: Colors.red)),
|
||||
onPressed: () async {
|
||||
await Matrix.of(context)
|
||||
|
|
@ -54,7 +56,7 @@ class ChatListItem extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("Rejoin".toUpperCase(),
|
||||
child: Text(I18n.of(context).rejoin.toUpperCase(),
|
||||
style: TextStyle(color: Colors.blue)),
|
||||
onPressed: () async {
|
||||
await Matrix.of(context)
|
||||
|
|
@ -112,7 +114,7 @@ class ChatListItem extends StatelessWidget {
|
|||
Expanded(
|
||||
child: room.membership == Membership.invite
|
||||
? Text(
|
||||
"You are invited to this chat",
|
||||
I18n.of(context).youAreInvitedToThisChat,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'package:bubble/bubble.dart';
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/components/dialogs/redact_message_dialog.dart';
|
||||
import 'package:fluffychat/components/message_content.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/utils/date_time_extension.dart';
|
||||
import 'package:fluffychat/utils/string_color.dart';
|
||||
|
|
@ -48,9 +49,9 @@ class Message extends StatelessWidget {
|
|||
List<PopupMenuEntry<String>> popupMenuList = [];
|
||||
if (event.canRedact && !event.redacted && event.status > 1) {
|
||||
popupMenuList.add(
|
||||
const PopupMenuItem<String>(
|
||||
PopupMenuItem<String>(
|
||||
value: "remove",
|
||||
child: Text('Remove message'),
|
||||
child: Text(I18n.of(context).removeMessage),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -75,24 +76,24 @@ class Message extends StatelessWidget {
|
|||
|
||||
if (!event.redacted) {
|
||||
popupMenuList.add(
|
||||
const PopupMenuItem<String>(
|
||||
PopupMenuItem<String>(
|
||||
value: "forward",
|
||||
child: Text('Forward'),
|
||||
child: Text(I18n.of(context).forward),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (ownMessage && event.status == -1) {
|
||||
popupMenuList.add(
|
||||
const PopupMenuItem<String>(
|
||||
PopupMenuItem<String>(
|
||||
value: "resend",
|
||||
child: Text('Send again'),
|
||||
child: Text(I18n.of(context).tryToSendAgain),
|
||||
),
|
||||
);
|
||||
popupMenuList.add(
|
||||
const PopupMenuItem<String>(
|
||||
PopupMenuItem<String>(
|
||||
value: "delete",
|
||||
child: Text('Delete message'),
|
||||
child: Text(I18n.of(context).deleteMessage),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -100,7 +101,7 @@ class Message extends StatelessWidget {
|
|||
List<Widget> rowChildren = [
|
||||
Expanded(
|
||||
child: PopupMenuButton(
|
||||
tooltip: "Tap to show menu",
|
||||
tooltip: I18n.of(context).tapToShowMenu,
|
||||
onSelected: (String choice) async {
|
||||
switch (choice) {
|
||||
case "remove":
|
||||
|
|
@ -141,7 +142,9 @@ class Message extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
ownMessage ? "You" : event.sender.calcDisplayname(),
|
||||
ownMessage
|
||||
? I18n.of(context).you
|
||||
: event.sender.calcDisplayname(),
|
||||
style: TextStyle(
|
||||
color: ownMessage
|
||||
? textColor
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/i18n/i18n.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/views/chat.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -43,45 +44,50 @@ class ParticipantListItem extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const Map<Membership, String> membershipBatch = {
|
||||
Map<Membership, String> membershipBatch = {
|
||||
Membership.join: "",
|
||||
Membership.ban: "Banned",
|
||||
Membership.invite: "Invited",
|
||||
Membership.leave: "Left",
|
||||
Membership.ban: I18n.of(context).banned,
|
||||
Membership.invite: I18n.of(context).invited,
|
||||
Membership.leave: I18n.of(context).leftTheChat,
|
||||
};
|
||||
final String permissionBatch = user.powerLevel == 100
|
||||
? "Admin"
|
||||
: user.powerLevel >= 50 ? "Moderator" : "";
|
||||
? I18n.of(context).admin
|
||||
: user.powerLevel >= 50 ? I18n.of(context).moderator : "";
|
||||
List<PopupMenuEntry<String>> items = <PopupMenuEntry<String>>[];
|
||||
if (user.canChangePowerLevel &&
|
||||
user.room.ownPowerLevel == 100 &&
|
||||
user.powerLevel != 100) {
|
||||
items.add(
|
||||
PopupMenuItem(child: Text("Make an admin"), value: "admin"),
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).makeAnAdmin), value: "admin"),
|
||||
);
|
||||
}
|
||||
if (user.canChangePowerLevel && user.powerLevel != 0) {
|
||||
items.add(
|
||||
PopupMenuItem(child: Text("Revoke all permissions"), value: "user"),
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).revokeAllPermissions), value: "user"),
|
||||
);
|
||||
}
|
||||
if (user.canKick) {
|
||||
items.add(
|
||||
PopupMenuItem(child: Text("Kick from group"), value: "kick"),
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).kickFromChat), value: "kick"),
|
||||
);
|
||||
}
|
||||
if (user.canBan && user.membership != Membership.ban) {
|
||||
items.add(
|
||||
PopupMenuItem(child: Text("Ban from group"), value: "ban"),
|
||||
PopupMenuItem(child: Text(I18n.of(context).banFromChat), value: "ban"),
|
||||
);
|
||||
} else if (user.canBan && user.membership == Membership.ban) {
|
||||
items.add(
|
||||
PopupMenuItem(child: Text("Remove exile"), value: "unban"),
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).removeExile), value: "unban"),
|
||||
);
|
||||
}
|
||||
if (user.id != Matrix.of(context).client.userID) {
|
||||
items.add(
|
||||
PopupMenuItem(child: Text("Send a message"), value: "message"),
|
||||
PopupMenuItem(
|
||||
child: Text(I18n.of(context).sendAMessage), value: "message"),
|
||||
);
|
||||
}
|
||||
return PopupMenuButton(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue