Add localizations

This commit is contained in:
Christian Pauly 2020-01-20 13:46:39 +01:00
parent 1f230c0a63
commit a776ac1513
28 changed files with 3406 additions and 249 deletions

View file

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/chat_details.dart';
import 'package:fluffychat/views/chat_list.dart';
@ -39,25 +40,25 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
);
List<PopupMenuEntry<String>> items = <PopupMenuEntry<String>>[
widget.room.pushRuleState == PushRuleState.notify
? const PopupMenuItem<String>(
? PopupMenuItem<String>(
value: "mute",
child: Text('Mute chat'),
child: Text(I18n.of(context).muteChat),
)
: const PopupMenuItem<String>(
: PopupMenuItem<String>(
value: "unmute",
child: Text('Unmute chat'),
child: Text(I18n.of(context).unmuteChat),
),
const PopupMenuItem<String>(
PopupMenuItem<String>(
value: "leave",
child: Text('Leave'),
child: Text(I18n.of(context).leave),
),
];
if (widget.displayChatDetails) {
items.insert(
0,
const PopupMenuItem<String>(
PopupMenuItem<String>(
value: "details",
child: Text('Chat details'),
child: Text(I18n.of(context).chatDetails),
),
);
}

View file

@ -1,4 +1,5 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
import '../matrix.dart';
@ -15,7 +16,7 @@ class RedactMessageDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text("Message will be removed for all participants"),
title: Text(I18n.of(context).messageWillBeRemovedWarning),
actions: <Widget>[
FlatButton(
child: Text("Close".toUpperCase(),
@ -24,7 +25,7 @@ class RedactMessageDialog extends StatelessWidget {
),
FlatButton(
child: Text(
"Remove".toUpperCase(),
I18n.of(context).remove.toUpperCase(),
style: TextStyle(color: Colors.red),
),
onPressed: () => removeAction(context),

View file

@ -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,
),

View file

@ -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

View file

@ -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(

View file

@ -3,6 +3,7 @@ import 'dart:convert';
import 'dart:io';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/utils/event_extension.dart';
import 'package:fluffychat/utils/room_extension.dart';
@ -131,7 +132,7 @@ class MatrixState extends State<Matrix> {
children: <Widget>[
CircularProgressIndicator(),
SizedBox(width: 16),
Text("Loading... Please wait"),
Text(I18n.of(context).loadingPleaseWait),
],
),
),
@ -167,9 +168,9 @@ class MatrixState extends State<Matrix> {
final String token = await _firebaseMessaging.getToken();
if (token?.isEmpty ?? true) {
return Toast.show(
"Push notifications disabled.",
I18n.of(context).noGoogleServicesWarning,
context,
duration: Toast.LENGTH_LONG,
duration: 10,
);
}
await client.setPushers(
@ -261,8 +262,9 @@ class MatrixState extends State<Matrix> {
// Calculate title
final String title = unread > 1
? "$unreadEvents unread messages in $unread chats"
: "$unreadEvents unread messages";
? I18n.of(context).unreadMessagesInChats(
unreadEvents.toString(), unread.toString())
: I18n.of(context).unreadMessages(unreadEvents.toString());
// Calculate the body
final String body = event.getLocalizedBody(context,
@ -300,7 +302,7 @@ class MatrixState extends State<Matrix> {
),
importance: Importance.Max,
priority: Priority.High,
ticker: 'New message in FluffyChat');
ticker: I18n.of(context).newMessageInFluffyChat);
var iOSPlatformChannelSpecifics = IOSNotificationDetails();
var platformChannelSpecifics = NotificationDetails(
androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);

View file

@ -1,6 +1,7 @@
import 'package:bubble/bubble.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/utils/event_extension.dart';
import 'package:fluffychat/views/content_web_view.dart';
@ -63,7 +64,7 @@ class MessageContent extends StatelessWidget {
children: <Widget>[
Icon(Icons.play_arrow, color: Colors.white),
Text(
"Play ${event.body}",
I18n.of(context).play(event.body),
overflow: TextOverflow.fade,
softWrap: false,
maxLines: 1,
@ -88,7 +89,7 @@ class MessageContent extends StatelessWidget {
children: <Widget>[
Icon(Icons.play_arrow, color: Colors.white),
Text(
"Play ${event.body}",
I18n.of(context).play(event.body),
overflow: TextOverflow.fade,
softWrap: false,
maxLines: 1,
@ -110,7 +111,7 @@ class MessageContent extends StatelessWidget {
child: RaisedButton(
color: Colors.blueGrey,
child: Text(
"Download ${event.body}",
I18n.of(context).download(event.body),
overflow: TextOverflow.fade,
softWrap: false,
maxLines: 1,
@ -144,7 +145,8 @@ class MessageContent extends StatelessWidget {
);
default:
return Text(
"${event.sender.calcDisplayname()} sent a ${event.typeKey} event",
I18n.of(context).userSentUnknownEvent(
event.sender.calcDisplayname(), event.typeKey),
style: TextStyle(
color: textColor,
decoration: event.redacted ? TextDecoration.lineThrough : null,

View file

@ -2,14 +2,35 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'messages_all.dart';
class AppLocalizationsDelegate extends LocalizationsDelegate<I18n> {
const AppLocalizationsDelegate();
@override
bool isSupported(Locale locale) {
return ['en', 'de'].contains(locale.languageCode);
}
@override
Future<I18n> load(Locale locale) {
return I18n.load(locale);
}
@override
bool shouldReload(LocalizationsDelegate<I18n> old) {
return false;
}
}
class I18n {
I18n(this.localeName);
static Future<I18n> load(Locale locale) {
final String name =
locale.countryCode.isEmpty ? locale.languageCode : locale.toString();
locale.countryCode == null ? locale.languageCode : locale.toString();
final String localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
return initializeMessages(localeName).then((bool _) {
Intl.defaultLocale = localeName;
return I18n(localeName);
});
}
@ -22,30 +43,518 @@ class I18n {
/* <=============> Translations <=============> */
String get about => Intl.message("About");
String acceptedTheInvitation(String username) => Intl.message(
"$username accepted the invitation",
name: "acceptedTheInvitation",
args: [username],
);
String activatedEndToEndEncryption(String username) => Intl.message(
"$username activated end to end encryption",
name: "activatedEndToEndEncryption",
args: [username],
);
String get addGroupDescription => Intl.message("Add a group description");
String get admin => Intl.message("Admin");
String get alias => Intl.message("alias");
String get alreadyHaveAnAccount => Intl.message("Already have an account?");
String get anyoneCanJoin => Intl.message("Anyone can join");
String get archive => Intl.message("Archive");
String get archivedRoom => Intl.message("Archived Room");
String get areGuestsAllowedToJoin =>
Intl.message("Are guest users allowed to join");
String get authentication => Intl.message("Authentication");
String get avatarHasBeenChanged => Intl.message("Avatar has been changed");
String get banFromChat => Intl.message("Ban from chat");
String get banned => Intl.message("Banned");
String bannedUser(String username, String targetName) => Intl.message(
"$username banned $targetName",
name: "bannedUser",
args: [username, targetName],
);
String changedTheChatAvatar(String username) => Intl.message(
"$username changed the chat avatar",
name: "changedTheChatAvatar",
args: [username],
);
String changedTheChatNameTo(String username, String chatname) => Intl.message(
"$username changed the chat name to: '$chatname'",
name: "changedTheChatNameTo",
args: [username, chatname],
);
String changedTheChatDescriptionTo(String username, String description) =>
Intl.message(
"$username changed the chat description to: '$description'",
name: "changedTheChatDescriptionTo",
args: [username, description],
);
String changedTheChatPermissions(String username) => Intl.message(
"$username changed the chat permissions",
name: "changedTheChatPermissions",
args: [username],
);
String changedTheDisplaynameTo(String username, String displayname) =>
Intl.message(
"$username changed the displayname to: $displayname",
name: "changedTheDisplaynameTo",
args: [username, displayname],
);
String changedTheGuestAccessRules(String username) => Intl.message(
"$username changed the guest access rules",
name: "changedTheGuestAccessRules",
args: [username],
);
String changedTheGuestAccessRulesTo(String username, String rules) =>
Intl.message(
"$username changed the guest access rules to: $rules",
name: "changedTheGuestAccessRulesTo",
args: [username, rules],
);
String changedTheHistoryVisibility(String username) => Intl.message(
"$username changed the history visibility",
name: "changedTheHistoryVisibility",
args: [username],
);
String changedTheHistoryVisibilityTo(String username, String rules) =>
Intl.message(
"$username changed the history visibility to: $rules",
name: "changedTheHistoryVisibilityTo",
args: [username, rules],
);
String changedTheJoinRules(String username) => Intl.message(
"$username changed the join rules",
name: "changedTheJoinRules",
args: [username],
);
String changedTheJoinRulesTo(String username, String joinRules) =>
Intl.message(
"$username changed the join rules to: $joinRules",
name: "changedTheJoinRulesTo",
args: [username, joinRules],
);
String changedTheProfileAvatar(String username) => Intl.message(
"$username changed the profile avatar",
name: "changedTheProfileAvatar",
args: [username],
);
String changedTheRoomAliases(String username) => Intl.message(
"$username changed the room aliases",
name: "changedTheRoomAliases",
args: [username],
);
String changedTheRoomInvitationLink(String username) => Intl.message(
"$username changed the invitation link",
name: "changedTheRoomInvitationLink",
args: [username],
);
String get changelog => Intl.message("Changelog");
String get changeTheNameOfTheGroup =>
Intl.message("Change the name of the group");
String get chatDetails => Intl.message('Chat details');
String get chooseAUsername => Intl.message("Choose a username");
String get close => Intl.message("Close");
String get confirm => Intl.message("Confirm");
String get connectionAttemptFailed =>
Intl.message("Connection attempt failed");
String get contactHasBeenInvitedToTheGroup =>
Intl.message("Contact has been invited to the group");
String get contentViewer => Intl.message("Content viewer");
String get copiedToClipboard => Intl.message("Copied to clipboard");
String get couldNotDecryptMessage =>
Intl.message("Could not decrypt message");
String get couldNotSetAvatar => Intl.message("Could not set avatar");
String get couldNotSetDisplayname =>
Intl.message("Could not set displayname");
String countParticipants(String count) => Intl.message(
"$count participants",
name: "countParticipants",
args: [count],
);
String get create => Intl.message("Create");
String get createAccountNow => Intl.message("Create account now");
String createdTheChat(String username) => Intl.message(
"$username created the chat",
name: "createdTheChat",
args: [username],
);
String get createNewGroup => Intl.message("Create new group");
String dateAndTimeOfDay(String date, String timeOfDay) => Intl.message(
"$date, $timeOfDay",
name: "dateAndTimeOfDay",
args: [date, timeOfDay],
);
String dateWithoutYear(String month, String day) => Intl.message(
"$month-$day",
name: "dateWithoutYear",
args: [month, day],
);
String dateWithYear(String year, String month, String day) => Intl.message(
"$year-$month-$day",
name: "dateWithYear",
args: [year, month, day],
);
String get delete => Intl.message("Delete");
String get deleteMessage => Intl.message("Delete message");
String get discardPicture => Intl.message("Discard picture");
String get displaynameHasBeenChanged =>
Intl.message("Displayname has been changed");
String download(String fileName) => Intl.message(
"Download $fileName",
name: "download",
args: [fileName],
);
String get editDisplayname => Intl.message("Edit displayname");
String get emptyChat => Intl.message("Empty chat");
String get enterAGroupName => Intl.message("Enter a group name");
String get enterAUsername => Intl.message("Enter a username");
String get fluffychat => Intl.message("FluffyChat");
String get forward => Intl.message('Forward');
String get friday => Intl.message("Friday");
String get fromJoining => Intl.message("From joining");
String get fromTheInvitation => Intl.message("From the invitation");
String get group => Intl.message("Group");
String get groupDescription => Intl.message("Group description");
String get groupDescriptionHasBeenChanged =>
Intl.message("Group description has been changed");
String get groupIsPublic => Intl.message("Group is public");
String groupWith(String displayname) => Intl.message(
"Group with $displayname",
name: "groupWith",
args: [displayname],
);
String get guestsAreForbidden => Intl.message("Guests are forbidden");
String get guestsCanJoin => Intl.message("Guests can join");
String hasWithdrawnTheInvitationFor(String username, String targetName) =>
Intl.message(
"$username has withdrawn the invitation for $targetName",
name: "hasWithdrawnTheInvitationFor",
args: [username, targetName],
);
String get help => Intl.message("Help");
String get homeserverIsNotCompatible =>
Intl.message("Homeserver is not compatible");
String get inviteContact => Intl.message("Invite contact");
String inviteContactToGroup(String groupName) => Intl.message(
"Invite contact to $groupName",
name: "inviteContactToGroup",
args: [groupName],
);
String get invited => Intl.message("Invited");
String invitedUser(String username, String targetName) => Intl.message(
"$username invited $targetName",
name: "invitedUser",
args: [username, targetName],
);
String get invitedUsersOnly => Intl.message("Invited users only");
String get isTyping => Intl.message("is typing...");
String joinedTheChat(String username) => Intl.message(
"$username joined the chat",
name: "joinedTheChat",
args: [username],
);
String kicked(String username, String targetName) => Intl.message(
"$username kicked $targetName",
name: "kicked",
args: [username, targetName],
);
String kickedAndBanned(String username, String targetName) => Intl.message(
"$username kicked and banned $targetName",
name: "kickedAndBanned",
args: [username, targetName],
);
String get kickFromChat => Intl.message("Kick from chat");
String get leave => Intl.message('Leave');
String get leftTheChat => Intl.message("Left the chat");
String get logout => Intl.message("Logout");
String userLeftTheChat(String username) => Intl.message(
"$username left the chat",
name: "userLeftTheChat",
args: [username],
);
String get license => Intl.message("License");
String get loadingPleaseWait => Intl.message("Loading... Please wait");
String loadCountMoreParticipants(String count) => Intl.message(
"Load $count more participants",
name: "loadCountMoreParticipants",
args: [count],
);
String get login => Intl.message("Login");
String get makeAnAdmin => Intl.message("Make an admin");
String get makeSureTheIdentifierIsValid =>
Intl.message("Make sure the identifier is valid");
String get messageWillBeRemovedWarning =>
Intl.message("Message will be removed for all participants");
String get moderator => Intl.message("Moderator");
String get monday => Intl.message("Monday");
String get muteChat => Intl.message('Mute chat');
String get newMessageInFluffyChat =>
Intl.message('New message in FluffyChat');
String get newPrivateChat => Intl.message("New private chat");
String get noGoogleServicesWarning => Intl.message(
"It seems that you have no google services on your phone. That's a good decision for your privacy! To receive push notifications in FluffyChat we recommend using microG: https://microg.org/");
String get noRoomsFound => Intl.message("No rooms found...");
String get notSupportedInWeb => Intl.message("Not supported in web");
String get oopsSomethingWentWrong =>
Intl.message("Oops something went wrong...");
String get openCamera => Intl.message('Open camera');
String get optionalGroupName => Intl.message("(Optional) Group name");
String get password => Intl.message("Password");
String play(String fileName) => Intl.message(
"Play $fileName",
name: "play",
args: [fileName],
);
String get pleaseChooseAUsername => Intl.message("Please choose a username");
String get pleaseEnterAMatrixIdentifier =>
Intl.message('Please enter a matrix identifier');
String get pleaseEnterYourPassword =>
Intl.message("Please enter your password");
String get pleaseEnterYourUsername =>
Intl.message("Please enter your username");
String get rejoin => Intl.message("Rejoin");
String redactedAnEvent(String username) => Intl.message(
"$username redacted an event",
name: "redactedAnEvent",
args: [username],
);
String rejectedTheInvitation(String username) => Intl.message(
"$username rejected the invitation",
name: "rejectedTheInvitation",
args: [username],
);
String removedBy(String username) => Intl.message(
"Removed by $username",
name: "removedBy",
args: [username],
);
String get removeExile => Intl.message("Remove exile");
String get revokeAllPermissions => Intl.message("Revoke all permissions");
String get remove => Intl.message("Remove");
String get removeMessage => Intl.message('Remove message');
String get saturday => Intl.message("Saturday");
String get share => Intl.message("Share");
String sharedTheLocation(String username) => Intl.message(
"$username shared the location",
name: "sharedTheLocation",
args: [username],
);
String get searchForAChat => Intl.message("Search for a chat");
String get secureYourAccountWithAPassword =>
Intl.message("Secure your account with a password");
String seenByUser(String username) => Intl.message(
"Seen by $username",
name: "seenByUser",
args: [username],
);
String seenByUserAndUser(String username, String username2) => Intl.message(
"Seen by $username and $username2",
name: "seenByUserAndUser",
args: [username, username2],
);
String seenByUserAndCountOthers(String username, String count) =>
Intl.message(
"Seen by $username and $count others",
name: "seenByUserAndCountOthers",
args: [username, count],
);
String get sendAMessage => Intl.message("Send a message");
String get sendFile => Intl.message('Send file');
String get sendImage => Intl.message('Send image');
String sentAFile(String username) => Intl.message(
"$username sent a file",
name: "sentAFile",
args: [username],
);
String sentAnAudio(String username) => Intl.message(
"$username sent an audio",
name: "sentAnAudio",
args: [username],
);
String sentAPicture(String username) => Intl.message(
"$username sent a picture",
name: "sentAPicture",
args: [username],
);
String sentASticker(String username) => Intl.message(
"$username sent a sticker",
name: "sentASticker",
args: [username],
);
String sentAVideo(String username) => Intl.message(
"$username sent a video",
name: "sentAVideo",
args: [username],
);
String get setAProfilePicture => Intl.message("Set a profile picture");
String get setGroupDescription => Intl.message("Set group description");
String get setInvitationLink => Intl.message("Set invitation link");
String get settings => Intl.message("Settings");
String get signUp => Intl.message("Sign up");
String get sourceCode => Intl.message("Source code");
String get startYourFirstChat => Intl.message("Start your first chat :-)");
String get sunday => Intl.message("Sunday");
String get donate => Intl.message("Donate");
String get tapToShowMenu => Intl.message("Tap to show menu");
String get thisRoomHasBeenArchived =>
Intl.message("This room has been archived.");
String get thursday => Intl.message("Thursday");
String timeOfDay(
String hours12, String hours24, String minutes, String suffix) =>
Intl.message(
"$hours12:$minutes $suffix",
name: "timeOfDay",
args: [hours12, hours24, minutes, suffix],
);
String get title => Intl.message(
'FluffyChat',
name: 'title',
@ -53,10 +562,92 @@ class I18n {
locale: localeName,
);
String get tryToSendAgain => Intl.message("Try to send again");
String get tuesday => Intl.message("Tuesday");
String unbannedUser(String username, String targetName) => Intl.message(
"$username unbanned $targetName",
name: "unbannedUser",
args: [username, targetName],
);
String get unmuteChat => Intl.message('Unmute chat');
String unknownEvent(String type) => Intl.message(
"Unknown event '$type'",
name: "unknownEvent",
args: [type],
);
String unreadMessages(String unreadEvents) => Intl.message(
"$unreadEvents unread messages",
name: "unreadMessages",
args: [unreadEvents],
);
String unreadMessagesInChats(String unreadEvents, String unreadChats) =>
Intl.message(
"$unreadEvents unread messages in $unreadChats chats",
name: "unreadMessagesInChats",
args: [unreadEvents, unreadChats],
);
String userAndOthersAreTyping(String username, String count) => Intl.message(
"$username and $count others are typing...",
name: "userAndOthersAreTyping",
args: [username, count],
);
String userAndUserAreTyping(String username, String username2) =>
Intl.message(
"$username and $username2 are typing...",
name: "userAndUserAreTyping",
args: [username, username2],
);
String get username => Intl.message("Username");
String userIsTyping(String username) => Intl.message(
"$username is typing...",
name: "userIsTyping",
args: [username],
);
String userSentUnknownEvent(String username, String type) => Intl.message(
"$username sent a $type event",
name: "userSentUnknownEvent",
args: [username, type],
);
String get visibleForAllParticipants =>
Intl.message("Visible for all participants");
String get visibleForEveryone => Intl.message("Visible for everyone");
String get visibilityOfTheChatHistory =>
Intl.message("Visibility of the chat history");
String get wednesday => Intl.message("Wednesday");
String get whoIsAllowedToJoinThisGroup =>
Intl.message("Who is allowed to join this group");
String get writeAMessage => Intl.message("Write a message...");
String get you => Intl.message("You");
String get youAreInvitedToThisChat =>
Intl.message("You are invited to this chat");
String get youAreNoLongerParticipatingInThisChat =>
Intl.message("You are no longer participating in this chat");
String get youCannotInviteYourself =>
Intl.message("You cannot invite yourself");
String get youHaveBeenBannedFromThisChat =>
Intl.message("You have been banned from this chat");
String get yourOwnUsername => Intl.message("Your own username");
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -19,8 +19,290 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'de';
static m0(username) => "${username} hat die Einladung akzeptiert";
static m1(username) => "${username} hat Ende-zu-Ende Verschlüsselung aktiviert";
static m2(username, targetName) => "${username} hat ${targetName} verbannt";
static m3(username) => "${username} hat den Chat-Avatar geändert";
static m4(username, description) => "${username} hat die Beschreibung vom Chat geändert zu: \'${description}\'";
static m5(username, chatname) => "${username} hat den Chat-Namen geändert zu: \'${chatname}\'";
static m6(username) => "${username} hat die Berechtigungen vom Chat geändert";
static m7(username, displayname) => "${username} hat den Nicknamen geändert zu: ${displayname}";
static m8(username) => "${username} hat Gast-Zugangsregeln geändert";
static m9(username, rules) => "${username} hat Gast-Zugangsregeln geändert zu: ${rules}";
static m10(username) => "${username} hat die Sichtbarkeit des Chat-Verlaufs geändert";
static m11(username, rules) => "${username} hat die Sichtbarkeit des Chat-Verlaufs geändert zu: ${rules}";
static m12(username) => "${username} hat die Zugangsregeln geändert";
static m13(username, joinRules) => "${username} hat die Zugangsregeln geändert zu: ${joinRules}";
static m14(username) => "${username} hat das Profilbild geändert";
static m15(username) => "${username} hat die Raum-Aliase geändert";
static m16(username) => "${username} hat den Einladungslink geändert";
static m17(count) => "${count} Teilnehmer";
static m18(username) => "${username} hat den Chat erstellt";
static m19(date, timeOfDay) => "${date}, ${timeOfDay}";
static m20(year, month, day) => "${day}.${month}.${year}";
static m21(month, day) => "${day}.${month}";
static m22(fileName) => "Download ${fileName}";
static m23(displayname) => "Gruppe mit ${displayname}";
static m24(username, targetName) => "${username} hat die Einladung für ${targetName} zurückgezogen";
static m25(groupName) => "Kontakt zu ${groupName} einladen";
static m26(username, targetName) => "${username} hat ${targetName} eingeladen";
static m27(username) => "${username} ist dem Chat beigetreten";
static m28(username, targetName) => "${username} hat ${targetName} hinausgeworfen";
static m29(username, targetName) => "${username} hat ${targetName} hinausgeworfen und verbannt";
static m30(count) => "${count} weitere Teilnehmer laden";
static m31(fileName) => "Play ${fileName}";
static m32(username) => "${username} hat ein Event enternt";
static m33(username) => "${username} hat die Einladung abgelehnt";
static m34(username) => "Entfernt von ${username}";
static m35(username) => "Gelesen von ${username}";
static m36(username, count) => "Gelesen von ${username} und ${count} anderen";
static m37(username, username2) => "Gelesen von ${username} und ${username2}";
static m38(username) => "${username} hat eine Datei gesendet";
static m39(username) => "${username} hat ein Bild gesendet";
static m40(username) => "${username} hat einen Sticker gesendet";
static m41(username) => "${username} hat ein Video gesendet";
static m42(username) => "${username} hat eine Audio-Datei gesendet";
static m43(username) => "${username} hat den Standort geteilt";
static m44(hours12, hours24, minutes, suffix) => "${hours24}:${minutes}";
static m45(username, targetName) => "${username} hat die Verbannung von ${targetName} aufgehoben";
static m46(type) => "Unbekanntes Event \'${type}\'";
static m47(unreadEvents) => "${unreadEvents} ungelesene Nachrichten";
static m48(unreadEvents, unreadChats) => "${unreadEvents} ungelesene Nachrichten in ${unreadChats} Chats";
static m49(username, count) => "${username} und ${count} andere schreiben ...";
static m50(username, username2) => "${username} und ${username2} schreiben ...";
static m51(username) => "${username} schreibt ...";
static m52(username) => "${username} hat den Chat verlassen";
static m53(username, type) => "${username} hat ${type} Event gesendet";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"(Optional) Group name" : MessageLookupByLibrary.simpleMessage("(Optional) Name für die Gruppe"),
"About" : MessageLookupByLibrary.simpleMessage("Über"),
"Add a group description" : MessageLookupByLibrary.simpleMessage("Eine Beschreibung für die Gruppe hinzufügen"),
"Admin" : MessageLookupByLibrary.simpleMessage("Admin"),
"Already have an account?" : MessageLookupByLibrary.simpleMessage("Hast du schon einen Account?"),
"Anyone can join" : MessageLookupByLibrary.simpleMessage("Jeder darf beitreten"),
"Archive" : MessageLookupByLibrary.simpleMessage("Archiv"),
"Archived Room" : MessageLookupByLibrary.simpleMessage("Archivierter Raum"),
"Are guest users allowed to join" : MessageLookupByLibrary.simpleMessage("Dürfen Gast-Benutzer beitreten"),
"Authentication" : MessageLookupByLibrary.simpleMessage("Authentifizierung"),
"Avatar has been changed" : MessageLookupByLibrary.simpleMessage("Avatar wurde geändert"),
"Ban from chat" : MessageLookupByLibrary.simpleMessage("Aus dem Chat verbannen"),
"Banned" : MessageLookupByLibrary.simpleMessage("Banned"),
"Change the name of the group" : MessageLookupByLibrary.simpleMessage("Gruppenname ändern"),
"Changelog" : MessageLookupByLibrary.simpleMessage("Changelog"),
"Chat details" : MessageLookupByLibrary.simpleMessage("Gruppeninfo"),
"Choose a username" : MessageLookupByLibrary.simpleMessage("Wähle einen Benutzernamen"),
"Close" : MessageLookupByLibrary.simpleMessage("Schließen"),
"Confirm" : MessageLookupByLibrary.simpleMessage("Bestätigen"),
"Connection attempt failed" : MessageLookupByLibrary.simpleMessage("Verbindungsversuch fehlgeschlagen"),
"Contact has been invited to the group" : MessageLookupByLibrary.simpleMessage("Kontakt wurde in die Gruppe eingeladen"),
"Content viewer" : MessageLookupByLibrary.simpleMessage("Content Viewer"),
"Copied to clipboard" : MessageLookupByLibrary.simpleMessage("Wurde in die Zwischenablage kopiert"),
"Could not decrypt message" : MessageLookupByLibrary.simpleMessage("Nachricht konnte nicht entschlüsselt werden"),
"Could not set avatar" : MessageLookupByLibrary.simpleMessage("Profilbild konnte nicht gesetzt werden"),
"Could not set displayname" : MessageLookupByLibrary.simpleMessage("Anzeigename konnte nicht gesetzt werden"),
"Create" : MessageLookupByLibrary.simpleMessage("Create"),
"Create account now" : MessageLookupByLibrary.simpleMessage("Account jetzt erstellen"),
"Create new group" : MessageLookupByLibrary.simpleMessage("Create new group"),
"Delete" : MessageLookupByLibrary.simpleMessage("Löschen"),
"Delete message" : MessageLookupByLibrary.simpleMessage("Nachricht löschen"),
"Discard picture" : MessageLookupByLibrary.simpleMessage("Bild verwerfen"),
"Displayname has been changed" : MessageLookupByLibrary.simpleMessage("Anzeigename wurde geändert"),
"Donate" : MessageLookupByLibrary.simpleMessage("Spenden"),
"Edit displayname" : MessageLookupByLibrary.simpleMessage("Anzeigename ändern"),
"Empty chat" : MessageLookupByLibrary.simpleMessage("Leerer Chat"),
"Enter a group name" : MessageLookupByLibrary.simpleMessage("Gib einen Gruppennamen ein"),
"Enter a username" : MessageLookupByLibrary.simpleMessage("Gib einen Benutzernamen ein"),
"FluffyChat" : MessageLookupByLibrary.simpleMessage("FluffyChat"),
"Forward" : MessageLookupByLibrary.simpleMessage("Weiterleiten"),
"Friday" : MessageLookupByLibrary.simpleMessage("Freitag"),
"From joining" : MessageLookupByLibrary.simpleMessage("Ab dem Beitritt"),
"From the invitation" : MessageLookupByLibrary.simpleMessage("Ab der Einladung"),
"Group" : MessageLookupByLibrary.simpleMessage("Gruppe"),
"Group description" : MessageLookupByLibrary.simpleMessage("Gruppenbeschreibung"),
"Group description has been changed" : MessageLookupByLibrary.simpleMessage("Gruppenbeschreibung wurde geändert"),
"Group is public" : MessageLookupByLibrary.simpleMessage("Gruppe ist öffentlich"),
"Guests are forbidden" : MessageLookupByLibrary.simpleMessage("Gäste sind verboten"),
"Guests can join" : MessageLookupByLibrary.simpleMessage("Gäste dürfen beitreten"),
"Help" : MessageLookupByLibrary.simpleMessage("Hilfe"),
"Homeserver is not compatible" : MessageLookupByLibrary.simpleMessage("Homeserver ist nicht kompatibel"),
"Invite contact" : MessageLookupByLibrary.simpleMessage("Kontakt einladen"),
"Invited" : MessageLookupByLibrary.simpleMessage("Eingeladen"),
"Invited users only" : MessageLookupByLibrary.simpleMessage("Nur eingeladene Benutzer"),
"It seems that you have no google services on your phone. That\'s a good decision for your privacy! To receive push notifications in FluffyChat we recommend using microG: https://microg.org/" : MessageLookupByLibrary.simpleMessage("Es sieht so aus als hättest du keine Google Dienste auf deinem Gerät. Das ist eine gute Entscheidung für deine Privatsphäre. Um Push Benachrichtigungen in FluffyChat zu erhalten, empfehlen wir die Verwendung von microG: https://microg.org/"),
"Kick from chat" : MessageLookupByLibrary.simpleMessage("Aus dem Chat hinauswerfen"),
"Leave" : MessageLookupByLibrary.simpleMessage("Verlassen"),
"Left the chat" : MessageLookupByLibrary.simpleMessage("Hat den Chat verlassen"),
"License" : MessageLookupByLibrary.simpleMessage("Lizenz"),
"Loading... Please wait" : MessageLookupByLibrary.simpleMessage("Lade ... Bitte warten"),
"Login" : MessageLookupByLibrary.simpleMessage("Login"),
"Logout" : MessageLookupByLibrary.simpleMessage("Logout"),
"Make an admin" : MessageLookupByLibrary.simpleMessage("Zum Admin ernennen"),
"Make sure the identifier is valid" : MessageLookupByLibrary.simpleMessage("Gib bitte einen richtigen Benutzernamen ein"),
"Message will be removed for all participants" : MessageLookupByLibrary.simpleMessage("Nachricht wird für alle Teilnehmer entfernt"),
"Moderator" : MessageLookupByLibrary.simpleMessage("Moderator"),
"Monday" : MessageLookupByLibrary.simpleMessage("Montag"),
"Mute chat" : MessageLookupByLibrary.simpleMessage("Stummschalten"),
"New message in FluffyChat" : MessageLookupByLibrary.simpleMessage("Neue Nachricht in FluffyChat"),
"New private chat" : MessageLookupByLibrary.simpleMessage("Neuer privater Chat"),
"No rooms found..." : MessageLookupByLibrary.simpleMessage("Keine Räume gefunden ..."),
"Not supported in web" : MessageLookupByLibrary.simpleMessage("Wird in der Web-Version nicht unterstützt"),
"Oops something went wrong..." : MessageLookupByLibrary.simpleMessage("Hoppla! Da ist etwas schief gelaufen ..."),
"Open camera" : MessageLookupByLibrary.simpleMessage("Kamera öffnen"),
"Password" : MessageLookupByLibrary.simpleMessage("Passwort"),
"Please choose a username" : MessageLookupByLibrary.simpleMessage("Bitte wähle einen Benutzernamen"),
"Please enter a matrix identifier" : MessageLookupByLibrary.simpleMessage("Bitte eine Matrix ID eingeben"),
"Please enter your password" : MessageLookupByLibrary.simpleMessage("Bitte dein Passwort eingeben"),
"Please enter your username" : MessageLookupByLibrary.simpleMessage("Bitte deinen Benutzernamen eingeben"),
"Rejoin" : MessageLookupByLibrary.simpleMessage("Wieder beitreten"),
"Remove" : MessageLookupByLibrary.simpleMessage("Entfernen"),
"Remove exile" : MessageLookupByLibrary.simpleMessage("Verbannung aufheben"),
"Remove message" : MessageLookupByLibrary.simpleMessage("Nachricht entfernen"),
"Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Alle Berechtigungen zurücknehmen"),
"Saturday" : MessageLookupByLibrary.simpleMessage("Samstag"),
"Search for a chat" : MessageLookupByLibrary.simpleMessage("Durchsuche die Chats"),
"Secure your account with a password" : MessageLookupByLibrary.simpleMessage("Sichere deinen Account mit einem Passwort ab"),
"Send a message" : MessageLookupByLibrary.simpleMessage("Nachricht schreiben"),
"Send file" : MessageLookupByLibrary.simpleMessage("Datei senden"),
"Send image" : MessageLookupByLibrary.simpleMessage("Bild senden"),
"Set a profile picture" : MessageLookupByLibrary.simpleMessage("Ein Profilbild festlegen"),
"Set group description" : MessageLookupByLibrary.simpleMessage("Gruppenbeschreibung festlegen"),
"Set invitation link" : MessageLookupByLibrary.simpleMessage("Einladungslink festlegen"),
"Settings" : MessageLookupByLibrary.simpleMessage("Einstellungen"),
"Share" : MessageLookupByLibrary.simpleMessage("Teilen"),
"Sign up" : MessageLookupByLibrary.simpleMessage("Registrieren"),
"Source code" : MessageLookupByLibrary.simpleMessage("Quellcode"),
"Start your first chat :-)" : MessageLookupByLibrary.simpleMessage("Starte deinen ersten Chat :-)"),
"Sunday" : MessageLookupByLibrary.simpleMessage("Sonntag"),
"Tap to show menu" : MessageLookupByLibrary.simpleMessage("Tippen, um das Menü anzuzeigen"),
"This room has been archived." : MessageLookupByLibrary.simpleMessage("Dieser Raum wurde archiviert."),
"Thursday" : MessageLookupByLibrary.simpleMessage("Donnerstag"),
"Try to send again" : MessageLookupByLibrary.simpleMessage("Nochmal versuchen zu senden"),
"Tuesday" : MessageLookupByLibrary.simpleMessage("Tuesday"),
"Unmute chat" : MessageLookupByLibrary.simpleMessage("Nicht mehr stummschalten"),
"Username" : MessageLookupByLibrary.simpleMessage("Benutzername"),
"Visibility of the chat history" : MessageLookupByLibrary.simpleMessage("Sichtbarkeit des Chat-Verlaufs"),
"Visible for all participants" : MessageLookupByLibrary.simpleMessage("Sichtbar für alle Teilnehmer"),
"Visible for everyone" : MessageLookupByLibrary.simpleMessage("Für jeden sichtbar"),
"Wednesday" : MessageLookupByLibrary.simpleMessage("Mittwoch"),
"Who is allowed to join this group" : MessageLookupByLibrary.simpleMessage("Wer darf der Gruppe beitreten"),
"Write a message..." : MessageLookupByLibrary.simpleMessage("Schreibe eine Nachricht ..."),
"You" : MessageLookupByLibrary.simpleMessage("Du"),
"You are invited to this chat" : MessageLookupByLibrary.simpleMessage("Du wurdest eingeladen in diesen Chat"),
"You are no longer participating in this chat" : MessageLookupByLibrary.simpleMessage("Du bist kein Teilnehmer mehr in diesem Chat"),
"You cannot invite yourself" : MessageLookupByLibrary.simpleMessage("Du kannst dich nicht selbst einladen"),
"You have been banned from this chat" : MessageLookupByLibrary.simpleMessage("Du wurdest aus dem Chat verbannt"),
"Your own username" : MessageLookupByLibrary.simpleMessage("Dein eigener Benutzername"),
"acceptedTheInvitation" : m0,
"activatedEndToEndEncryption" : m1,
"alias" : MessageLookupByLibrary.simpleMessage("Alias"),
"bannedUser" : m2,
"changedTheChatAvatar" : m3,
"changedTheChatDescriptionTo" : m4,
"changedTheChatNameTo" : m5,
"changedTheChatPermissions" : m6,
"changedTheDisplaynameTo" : m7,
"changedTheGuestAccessRules" : m8,
"changedTheGuestAccessRulesTo" : m9,
"changedTheHistoryVisibility" : m10,
"changedTheHistoryVisibilityTo" : m11,
"changedTheJoinRules" : m12,
"changedTheJoinRulesTo" : m13,
"changedTheProfileAvatar" : m14,
"changedTheRoomAliases" : m15,
"changedTheRoomInvitationLink" : m16,
"countParticipants" : m17,
"createdTheChat" : m18,
"dateAndTimeOfDay" : m19,
"dateWithYear" : m20,
"dateWithoutYear" : m21,
"download" : m22,
"groupWith" : m23,
"hasWithdrawnTheInvitationFor" : m24,
"inviteContactToGroup" : m25,
"invitedUser" : m26,
"is typing..." : MessageLookupByLibrary.simpleMessage("schreibt..."),
"joinedTheChat" : m27,
"kicked" : m28,
"kickedAndBanned" : m29,
"loadCountMoreParticipants" : m30,
"play" : m31,
"redactedAnEvent" : m32,
"rejectedTheInvitation" : m33,
"removedBy" : m34,
"seenByUser" : m35,
"seenByUserAndCountOthers" : m36,
"seenByUserAndUser" : m37,
"sentAFile" : m38,
"sentAPicture" : m39,
"sentASticker" : m40,
"sentAVideo" : m41,
"sentAnAudio" : m42,
"sharedTheLocation" : m43,
"timeOfDay" : m44,
"title" : MessageLookupByLibrary.simpleMessage("FluffyChat"),
"unbannedUser" : m45,
"unknownEvent" : m46,
"unreadMessages" : m47,
"unreadMessagesInChats" : m48,
"userAndOthersAreTyping" : m49,
"userAndUserAreTyping" : m50,
"userIsTyping" : m51,
"userLeftTheChat" : m52,
"userSentUnknownEvent" : m53
};
}

View file

@ -19,8 +19,290 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'messages';
static m0(username) => "${username} accepted the invitation";
static m1(username) => "${username} activated end to end encryption";
static m2(username, targetName) => "${username} banned ${targetName}";
static m3(username) => "${username} changed the chat avatar";
static m4(username, description) => "${username} changed the chat description to: \'${description}\'";
static m5(username, chatname) => "${username} changed the chat name to: \'${chatname}\'";
static m6(username) => "${username} changed the chat permissions";
static m7(username, displayname) => "${username} changed the displayname to: ${displayname}";
static m8(username) => "${username} changed the guest access rules";
static m9(username, rules) => "${username} changed the guest access rules to: ${rules}";
static m10(username) => "${username} changed the history visibility";
static m11(username, rules) => "${username} changed the history visibility to: ${rules}";
static m12(username) => "${username} changed the join rules";
static m13(username, joinRules) => "${username} changed the join rules to: ${joinRules}";
static m14(username) => "${username} changed the profile avatar";
static m15(username) => "${username} changed the room aliases";
static m16(username) => "${username} changed the invitation link";
static m17(count) => "${count} participants";
static m18(username) => "${username} created the chat";
static m19(date, timeOfDay) => "${date}, ${timeOfDay}";
static m20(year, month, day) => "${year}-${month}-${day}";
static m21(month, day) => "${month}-${day}";
static m22(fileName) => "Download ${fileName}";
static m23(displayname) => "Group with ${displayname}";
static m24(username, targetName) => "${username} has withdrawn the invitation for ${targetName}";
static m25(groupName) => "Invite contact to ${groupName}";
static m26(username, targetName) => "${username} invited ${targetName}";
static m27(username) => "${username} joined the chat";
static m28(username, targetName) => "${username} kicked ${targetName}";
static m29(username, targetName) => "${username} kicked and banned ${targetName}";
static m30(count) => "Load ${count} more participants";
static m31(fileName) => "Play ${fileName}";
static m32(username) => "${username} redacted an event";
static m33(username) => "${username} rejected the invitation";
static m34(username) => "Removed by ${username}";
static m35(username) => "Seen by ${username}";
static m36(username, count) => "Seen by ${username} and ${count} others";
static m37(username, username2) => "Seen by ${username} and ${username2}";
static m38(username) => "${username} sent a file";
static m39(username) => "${username} sent a picture";
static m40(username) => "${username} sent a sticker";
static m41(username) => "${username} sent a video";
static m42(username) => "${username} sent an audio";
static m43(username) => "${username} shared the location";
static m44(hours12, hours24, minutes, suffix) => "${hours12}:${minutes} ${suffix}";
static m45(username, targetName) => "${username} unbanned ${targetName}";
static m46(type) => "Unknown event \'${type}\'";
static m47(unreadEvents) => "${unreadEvents} unread messages";
static m48(unreadEvents, unreadChats) => "${unreadEvents} unread messages in ${unreadChats} chats";
static m49(username, count) => "${username} and ${count} others are typing...";
static m50(username, username2) => "${username} and ${username2} are typing...";
static m51(username) => "${username} is typing...";
static m52(username) => "${username} left the chat";
static m53(username, type) => "${username} sent a ${type} event";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"(Optional) Group name" : MessageLookupByLibrary.simpleMessage("(Optional) Group name"),
"About" : MessageLookupByLibrary.simpleMessage("About"),
"Add a group description" : MessageLookupByLibrary.simpleMessage("Add a group description"),
"Admin" : MessageLookupByLibrary.simpleMessage("Admin"),
"Already have an account?" : MessageLookupByLibrary.simpleMessage("Already have an account?"),
"Anyone can join" : MessageLookupByLibrary.simpleMessage("Anyone can join"),
"Archive" : MessageLookupByLibrary.simpleMessage("Archive"),
"Archived Room" : MessageLookupByLibrary.simpleMessage("Archived Room"),
"Are guest users allowed to join" : MessageLookupByLibrary.simpleMessage("Are guest users allowed to join"),
"Authentication" : MessageLookupByLibrary.simpleMessage("Authentication"),
"Avatar has been changed" : MessageLookupByLibrary.simpleMessage("Avatar has been changed"),
"Ban from chat" : MessageLookupByLibrary.simpleMessage("Ban from chat"),
"Banned" : MessageLookupByLibrary.simpleMessage("Banned"),
"Change the name of the group" : MessageLookupByLibrary.simpleMessage("Change the name of the group"),
"Changelog" : MessageLookupByLibrary.simpleMessage("Changelog"),
"Chat details" : MessageLookupByLibrary.simpleMessage("Chat details"),
"Choose a username" : MessageLookupByLibrary.simpleMessage("Choose a username"),
"Close" : MessageLookupByLibrary.simpleMessage("Close"),
"Confirm" : MessageLookupByLibrary.simpleMessage("Confirm"),
"Connection attempt failed" : MessageLookupByLibrary.simpleMessage("Connection attempt failed"),
"Contact has been invited to the group" : MessageLookupByLibrary.simpleMessage("Contact has been invited to the group"),
"Content viewer" : MessageLookupByLibrary.simpleMessage("Content viewer"),
"Copied to clipboard" : MessageLookupByLibrary.simpleMessage("Copied to clipboard"),
"Could not decrypt message" : MessageLookupByLibrary.simpleMessage("Could not decrypt message"),
"Could not set avatar" : MessageLookupByLibrary.simpleMessage("Could not set avatar"),
"Could not set displayname" : MessageLookupByLibrary.simpleMessage("Could not set displayname"),
"Create" : MessageLookupByLibrary.simpleMessage("Create"),
"Create account now" : MessageLookupByLibrary.simpleMessage("Create account now"),
"Create new group" : MessageLookupByLibrary.simpleMessage("Create new group"),
"Delete" : MessageLookupByLibrary.simpleMessage("Delete"),
"Delete message" : MessageLookupByLibrary.simpleMessage("Delete message"),
"Discard picture" : MessageLookupByLibrary.simpleMessage("Discard picture"),
"Displayname has been changed" : MessageLookupByLibrary.simpleMessage("Displayname has been changed"),
"Donate" : MessageLookupByLibrary.simpleMessage("Donate"),
"Edit displayname" : MessageLookupByLibrary.simpleMessage("Edit displayname"),
"Empty chat" : MessageLookupByLibrary.simpleMessage("Empty chat"),
"Enter a group name" : MessageLookupByLibrary.simpleMessage("Enter a group name"),
"Enter a username" : MessageLookupByLibrary.simpleMessage("Enter a username"),
"FluffyChat" : MessageLookupByLibrary.simpleMessage("FluffyChat"),
"Forward" : MessageLookupByLibrary.simpleMessage("Forward"),
"Friday" : MessageLookupByLibrary.simpleMessage("Friday"),
"From joining" : MessageLookupByLibrary.simpleMessage("From joining"),
"From the invitation" : MessageLookupByLibrary.simpleMessage("From the invitation"),
"Group" : MessageLookupByLibrary.simpleMessage("Group"),
"Group description" : MessageLookupByLibrary.simpleMessage("Group description"),
"Group description has been changed" : MessageLookupByLibrary.simpleMessage("Group description has been changed"),
"Group is public" : MessageLookupByLibrary.simpleMessage("Group is public"),
"Guests are forbidden" : MessageLookupByLibrary.simpleMessage("Guests are forbidden"),
"Guests can join" : MessageLookupByLibrary.simpleMessage("Guests can join"),
"Help" : MessageLookupByLibrary.simpleMessage("Help"),
"Homeserver is not compatible" : MessageLookupByLibrary.simpleMessage("Homeserver is not compatible"),
"Invite contact" : MessageLookupByLibrary.simpleMessage("Invite contact"),
"Invited" : MessageLookupByLibrary.simpleMessage("Invited"),
"Invited users only" : MessageLookupByLibrary.simpleMessage("Invited users only"),
"It seems that you have no google services on your phone. That\'s a good decision for your privacy! To receive push notifications in FluffyChat we recommend using microG: https://microg.org/" : MessageLookupByLibrary.simpleMessage("It seems that you have no google services on your phone. That\'s a good decision for your privacy! To receive push notifications in FluffyChat we recommend using microG: https://microg.org/"),
"Kick from chat" : MessageLookupByLibrary.simpleMessage("Kick from chat"),
"Leave" : MessageLookupByLibrary.simpleMessage("Leave"),
"Left the chat" : MessageLookupByLibrary.simpleMessage("Left the chat"),
"License" : MessageLookupByLibrary.simpleMessage("License"),
"Loading... Please wait" : MessageLookupByLibrary.simpleMessage("Loading... Please wait"),
"Login" : MessageLookupByLibrary.simpleMessage("Login"),
"Logout" : MessageLookupByLibrary.simpleMessage("Logout"),
"Make an admin" : MessageLookupByLibrary.simpleMessage("Make an admin"),
"Make sure the identifier is valid" : MessageLookupByLibrary.simpleMessage("Make sure the identifier is valid"),
"Message will be removed for all participants" : MessageLookupByLibrary.simpleMessage("Message will be removed for all participants"),
"Moderator" : MessageLookupByLibrary.simpleMessage("Moderator"),
"Monday" : MessageLookupByLibrary.simpleMessage("Monday"),
"Mute chat" : MessageLookupByLibrary.simpleMessage("Mute chat"),
"New message in FluffyChat" : MessageLookupByLibrary.simpleMessage("New message in FluffyChat"),
"New private chat" : MessageLookupByLibrary.simpleMessage("New private chat"),
"No rooms found..." : MessageLookupByLibrary.simpleMessage("No rooms found..."),
"Not supported in web" : MessageLookupByLibrary.simpleMessage("Not supported in web"),
"Oops something went wrong..." : MessageLookupByLibrary.simpleMessage("Oops something went wrong..."),
"Open camera" : MessageLookupByLibrary.simpleMessage("Open camera"),
"Password" : MessageLookupByLibrary.simpleMessage("Password"),
"Please choose a username" : MessageLookupByLibrary.simpleMessage("Please choose a username"),
"Please enter a matrix identifier" : MessageLookupByLibrary.simpleMessage("Please enter a matrix identifier"),
"Please enter your password" : MessageLookupByLibrary.simpleMessage("Please enter your password"),
"Please enter your username" : MessageLookupByLibrary.simpleMessage("Please enter your username"),
"Rejoin" : MessageLookupByLibrary.simpleMessage("Rejoin"),
"Remove" : MessageLookupByLibrary.simpleMessage("Remove"),
"Remove exile" : MessageLookupByLibrary.simpleMessage("Remove exile"),
"Remove message" : MessageLookupByLibrary.simpleMessage("Remove message"),
"Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Revoke all permissions"),
"Saturday" : MessageLookupByLibrary.simpleMessage("Saturday"),
"Search for a chat" : MessageLookupByLibrary.simpleMessage("Search for a chat"),
"Secure your account with a password" : MessageLookupByLibrary.simpleMessage("Secure your account with a password"),
"Send a message" : MessageLookupByLibrary.simpleMessage("Send a message"),
"Send file" : MessageLookupByLibrary.simpleMessage("Send file"),
"Send image" : MessageLookupByLibrary.simpleMessage("Send image"),
"Set a profile picture" : MessageLookupByLibrary.simpleMessage("Set a profile picture"),
"Set group description" : MessageLookupByLibrary.simpleMessage("Set group description"),
"Set invitation link" : MessageLookupByLibrary.simpleMessage("Set invitation link"),
"Settings" : MessageLookupByLibrary.simpleMessage("Settings"),
"Share" : MessageLookupByLibrary.simpleMessage("Share"),
"Sign up" : MessageLookupByLibrary.simpleMessage("Sign up"),
"Source code" : MessageLookupByLibrary.simpleMessage("Source code"),
"Start your first chat :-)" : MessageLookupByLibrary.simpleMessage("Start your first chat :-)"),
"Sunday" : MessageLookupByLibrary.simpleMessage("Sunday"),
"Tap to show menu" : MessageLookupByLibrary.simpleMessage("Tap to show menu"),
"This room has been archived." : MessageLookupByLibrary.simpleMessage("This room has been archived."),
"Thursday" : MessageLookupByLibrary.simpleMessage("Thursday"),
"Try to send again" : MessageLookupByLibrary.simpleMessage("Try to send again"),
"Tuesday" : MessageLookupByLibrary.simpleMessage("Tuesday"),
"Unmute chat" : MessageLookupByLibrary.simpleMessage("Unmute chat"),
"Username" : MessageLookupByLibrary.simpleMessage("Username"),
"Visibility of the chat history" : MessageLookupByLibrary.simpleMessage("Visibility of the chat history"),
"Visible for all participants" : MessageLookupByLibrary.simpleMessage("Visible for all participants"),
"Visible for everyone" : MessageLookupByLibrary.simpleMessage("Visible for everyone"),
"Wednesday" : MessageLookupByLibrary.simpleMessage("Wednesday"),
"Who is allowed to join this group" : MessageLookupByLibrary.simpleMessage("Who is allowed to join this group"),
"Write a message..." : MessageLookupByLibrary.simpleMessage("Write a message..."),
"You" : MessageLookupByLibrary.simpleMessage("You"),
"You are invited to this chat" : MessageLookupByLibrary.simpleMessage("You are invited to this chat"),
"You are no longer participating in this chat" : MessageLookupByLibrary.simpleMessage("You are no longer participating in this chat"),
"You cannot invite yourself" : MessageLookupByLibrary.simpleMessage("You cannot invite yourself"),
"You have been banned from this chat" : MessageLookupByLibrary.simpleMessage("You have been banned from this chat"),
"Your own username" : MessageLookupByLibrary.simpleMessage("Your own username"),
"acceptedTheInvitation" : m0,
"activatedEndToEndEncryption" : m1,
"alias" : MessageLookupByLibrary.simpleMessage("alias"),
"bannedUser" : m2,
"changedTheChatAvatar" : m3,
"changedTheChatDescriptionTo" : m4,
"changedTheChatNameTo" : m5,
"changedTheChatPermissions" : m6,
"changedTheDisplaynameTo" : m7,
"changedTheGuestAccessRules" : m8,
"changedTheGuestAccessRulesTo" : m9,
"changedTheHistoryVisibility" : m10,
"changedTheHistoryVisibilityTo" : m11,
"changedTheJoinRules" : m12,
"changedTheJoinRulesTo" : m13,
"changedTheProfileAvatar" : m14,
"changedTheRoomAliases" : m15,
"changedTheRoomInvitationLink" : m16,
"countParticipants" : m17,
"createdTheChat" : m18,
"dateAndTimeOfDay" : m19,
"dateWithYear" : m20,
"dateWithoutYear" : m21,
"download" : m22,
"groupWith" : m23,
"hasWithdrawnTheInvitationFor" : m24,
"inviteContactToGroup" : m25,
"invitedUser" : m26,
"is typing..." : MessageLookupByLibrary.simpleMessage("is typing..."),
"joinedTheChat" : m27,
"kicked" : m28,
"kickedAndBanned" : m29,
"loadCountMoreParticipants" : m30,
"play" : m31,
"redactedAnEvent" : m32,
"rejectedTheInvitation" : m33,
"removedBy" : m34,
"seenByUser" : m35,
"seenByUserAndCountOthers" : m36,
"seenByUserAndUser" : m37,
"sentAFile" : m38,
"sentAPicture" : m39,
"sentASticker" : m40,
"sentAVideo" : m41,
"sentAnAudio" : m42,
"sharedTheLocation" : m43,
"timeOfDay" : m44,
"title" : MessageLookupByLibrary.simpleMessage("FluffyChat"),
"unbannedUser" : m45,
"unknownEvent" : m46,
"unreadMessages" : m47,
"unreadMessagesInChats" : m48,
"userAndOthersAreTyping" : m49,
"userAndUserAreTyping" : m50,
"userIsTyping" : m51,
"userLeftTheChat" : m52,
"userSentUnknownEvent" : m53
};
}

View file

@ -1,4 +1,5 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/views/sign_up.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -48,6 +49,7 @@ class App extends StatelessWidget {
),
),
localizationsDelegates: [
AppLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,

View file

@ -1,15 +1,8 @@
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
/// Provides extra functionality for formatting the time.
extension DateTimeExtension on DateTime {
@Deprecated('Use [millisecondsSinceEpoch] instead.')
num toTimeStamp() => this.millisecondsSinceEpoch;
@deprecated
String toTimeString() => localizedTimeOfDay(null);
@deprecated
String toEventTimeString() => localizedTime(null);
operator <(DateTime other) {
return this.millisecondsSinceEpoch < other.millisecondsSinceEpoch;
}
@ -41,7 +34,8 @@ extension DateTimeExtension on DateTime {
/// Returns a simple time String.
/// TODO: Add localization
String localizedTimeOfDay(BuildContext context) {
return "${_z(this.hour % 12)}:${_z(this.minute)} ${this.hour > 11 ? 'pm' : 'am'}";
return I18n.of(context).timeOfDay(_z(this.hour % 12), _z(this.hour),
_z(this.minute), this.hour > 11 ? 'pm' : 'am');
}
/// Returns [localizedTimeOfDay()] if the ChatTime is today, the name of the week
@ -63,24 +57,29 @@ extension DateTimeExtension on DateTime {
} else if (sameWeek) {
switch (this.weekday) {
case 1:
return "Monday";
return I18n.of(context).monday;
case 2:
return "Tuesday";
return I18n.of(context).tuesday;
case 3:
return "Wednesday";
return I18n.of(context).wednesday;
case 4:
return "Thursday";
return I18n.of(context).thursday;
case 5:
return "Friday";
return I18n.of(context).friday;
case 6:
return "Saturday";
return I18n.of(context).saturday;
case 7:
return "Sunday";
return I18n.of(context).sunday;
}
} else if (sameYear) {
return "${this.month.toString().padLeft(2, '0')}-${this.day.toString().padLeft(2, '0')}";
return I18n.of(context).dateWithoutYear(
this.month.toString().padLeft(2, '0'),
this.day.toString().padLeft(2, '0'));
}
return "${this.year.toString()}-${this.month.toString().padLeft(2, '0')}-${this.day.toString().padLeft(2, '0')}";
return I18n.of(context).dateWithYear(
this.year.toString(),
this.month.toString().padLeft(2, '0'),
this.day.toString().padLeft(2, '0'));
}
/// If the DateTime is today, this returns [localizedTimeOfDay()], if not it also
@ -94,7 +93,8 @@ extension DateTimeExtension on DateTime {
bool sameDay = sameYear && now.month == this.month && now.day == this.day;
if (sameDay) return localizedTimeOfDay(context);
return "${localizedTimeShort(context)}, ${localizedTimeOfDay(context)}";
return I18n.of(context).dateAndTimeOfDay(
localizedTimeShort(context), localizedTimeOfDay(context));
}
static String _z(int i) => i < 10 ? "0${i.toString()}" : i.toString();

View file

@ -1,4 +1,5 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
import 'room_state_enums_extensions.dart';
@ -14,25 +15,27 @@ extension LocalizedBody on Event {
getLocalizedBody(BuildContext context,
{bool withSenderNamePrefix = false, hideQuotes = false}) {
if (this.redacted) {
return "Removed by ${this.redactedBecause.sender.calcDisplayname()}";
return I18n.of(context)
.removedBy(redactedBecause.sender.calcDisplayname());
}
String localizedBody = body;
final String senderName = this.sender.calcDisplayname();
switch (this.type) {
case EventTypes.Sticker:
localizedBody = "$senderName sent a sticker";
localizedBody = I18n.of(context).sentASticker(senderName);
break;
case EventTypes.Redaction:
localizedBody = "$senderName redacted an event";
localizedBody = I18n.of(context).redactedAnEvent(senderName);
break;
case EventTypes.RoomAliases:
localizedBody = "$senderName changed the room aliases";
localizedBody = I18n.of(context).changedTheRoomAliases(senderName);
break;
case EventTypes.RoomCanonicalAlias:
localizedBody = "$senderName changed the room invite link";
localizedBody =
I18n.of(context).changedTheRoomInvitationLink(senderName);
break;
case EventTypes.RoomCreate:
localizedBody = "$senderName created the room";
localizedBody = I18n.of(context).createdTheChat(senderName);
break;
case EventTypes.RoomJoinRules:
JoinRules joinRules = JoinRules.values.firstWhere(
@ -41,10 +44,10 @@ extension LocalizedBody on Event {
content["join_rule"],
orElse: () => null);
if (joinRules == null) {
localizedBody = "$senderName changed the join rules";
localizedBody = I18n.of(context).changedTheJoinRules(senderName);
} else {
localizedBody =
"$senderName changed the join rules to: ${joinRules.getLocalizedString(context)}";
localizedBody = I18n.of(context).changedTheJoinRulesTo(
senderName, joinRules.getLocalizedString(context));
}
break;
case EventTypes.RoomMember:
@ -58,35 +61,36 @@ extension LocalizedBody on Event {
: "";
if (newMembership != oldMembership) {
if (oldMembership == "invite" && newMembership == "join") {
text = "$targetName has accepted the invitation";
text = I18n.of(context).acceptedTheInvitation(targetName);
} else if (oldMembership == "invite" && newMembership == "leave") {
if (this.stateKey == this.senderId) {
text = "$targetName has rejected the invitation";
text = I18n.of(context).rejectedTheInvitation(targetName);
} else {
text = "$senderName has withdrawn the invitation for $targetName";
text = I18n.of(context)
.hasWithdrawnTheInvitationFor(senderName, targetName);
}
} else if (oldMembership == "leave" && newMembership == "join") {
text = "$targetName has joined the chat";
text = I18n.of(context).joinedTheChat(targetName);
} else if (oldMembership == "join" && newMembership == "ban") {
text = "$senderName has kicked and banned $targetName";
text = I18n.of(context).kickedAndBanned(senderName, targetName);
} else if (oldMembership == "join" &&
newMembership == "leave" &&
this.stateKey != this.senderId) {
text = "$senderName has kicked $targetName";
text = I18n.of(context).kicked(senderName, targetName);
} else if (oldMembership == "join" &&
newMembership == "leave" &&
this.stateKey == this.senderId) {
text = "$senderName has left the room";
text = I18n.of(context).userLeftTheChat(targetName);
} else if (oldMembership == "invite" && newMembership == "ban") {
text = "$senderName has banned $targetName";
text = I18n.of(context).bannedUser(senderName, targetName);
} else if (oldMembership == "leave" && newMembership == "ban") {
text = "$senderName has banned $targetName";
text = I18n.of(context).bannedUser(senderName, targetName);
} else if (oldMembership == "ban" && newMembership == "leave") {
text = "$senderName has unbanned $targetName";
text = I18n.of(context).unbannedUser(senderName, targetName);
} else if (newMembership == "invite") {
text = "$senderName has invited $targetName";
text = I18n.of(context).invitedUser(senderName, targetName);
} else if (newMembership == "join") {
text = "$targetName has joined";
text = I18n.of(context).joinedTheChat(targetName);
}
} else if (newMembership == "join") {
final String newAvatar = this.content["avatar_url"] ?? "";
@ -103,29 +107,29 @@ extension LocalizedBody on Event {
// Has the user avatar changed?
if (newAvatar != oldAvatar) {
text = "$targetName has changed the profile avatar";
text = I18n.of(context).changedTheProfileAvatar(targetName);
}
// Has the user avatar changed?
else if (newDisplayname != oldDisplayname) {
text =
"${this.stateKeyUser.id} has changed the displayname to '$newDisplayname'";
text = I18n.of(context)
.changedTheDisplaynameTo(targetName, newDisplayname);
}
}
localizedBody = text;
break;
case EventTypes.RoomPowerLevels:
localizedBody = "$senderName changed the group permissions";
localizedBody = I18n.of(context).changedTheChatPermissions(senderName);
break;
case EventTypes.RoomName:
localizedBody =
"$senderName changed the group name to: '${content["name"]}'";
I18n.of(context).changedTheChatNameTo(senderName, content["name"]);
break;
case EventTypes.RoomTopic:
localizedBody =
"$senderName changed the group name to: '${content["topic"]}'";
localizedBody = I18n.of(context)
.changedTheChatDescriptionTo(senderName, content["topic"]);
break;
case EventTypes.RoomAvatar:
localizedBody = "$senderName changed the group avatar";
localizedBody = I18n.of(context).changedTheChatAvatar(senderName);
break;
case EventTypes.GuestAccess:
GuestAccess guestAccess = GuestAccess.values.firstWhere(
@ -134,10 +138,11 @@ extension LocalizedBody on Event {
content["guest_access"],
orElse: () => null);
if (guestAccess == null) {
localizedBody = "$senderName changed the guest access rules";
} else {
localizedBody =
"$senderName changed the guest access rules to: ${guestAccess.getLocalizedString(context)}";
I18n.of(context).changedTheGuestAccessRules(senderName);
} else {
localizedBody = I18n.of(context).changedTheGuestAccessRulesTo(
senderName, guestAccess.getLocalizedString(context));
}
break;
case EventTypes.HistoryVisibility:
@ -148,52 +153,39 @@ extension LocalizedBody on Event {
content["history_visibility"],
orElse: () => null);
if (historyVisibility == null) {
localizedBody = "$senderName changed the history visibility";
} else {
localizedBody =
"$senderName changed the history visibility to: ${historyVisibility.getLocalizedString(context)}";
I18n.of(context).changedTheHistoryVisibility(senderName);
} else {
localizedBody = I18n.of(context).changedTheHistoryVisibilityTo(
senderName, historyVisibility.getLocalizedString(context));
}
break;
case EventTypes.Encryption:
localizedBody = "$senderName activated end to end encryption";
localizedBody =
I18n.of(context).activatedEndToEndEncryption(senderName);
break;
case EventTypes.Encrypted:
localizedBody = "Could not decrypt message";
break;
case EventTypes.CallInvite:
localizedBody = body;
break;
case EventTypes.CallAnswer:
localizedBody = body;
break;
case EventTypes.CallCandidates:
localizedBody = body;
break;
case EventTypes.CallHangup:
localizedBody = body;
break;
case EventTypes.Unknown:
localizedBody = body;
localizedBody = I18n.of(context).couldNotDecryptMessage;
break;
case EventTypes.Message:
switch (this.messageType) {
case MessageTypes.Image:
localizedBody = "$senderName sent a picture";
localizedBody = I18n.of(context).sentAPicture(senderName);
break;
case MessageTypes.File:
localizedBody = "$senderName sent a file";
localizedBody = I18n.of(context).sentAFile(senderName);
break;
case MessageTypes.Audio:
localizedBody = "$senderName sent an audio";
localizedBody = I18n.of(context).sentAnAudio(senderName);
break;
case MessageTypes.Video:
localizedBody = "$senderName sent a video";
localizedBody = I18n.of(context).sentAVideo(senderName);
break;
case MessageTypes.Location:
localizedBody = "$senderName shared the location";
localizedBody = I18n.of(context).sharedTheLocation(senderName);
break;
case MessageTypes.Sticker:
localizedBody = "$senderName sent a sticker";
localizedBody = I18n.of(context).sentASticker(senderName);
break;
case MessageTypes.Emote:
localizedBody = "* $body";
@ -207,8 +199,7 @@ extension LocalizedBody on Event {
}
break;
default:
localizedBody =
"Unknown event '${this.type.toString().replaceAll("EventTypes.", "")}'";
localizedBody = I18n.of(context).unknownEvent(this.typeKey);
}
// Add the sender name prefix

View file

@ -1,4 +1,5 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
extension LocalizedRoomDisplayname on Room {
@ -7,7 +8,7 @@ extension LocalizedRoomDisplayname on Room {
(this.canonicalAlias?.isEmpty ?? true) &&
!this.isDirectChat &&
this.mHeroes.isNotEmpty) {
return "Group with ${this.displayname}";
return I18n.of(context).groupWith(this.displayname);
}
return this.displayname;
}

View file

@ -1,17 +1,18 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
extension HistoryVisibilityDisplayString on HistoryVisibility {
String getLocalizedString(BuildContext context) {
switch (this) {
case HistoryVisibility.invited:
return "From the invitation";
return I18n.of(context).fromTheInvitation;
case HistoryVisibility.joined:
return "From joining";
return I18n.of(context).fromJoining;
case HistoryVisibility.shared:
return "Visible for all participants";
return I18n.of(context).visibleForAllParticipants;
case HistoryVisibility.world_readable:
return "Visible for everyone";
return I18n.of(context).visibleForEveryone;
default:
return this.toString().replaceAll("HistoryVisibility.", "");
}
@ -22,9 +23,9 @@ extension GuestAccessDisplayString on GuestAccess {
String getLocalizedString(BuildContext context) {
switch (this) {
case GuestAccess.can_join:
return "Guests can join";
return I18n.of(context).guestsCanJoin;
case GuestAccess.forbidden:
return "Guests are forbidden";
return I18n.of(context).guestsAreForbidden;
default:
return this.toString().replaceAll("GuestAccess.", "");
}
@ -35,9 +36,9 @@ extension JoinRulesDisplayString on JoinRules {
String getLocalizedString(BuildContext context) {
switch (this) {
case JoinRules.public:
return "Anyone can join";
return I18n.of(context).anyoneCanJoin;
case JoinRules.invite:
return "Invited users only";
return I18n.of(context).invitedUsersOnly;
default:
return this.toString().replaceAll("JoinRules.", "");
}

View file

@ -2,6 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/components/list_items/chat_list_item.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
class Archive extends StatefulWidget {
@ -22,7 +23,7 @@ class _ArchiveState extends State<Archive> {
return AdaptivePageLayout(
firstScaffold: Scaffold(
appBar: AppBar(
title: Text("Archive"),
title: Text(I18n.of(context).archive),
),
body: FutureBuilder<List<Room>>(
future: getArchive(context),

View file

@ -1,4 +1,5 @@
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
@ -16,7 +17,7 @@ class AuthWebView extends StatelessWidget {
print(url);
return Scaffold(
appBar: AppBar(
title: Text("Authentication"),
title: Text(I18n.of(context).authentication),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {

View file

@ -7,6 +7,7 @@ import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/components/chat_settings_popup_menu.dart';
import 'package:fluffychat/components/list_items/message.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/room_extension.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -61,13 +62,16 @@ class _ChatState extends State<Chat> {
r.user.id == room.client.userID ||
r.user.id == timeline.events.first.senderId);
if (lastReceipts.length == 1) {
seenByText = "Seen by ${lastReceipts.first.user.calcDisplayname()}";
seenByText = I18n.of(context)
.seenByUser(lastReceipts.first.user.calcDisplayname());
} else if (lastReceipts.length == 2) {
seenByText =
"Seen by ${lastReceipts.first.user.calcDisplayname()} and ${lastReceipts[1].user.calcDisplayname()}";
seenByText = seenByText = I18n.of(context).seenByUserAndUser(
lastReceipts.first.user.calcDisplayname(),
lastReceipts[1].user.calcDisplayname());
} else if (lastReceipts.length > 2) {
seenByText =
"Seen by ${lastReceipts.first.user.calcDisplayname()} and ${lastReceipts.length - 1} others";
seenByText = I18n.of(context).seenByUserAndCountOthers(
lastReceipts.first.user.calcDisplayname(),
(lastReceipts.length - 1).toString());
}
}
setState(() {
@ -98,7 +102,7 @@ class _ChatState extends State<Chat> {
void sendFileAction(BuildContext context) async {
if (kIsWeb) {
return Toast.show("Not supported in web", context);
return Toast.show(I18n.of(context).notSupportedInWeb, context);
}
File file = await FilePicker.getFile();
if (file == null) return;
@ -111,7 +115,7 @@ class _ChatState extends State<Chat> {
void sendImageAction(BuildContext context) async {
if (kIsWeb) {
return Toast.show("Not supported in web", context);
return Toast.show(I18n.of(context).notSupportedInWeb, context);
}
File file = await ImagePicker.pickImage(
source: ImageSource.gallery,
@ -128,7 +132,7 @@ class _ChatState extends State<Chat> {
void openCameraAction(BuildContext context) async {
if (kIsWeb) {
return Toast.show("Not supported in web", context);
return Toast.show(I18n.of(context).notSupportedInWeb, context);
}
File file = await ImagePicker.pickImage(
source: ImageSource.camera,
@ -149,8 +153,13 @@ class _ChatState extends State<Chat> {
Client client = matrix.client;
room ??= client.getRoomById(widget.id);
if (room == null) {
return Center(
child: Text("You are no longer participating in this chat"),
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).oopsSomethingWentWrong),
),
body: Center(
child: Text(I18n.of(context).youAreNoLongerParticipatingInThisChat),
),
);
}
matrix.activeRoomId = widget.id;
@ -164,16 +173,19 @@ class _ChatState extends State<Chat> {
typingUsers.removeWhere((User u) => u.id == client.userID);
if (typingUsers.length == 1) {
typingText = "is typing...";
typingText = I18n.of(context).isTyping;
if (typingUsers.first.id != room.directChatMatrixID) {
typingText = typingUsers.first.calcDisplayname() + " " + typingText;
typingText =
I18n.of(context).userIsTyping(typingUsers.first.calcDisplayname());
}
} else if (typingUsers.length == 2) {
typingText =
"${typingUsers.first.calcDisplayname()} and ${typingUsers[1].calcDisplayname()} are typing...";
typingText = I18n.of(context).userAndUserAreTyping(
typingUsers.first.calcDisplayname(),
typingUsers[1].calcDisplayname());
} else if (typingUsers.length > 2) {
typingText =
"${typingUsers.first.calcDisplayname()} and ${typingUsers.length - 1} others are typing...";
typingText = I18n.of(context).userAndOthersAreTyping(
typingUsers.first.calcDisplayname(),
(typingUsers.length - 1).toString());
}
return AdaptivePageLayout(
@ -298,7 +310,7 @@ class _ChatState extends State<Chat> {
},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
const PopupMenuItem<String>(
PopupMenuItem<String>(
value: "file",
child: ListTile(
leading: CircleAvatar(
@ -306,11 +318,11 @@ class _ChatState extends State<Chat> {
foregroundColor: Colors.white,
child: Icon(Icons.attachment),
),
title: Text('Send file'),
title: Text(I18n.of(context).sendFile),
contentPadding: EdgeInsets.all(0),
),
),
const PopupMenuItem<String>(
PopupMenuItem<String>(
value: "image",
child: ListTile(
leading: CircleAvatar(
@ -318,11 +330,11 @@ class _ChatState extends State<Chat> {
foregroundColor: Colors.white,
child: Icon(Icons.image),
),
title: Text('Send image'),
title: Text(I18n.of(context).sendImage),
contentPadding: EdgeInsets.all(0),
),
),
const PopupMenuItem<String>(
PopupMenuItem<String>(
value: "camera",
child: ListTile(
leading: CircleAvatar(
@ -330,7 +342,8 @@ class _ChatState extends State<Chat> {
foregroundColor: Colors.white,
child: Icon(Icons.camera),
),
title: Text('Open camera'),
title:
Text(I18n.of(context).openCamera),
contentPadding: EdgeInsets.all(0),
),
),
@ -349,7 +362,7 @@ class _ChatState extends State<Chat> {
onSubmitted: (t) => send(),
controller: sendController,
decoration: InputDecoration(
hintText: "Write a message...",
hintText: I18n.of(context).writeAMessage,
border: InputBorder.none,
),
onChanged: (String text) {

View file

@ -7,6 +7,7 @@ import 'package:fluffychat/components/chat_settings_popup_menu.dart';
import 'package:fluffychat/components/content_banner.dart';
import 'package:fluffychat/components/list_items/participant_list_item.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/utils/room_extension.dart';
import 'package:fluffychat/utils/room_state_enums_extensions.dart';
@ -37,7 +38,7 @@ class _ChatDetailsState extends State<ChatDetails> {
);
if (success != false) {
Toast.show(
"Displayname has been changed",
I18n.of(context).displaynameHasBeenChanged,
context,
duration: Toast.LENGTH_LONG,
);
@ -86,7 +87,7 @@ class _ChatDetailsState extends State<ChatDetails> {
);
if (success != false) {
Toast.show(
"Group description has been changed",
I18n.of(context).groupDescriptionHasBeenChanged,
context,
duration: Toast.LENGTH_LONG,
);
@ -111,7 +112,7 @@ class _ChatDetailsState extends State<ChatDetails> {
);
if (success != false) {
Toast.show(
"Avatar has been changed",
I18n.of(context).avatarHasBeenChanged,
context,
duration: Toast.LENGTH_LONG,
);
@ -135,8 +136,13 @@ class _ChatDetailsState extends State<ChatDetails> {
@override
Widget build(BuildContext context) {
if (widget.room == null) {
return Center(
child: Text("You are no longer participating in this chat"),
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).oopsSomethingWentWrong),
),
body: Center(
child: Text(I18n.of(context).youAreNoLongerParticipatingInThisChat),
),
);
}
members ??= widget.room.getParticipants();
@ -161,7 +167,7 @@ class _ChatDetailsState extends State<ChatDetails> {
Clipboard.setData(
ClipboardData(text: widget.room.canonicalAlias),
);
Toast.show("Invitation link copied to clipboard", context,
Toast.show(I18n.of(context).copiedToClipboard, context,
duration: 5);
},
),
@ -189,12 +195,13 @@ class _ChatDetailsState extends State<ChatDetails> {
maxLines: 4,
decoration: InputDecoration(
border: InputBorder.none,
labelText: "Group description:",
labelText:
"${I18n.of(context).groupDescription}:",
labelStyle: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold),
hintText: widget.room.topic ??
"Set group description",
I18n.of(context).setGroupDescription,
),
),
)
@ -212,7 +219,7 @@ class _ChatDetailsState extends State<ChatDetails> {
fontWeight: FontWeight.bold)),
subtitle: LinkText(
text: widget.room.topic?.isEmpty ?? true
? "Add a group description"
? I18n.of(context).addGroupDescription
: widget.room.topic,
linkStyle: TextStyle(color: Colors.blueAccent),
textStyle: TextStyle(
@ -227,7 +234,7 @@ class _ChatDetailsState extends State<ChatDetails> {
Divider(thickness: 8),
ListTile(
title: Text(
"Settings",
I18n.of(context).settings,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
@ -246,7 +253,7 @@ class _ChatDetailsState extends State<ChatDetails> {
onSubmitted: (s) => setDisplaynameAction(context, s),
decoration: InputDecoration(
border: InputBorder.none,
labelText: "Change the name of the group",
labelText: I18n.of(context).changeTheNameOfTheGroup,
labelStyle: TextStyle(color: Colors.black),
hintText:
widget.room.getLocalizedDisplayname(context),
@ -267,11 +274,11 @@ class _ChatDetailsState extends State<ChatDetails> {
setCanonicalAliasAction(context, s),
decoration: InputDecoration(
border: InputBorder.none,
labelText: "Set invitation link",
labelText: I18n.of(context).setInvitationLink,
labelStyle: TextStyle(color: Colors.black),
hintText: widget.room.canonicalAlias
?.replaceAll("#", "") ??
"alias",
I18n.of(context).alias,
prefixText: "#",
suffixText: widget.room.client.userID.split(":")[1],
),
@ -283,7 +290,8 @@ class _ChatDetailsState extends State<ChatDetails> {
backgroundColor: Colors.white,
foregroundColor: Colors.grey,
child: Icon(Icons.public)),
title: Text("Who is allowed to join this group"),
title:
Text(I18n.of(context).whoIsAllowedToJoinThisGroup),
subtitle: Text(
widget.room.joinRules.getLocalizedString(context),
),
@ -315,7 +323,8 @@ class _ChatDetailsState extends State<ChatDetails> {
foregroundColor: Colors.grey,
child: Icon(Icons.visibility),
),
title: Text("Visibility of the chat history"),
title:
Text(I18n.of(context).visibilityOfTheChatHistory),
subtitle: Text(
widget.room.historyVisibility
.getLocalizedString(context),
@ -361,7 +370,7 @@ class _ChatDetailsState extends State<ChatDetails> {
foregroundColor: Colors.grey,
child: Icon(Icons.info_outline),
),
title: Text("Are guest users allowed to join"),
title: Text(I18n.of(context).areGuestsAllowedToJoin),
subtitle: Text(
widget.room.guestAccess.getLocalizedString(context),
),
@ -393,8 +402,10 @@ class _ChatDetailsState extends State<ChatDetails> {
Divider(thickness: 8),
ListTile(
title: Text(
"$actualMembersCount participant" +
(actualMembersCount > 1 ? "s:" : ":"),
actualMembersCount > 1
? I18n.of(context).countParticipants(
actualMembersCount.toString())
: I18n.of(context).emptyChat,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
@ -404,7 +415,7 @@ class _ChatDetailsState extends State<ChatDetails> {
Divider(height: 1),
widget.room.canInvite
? ListTile(
title: Text("Invite contact"),
title: Text(I18n.of(context).inviteContact),
leading: CircleAvatar(
child: Icon(Icons.add),
backgroundColor: Theme.of(context).primaryColor,
@ -423,8 +434,8 @@ class _ChatDetailsState extends State<ChatDetails> {
: i < members.length + 1
? ParticipantListItem(members[i - 1])
: ListTile(
title: Text(
"Load more ${actualMembersCount - members.length} participants"),
title: Text(I18n.of(context).loadCountMoreParticipants(
(actualMembersCount - members.length).toString())),
leading: CircleAvatar(
backgroundColor: Colors.white,
child: Icon(

View file

@ -6,6 +6,7 @@ import 'package:fluffychat/components/dialogs/new_group_dialog.dart';
import 'package:fluffychat/components/dialogs/new_private_chat_dialog.dart';
import 'package:fluffychat/components/list_items/chat_list_item.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/utils/url_launcher.dart';
import 'package:fluffychat/views/archive.dart';
@ -112,11 +113,13 @@ class _ChatListState extends State<ChatList> {
controller: searchController,
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Search for a chat",
hintText: I18n.of(context).searchForAChat,
),
)
: Text(
selectMode == SelectMode.share ? "Share" : "FluffyChat",
selectMode == SelectMode.share
? I18n.of(context).share
: I18n.of(context).fluffychat,
),
leading: searchMode
? IconButton(
@ -166,13 +169,13 @@ class _ChatListState extends State<ChatList> {
},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
const PopupMenuItem<String>(
PopupMenuItem<String>(
value: "archive",
child: Text('Archive'),
child: Text(I18n.of(context).archive),
),
const PopupMenuItem<String>(
PopupMenuItem<String>(
value: "settings",
child: Text('Settings'),
child: Text(I18n.of(context).settings),
),
],
),
@ -185,7 +188,7 @@ class _ChatListState extends State<ChatList> {
SpeedDialChild(
child: Icon(Icons.people_outline),
backgroundColor: Colors.blue,
label: 'Create new group',
label: I18n.of(context).createNewGroup,
labelStyle: TextStyle(fontSize: 18.0),
onTap: () => showDialog(
context: context,
@ -195,7 +198,7 @@ class _ChatListState extends State<ChatList> {
SpeedDialChild(
child: Icon(Icons.person_add),
backgroundColor: Colors.green,
label: 'New private chat',
label: I18n.of(context).newPrivateChat,
labelStyle: TextStyle(fontSize: 18.0),
onTap: () => showDialog(
context: context,
@ -224,8 +227,8 @@ class _ChatListState extends State<ChatList> {
color: Colors.grey,
),
Text(searchMode
? "No rooms found..."
: "Start your first chat :-)"),
? I18n.of(context).noRoomsFound
: I18n.of(context).startYourFirstChat),
],
),
);

View file

@ -1,5 +1,6 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart';
@ -16,7 +17,7 @@ class ContentWebView extends StatelessWidget {
return Scaffold(
appBar: AppBar(
title: Text(
"Content viewer",
I18n.of(context).contentViewer,
),
actions: <Widget>[
IconButton(

View file

@ -2,6 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/components/avatar.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
import 'package:toast/toast.dart';
@ -39,7 +40,7 @@ class InvitationSelection extends StatelessWidget {
);
if (success != false) {
Toast.show(
"Contact has been invited to the group.",
I18n.of(context).contactHasBeenInvitedToTheGroup,
context,
duration: Toast.LENGTH_LONG,
);
@ -48,13 +49,14 @@ class InvitationSelection extends StatelessWidget {
@override
Widget build(BuildContext context) {
final String groupName = room.name?.isEmpty ?? false ? "group" : room.name;
final String groupName =
room.name?.isEmpty ?? false ? I18n.of(context).group : room.name;
return AdaptivePageLayout(
primaryPage: FocusPage.SECOND,
firstScaffold: ChatList(activeChat: room.id),
secondScaffold: Scaffold(
appBar: AppBar(
title: Text("Invite contact to $groupName"),
title: Text(I18n.of(context).inviteContactToGroup(groupName)),
),
body: FutureBuilder<List<User>>(
future: getContacts(context),

View file

@ -2,6 +2,7 @@ import 'dart:math';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:flutter/material.dart';
@ -26,12 +27,12 @@ class _LoginState extends State<Login> {
void login(BuildContext context) async {
MatrixState matrix = Matrix.of(context);
if (usernameController.text.isEmpty) {
setState(() => usernameError = "Please enter your username.");
setState(() => usernameError = I18n.of(context).pleaseEnterYourUsername);
} else {
setState(() => usernameError = null);
}
if (passwordController.text.isEmpty) {
setState(() => passwordError = "Please enter your password.");
setState(() => passwordError = I18n.of(context).pleaseEnterYourPassword);
} else {
setState(() => passwordError = null);
}
@ -51,12 +52,13 @@ class _LoginState extends State<Login> {
print("[Login] Check server...");
setState(() => loading = true);
if (!await matrix.client.checkServer(homeserver)) {
setState(() => serverError = "Homeserver is not compatible.");
setState(
() => serverError = I18n.of(context).homeserverIsNotCompatible);
return setState(() => loading = false);
}
} catch (exception) {
setState(() => serverError = "Connection attempt failed!");
setState(() => serverError = I18n.of(context).connectionAttemptFailed);
return setState(() => loading = false);
}
try {
@ -93,6 +95,7 @@ class _LoginState extends State<Login> {
return Scaffold(
appBar: AppBar(
title: TextField(
autocorrect: false,
controller: serverController,
decoration: InputDecoration(
icon: Icon(Icons.domain),
@ -125,11 +128,13 @@ class _LoginState extends State<Login> {
child: Icon(Icons.account_box),
),
title: TextField(
autocorrect: false,
controller: usernameController,
decoration: InputDecoration(
hintText: "@username:domain",
hintText:
"@${I18n.of(context).username.toLowerCase()}:domain",
errorText: usernameError,
labelText: "Username"),
labelText: I18n.of(context).username),
),
),
ListTile(
@ -138,6 +143,7 @@ class _LoginState extends State<Login> {
child: Icon(Icons.lock),
),
title: TextField(
autocorrect: false,
controller: passwordController,
obscureText: !showPassword,
onSubmitted: (t) => login(context),
@ -150,7 +156,7 @@ class _LoginState extends State<Login> {
onPressed: () =>
setState(() => showPassword = !showPassword),
),
labelText: "Password"),
labelText: I18n.of(context).password),
),
),
SizedBox(height: 20),
@ -165,7 +171,7 @@ class _LoginState extends State<Login> {
child: loading
? CircularProgressIndicator()
: Text(
"Login",
I18n.of(context).login,
style: TextStyle(color: Colors.white, fontSize: 16),
),
onPressed: () => loading ? null : login(context),

View file

@ -4,6 +4,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/components/content_banner.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/chat_list.dart';
import 'package:fluffychat/views/sign_up.dart';
@ -47,7 +48,7 @@ class _SettingsState extends State<Settings> {
);
if (success != null && success.isEmpty) {
Toast.show(
"Displayname has been changed",
I18n.of(context).displaynameHasBeenChanged,
context,
duration: Toast.LENGTH_LONG,
);
@ -77,7 +78,7 @@ class _SettingsState extends State<Settings> {
print(success);
if (success != false) {
Toast.show(
"Avatar has been changed",
I18n.of(context).avatarHasBeenChanged,
context,
duration: Toast.LENGTH_LONG,
);
@ -97,7 +98,7 @@ class _SettingsState extends State<Settings> {
});
return Scaffold(
appBar: AppBar(
title: Text("Settings"),
title: Text(I18n.of(context).settings),
),
body: ListView(
children: <Widget>[
@ -115,7 +116,7 @@ class _SettingsState extends State<Settings> {
onSubmitted: (s) => setDisplaynameAction(context, s),
decoration: InputDecoration(
border: InputBorder.none,
labelText: "Edit displayname",
labelText: I18n.of(context).editDisplayname,
labelStyle: TextStyle(color: Colors.black),
hintText: (profile?.displayname ?? ""),
),
@ -124,37 +125,46 @@ class _SettingsState extends State<Settings> {
Divider(thickness: 8),
ListTile(
title: Text(
"About",
I18n.of(context).about,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
),
),
),
ListTile(
leading: Icon(Icons.sentiment_very_satisfied),
title: Text(I18n.of(context).donate),
onTap: () => launch("https://ko-fi.com/krille"),
),
ListTile(
leading: Icon(Icons.help),
title: Text("Help"),
title: Text(I18n.of(context).help),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter/issues")),
"https://gitlab.com/ChristianPauly/fluffychat-flutter/issues"),
),
ListTile(
leading: Icon(Icons.list),
title: Text("Changelog"),
title: Text(I18n.of(context).changelog),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter/blob/master/CHANGELOG.md")),
"https://gitlab.com/ChristianPauly/fluffychat-flutter/blob/master/CHANGELOG.md"),
),
ListTile(
leading: Icon(Icons.link),
title: Text("License"),
title: Text(I18n.of(context).license),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter/raw/master/LICENSE")),
"https://gitlab.com/ChristianPauly/fluffychat-flutter/raw/master/LICENSE"),
),
ListTile(
leading: Icon(Icons.code),
title: Text("Source code"),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter")),
title: Text(I18n.of(context).sourceCode),
onTap: () =>
launch("https://gitlab.com/ChristianPauly/fluffychat-flutter"),
),
Divider(thickness: 8),
ListTile(
title: Text(
"Logout",
I18n.of(context).logout,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
@ -163,7 +173,7 @@ class _SettingsState extends State<Settings> {
),
ListTile(
leading: Icon(Icons.exit_to_app),
title: Text("Logout"),
title: Text(I18n.of(context).logout),
onTap: () => logoutAction(context),
),
],

View file

@ -3,6 +3,7 @@ import 'dart:math';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/login.dart';
import 'package:fluffychat/views/sign_up_password.dart';
@ -37,7 +38,7 @@ class _SignUpState extends State<SignUp> {
void signUpAction(BuildContext context) async {
MatrixState matrix = Matrix.of(context);
if (usernameController.text.isEmpty) {
setState(() => usernameError = "Please choose a username.");
setState(() => usernameError = I18n.of(context).pleaseChooseAUsername);
} else {
setState(() => usernameError = null);
}
@ -60,12 +61,13 @@ class _SignUpState extends State<SignUp> {
print("[Sign Up] Check server...");
setState(() => loading = true);
if (!await matrix.client.checkServer(homeserver)) {
setState(() => serverError = "Homeserver is not compatible.");
setState(
() => serverError = I18n.of(context).homeserverIsNotCompatible);
return setState(() => loading = false);
}
} catch (exception) {
setState(() => serverError = "Connection attempt failed!");
setState(() => serverError = I18n.of(context).connectionAttemptFailed);
return setState(() => loading = false);
}
@ -94,6 +96,7 @@ class _SignUpState extends State<SignUp> {
return Scaffold(
appBar: AppBar(
title: TextField(
autocorrect: false,
controller: serverController,
decoration: InputDecoration(
icon: Icon(Icons.domain),
@ -125,8 +128,9 @@ class _SignUpState extends State<SignUp> {
Icons.close,
color: Colors.red,
),
title: Text(
avatar == null ? "Set a profile picture" : "Discard picture"),
title: Text(avatar == null
? I18n.of(context).setAProfilePicture
: I18n.of(context).discardPicture),
onTap: avatar == null
? setAvatarAction
: () => setState(() => avatar = null),
@ -137,12 +141,13 @@ class _SignUpState extends State<SignUp> {
child: Icon(Icons.account_box),
),
title: TextField(
autocorrect: false,
controller: usernameController,
onSubmitted: (s) => signUpAction(context),
decoration: InputDecoration(
hintText: "Username",
hintText: I18n.of(context).username,
errorText: usernameError,
labelText: "Choose a username"),
labelText: I18n.of(context).chooseAUsername),
),
),
SizedBox(height: 20),
@ -157,7 +162,7 @@ class _SignUpState extends State<SignUp> {
child: loading
? CircularProgressIndicator()
: Text(
"Sign up",
I18n.of(context).signUp,
style: TextStyle(color: Colors.white, fontSize: 16),
),
onPressed: () => signUpAction(context),
@ -166,7 +171,7 @@ class _SignUpState extends State<SignUp> {
Center(
child: FlatButton(
child: Text(
"Already have an account?",
I18n.of(context).alreadyHaveAnAccount,
style: TextStyle(
decoration: TextDecoration.underline,
color: Colors.blue,

View file

@ -3,6 +3,7 @@ import 'dart:math';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/auth_web_view.dart';
import 'package:flutter/material.dart';
@ -28,7 +29,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
void _signUpAction(BuildContext context, {Map<String, dynamic> auth}) async {
MatrixState matrix = Matrix.of(context);
if (passwordController.text.isEmpty) {
setState(() => passwordError = "Please enter your password.");
setState(() => passwordError = I18n.of(context).pleaseEnterYourPassword);
} else {
setState(() => passwordError = null);
}
@ -100,7 +101,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
data: {"displayname": widget.displayname},
);
} catch (exception) {
Toast.show("Could not set displayname", context, duration: 5);
Toast.show(I18n.of(context).couldNotSetDisplayname, context, duration: 5);
}
try {
await matrix.client.setAvatar(
@ -110,7 +111,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
),
);
} catch (exception) {
Toast.show("Could not set profile picture", context, duration: 5);
Toast.show(I18n.of(context).couldNotSetAvatar, context, duration: 5);
}
if (matrix.client.isLogged()) {
await Navigator.of(context).pushAndRemoveUntil(
@ -123,7 +124,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Secure your account with a password"),
title: Text(I18n.of(context).secureYourAccountWithAPassword),
),
body: ListView(
padding: EdgeInsets.symmetric(
@ -161,7 +162,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
onPressed: () =>
setState(() => showPassword = !showPassword),
),
labelText: "Password"),
labelText: I18n.of(context).password),
),
),
SizedBox(height: 20),
@ -176,7 +177,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
child: loading
? CircularProgressIndicator()
: Text(
"Create account now",
I18n.of(context).createAccountNow,
style: TextStyle(color: Colors.white, fontSize: 16),
),
onPressed: () => loading ? null : _signUpAction(context),