Refactoring l10n

This commit is contained in:
Christian Pauly 2020-05-07 07:52:40 +02:00
commit 6f1ed6120f
42 changed files with 287 additions and 287 deletions

View file

@ -1,7 +1,7 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/views/chat_list.dart';
import 'package:flutter/material.dart';
import 'package:olm/olm.dart' as olm;
@ -24,12 +24,12 @@ class AppInfo extends StatelessWidget {
Client client = Matrix.of(context).client;
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).accountInformations),
title: Text(L10n.of(context).accountInformations),
),
body: ListView(
children: <Widget>[
ListTile(
title: Text(I18n.of(context).yourOwnUsername + ":"),
title: Text(L10n.of(context).yourOwnUsername + ":"),
subtitle: Text(client.userID),
),
ListTile(

View file

@ -2,7 +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:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
class Archive extends StatefulWidget {
@ -23,7 +23,7 @@ class _ArchiveState extends State<Archive> {
return AdaptivePageLayout(
firstScaffold: Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).archive),
title: Text(L10n.of(context).archive),
),
body: FutureBuilder<List<Room>>(
future: getArchive(context),

View file

@ -1,5 +1,5 @@
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
@ -19,7 +19,7 @@ class AuthWebView extends StatelessWidget {
if (kIsWeb) launch(url);
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).authentication),
title: Text(L10n.of(context).authentication),
leading: IconButton(
icon: Icon(Icons.close),
onPressed: () {

View file

@ -11,7 +11,7 @@ import 'package:fluffychat/components/encryption_button.dart';
import 'package:fluffychat/components/list_items/message.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/components/reply_content.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -119,14 +119,14 @@ class _ChatState extends State<_Chat> {
r.user.id == room.client.userID ||
r.user.id == timeline.events.first.senderId);
if (lastReceipts.length == 1) {
seenByText = I18n.of(context)
seenByText = L10n.of(context)
.seenByUser(lastReceipts.first.user.calcDisplayname());
} else if (lastReceipts.length == 2) {
seenByText = seenByText = I18n.of(context).seenByUserAndUser(
seenByText = seenByText = L10n.of(context).seenByUserAndUser(
lastReceipts.first.user.calcDisplayname(),
lastReceipts[1].user.calcDisplayname());
} else if (lastReceipts.length > 2) {
seenByText = I18n.of(context).seenByUserAndCountOthers(
seenByText = L10n.of(context).seenByUserAndCountOthers(
lastReceipts.first.user.calcDisplayname(),
(lastReceipts.length - 1).toString());
}
@ -175,7 +175,7 @@ class _ChatState extends State<_Chat> {
void sendFileAction(BuildContext context) async {
if (kIsWeb) {
showToast(I18n.of(context).notSupportedInWeb);
showToast(L10n.of(context).notSupportedInWeb);
return;
}
File file = await FilePicker.getFile();
@ -189,7 +189,7 @@ class _ChatState extends State<_Chat> {
void sendImageAction(BuildContext context) async {
if (kIsWeb) {
showToast(I18n.of(context).notSupportedInWeb);
showToast(L10n.of(context).notSupportedInWeb);
return;
}
File file = await ImagePicker.pickImage(
@ -207,7 +207,7 @@ class _ChatState extends State<_Chat> {
void openCameraAction(BuildContext context) async {
if (kIsWeb) {
showToast(I18n.of(context).notSupportedInWeb);
showToast(L10n.of(context).notSupportedInWeb);
return;
}
File file = await ImagePicker.pickImage(
@ -242,12 +242,12 @@ class _ChatState extends State<_Chat> {
String _getSelectedEventString(BuildContext context) {
String copyString = "";
if (selectedEvents.length == 1) {
return selectedEvents.first.getLocalizedBody(I18n.of(context));
return selectedEvents.first.getLocalizedBody(L10n.of(context));
}
for (Event event in selectedEvents) {
if (copyString.isNotEmpty) copyString += "\n\n";
copyString +=
event.getLocalizedBody(I18n.of(context), withSenderNamePrefix: true);
event.getLocalizedBody(L10n.of(context), withSenderNamePrefix: true);
}
return copyString;
}
@ -259,8 +259,8 @@ class _ChatState extends State<_Chat> {
void redactEventsAction(BuildContext context) async {
bool confirmed = await SimpleDialogs(context).askConfirmation(
titleText: I18n.of(context).messageWillBeRemovedWarning,
confirmText: I18n.of(context).remove,
titleText: L10n.of(context).messageWillBeRemovedWarning,
confirmText: L10n.of(context).remove,
);
if (!confirmed) return;
for (Event event in selectedEvents) {
@ -311,10 +311,10 @@ class _ChatState extends State<_Chat> {
if (room == null) {
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).oopsSomethingWentWrong),
title: Text(L10n.of(context).oopsSomethingWentWrong),
),
body: Center(
child: Text(I18n.of(context).youAreNoLongerParticipatingInThisChat),
child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
),
);
}
@ -329,17 +329,17 @@ class _ChatState extends State<_Chat> {
typingUsers.removeWhere((User u) => u.id == client.userID);
if (typingUsers.length == 1) {
typingText = I18n.of(context).isTyping;
typingText = L10n.of(context).isTyping;
if (typingUsers.first.id != room.directChatMatrixID) {
typingText =
I18n.of(context).userIsTyping(typingUsers.first.calcDisplayname());
L10n.of(context).userIsTyping(typingUsers.first.calcDisplayname());
}
} else if (typingUsers.length == 2) {
typingText = I18n.of(context).userAndUserAreTyping(
typingText = L10n.of(context).userAndUserAreTyping(
typingUsers.first.calcDisplayname(),
typingUsers[1].calcDisplayname());
} else if (typingUsers.length > 2) {
typingText = I18n.of(context).userAndOthersAreTyping(
typingText = L10n.of(context).userAndOthersAreTyping(
typingUsers.first.calcDisplayname(),
(typingUsers.length - 1).toString());
}
@ -359,7 +359,7 @@ class _ChatState extends State<_Chat> {
? CrossAxisAlignment.center
: CrossAxisAlignment.start,
children: <Widget>[
Text(room.getLocalizedDisplayname(I18n.of(context))),
Text(room.getLocalizedDisplayname(L10n.of(context))),
AnimatedContainer(
duration: Duration(milliseconds: 500),
height: typingText.isEmpty ? 0 : 20,
@ -384,7 +384,7 @@ class _ChatState extends State<_Chat> {
),
],
)
: Text(I18n.of(context)
: Text(L10n.of(context)
.numberSelected(selectedEvents.length.toString())),
actions: selectMode
? <Widget>[
@ -550,7 +550,7 @@ class _ChatState extends State<_Chat> {
child: Row(
children: <Widget>[
Icon(Icons.keyboard_arrow_left),
Text(I18n.of(context).forward),
Text(L10n.of(context).forward),
],
),
),
@ -564,7 +564,7 @@ class _ChatState extends State<_Chat> {
child: Row(
children: <Widget>[
Text(
I18n.of(context).reply),
L10n.of(context).reply),
Icon(Icons
.keyboard_arrow_right),
],
@ -578,7 +578,7 @@ class _ChatState extends State<_Chat> {
sendAgainAction(),
child: Row(
children: <Widget>[
Text(I18n.of(context)
Text(L10n.of(context)
.tryToSendAgain),
SizedBox(width: 4),
Icon(Icons.send, size: 16),
@ -616,7 +616,7 @@ class _ChatState extends State<_Chat> {
child: Icon(Icons.attachment),
),
title:
Text(I18n.of(context).sendFile),
Text(L10n.of(context).sendFile),
contentPadding: EdgeInsets.all(0),
),
),
@ -629,7 +629,7 @@ class _ChatState extends State<_Chat> {
child: Icon(Icons.image),
),
title: Text(
I18n.of(context).sendImage),
L10n.of(context).sendImage),
contentPadding: EdgeInsets.all(0),
),
),
@ -642,7 +642,7 @@ class _ChatState extends State<_Chat> {
child: Icon(Icons.camera_alt),
),
title: Text(
I18n.of(context).openCamera),
L10n.of(context).openCamera),
contentPadding: EdgeInsets.all(0),
),
),
@ -655,7 +655,7 @@ class _ChatState extends State<_Chat> {
child: Icon(Icons.mic),
),
title: Text(
I18n.of(context).voiceMessage),
L10n.of(context).voiceMessage),
contentPadding: EdgeInsets.all(0),
),
),
@ -681,7 +681,7 @@ class _ChatState extends State<_Chat> {
controller: sendController,
decoration: InputDecoration(
hintText:
I18n.of(context).writeAMessage,
L10n.of(context).writeAMessage,
border: InputBorder.none,
),
onChanged: (String text) {

View file

@ -7,7 +7,7 @@ import 'package:fluffychat/components/chat_settings_popup_menu.dart';
import 'package:fluffychat/components/content_banner.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/components/list_items/participant_list_item.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/chat_list.dart';
import 'package:fluffychat/views/invitation_selection.dart';
@ -31,24 +31,24 @@ class _ChatDetailsState extends State<ChatDetails> {
List<User> members;
void setDisplaynameAction(BuildContext context) async {
final String displayname = await SimpleDialogs(context).enterText(
titleText: I18n.of(context).changeTheNameOfTheGroup,
labelText: I18n.of(context).changeTheNameOfTheGroup,
hintText: widget.room.getLocalizedDisplayname(I18n.of(context)),
titleText: L10n.of(context).changeTheNameOfTheGroup,
labelText: L10n.of(context).changeTheNameOfTheGroup,
hintText: widget.room.getLocalizedDisplayname(L10n.of(context)),
);
if (displayname == null) return;
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
widget.room.setName(displayname),
);
if (success != false) {
showToast(I18n.of(context).displaynameHasBeenChanged);
showToast(L10n.of(context).displaynameHasBeenChanged);
}
}
void setCanonicalAliasAction(context) async {
final String s = await SimpleDialogs(context).enterText(
titleText: I18n.of(context).setInvitationLink,
labelText: I18n.of(context).setInvitationLink,
hintText: I18n.of(context).alias.toLowerCase(),
titleText: L10n.of(context).setInvitationLink,
labelText: L10n.of(context).setInvitationLink,
hintText: L10n.of(context).alias.toLowerCase(),
prefixText: "#",
suffixText: ":" + widget.room.client.userID.domain,
);
@ -89,11 +89,11 @@ class _ChatDetailsState extends State<ChatDetails> {
void setTopicAction(BuildContext context) async {
final String displayname = await SimpleDialogs(context).enterText(
titleText: I18n.of(context).setGroupDescription,
labelText: I18n.of(context).setGroupDescription,
titleText: L10n.of(context).setGroupDescription,
labelText: L10n.of(context).setGroupDescription,
hintText: (widget.room.topic?.isNotEmpty ?? false)
? widget.room.topic
: I18n.of(context).addGroupDescription,
: L10n.of(context).addGroupDescription,
multiLine: true,
);
if (displayname == null) return;
@ -101,7 +101,7 @@ class _ChatDetailsState extends State<ChatDetails> {
widget.room.setDescription(displayname),
);
if (success != false) {
showToast(I18n.of(context).groupDescriptionHasBeenChanged);
showToast(L10n.of(context).groupDescriptionHasBeenChanged);
}
}
@ -121,7 +121,7 @@ class _ChatDetailsState extends State<ChatDetails> {
),
);
if (success != false) {
showToast(I18n.of(context).avatarHasBeenChanged);
showToast(L10n.of(context).avatarHasBeenChanged);
}
}
@ -144,10 +144,10 @@ class _ChatDetailsState extends State<ChatDetails> {
if (widget.room == null) {
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).oopsSomethingWentWrong),
title: Text(L10n.of(context).oopsSomethingWentWrong),
),
body: Center(
child: Text(I18n.of(context).youAreNoLongerParticipatingInThisChat),
child: Text(L10n.of(context).youAreNoLongerParticipatingInThisChat),
),
);
}
@ -179,12 +179,12 @@ class _ChatDetailsState extends State<ChatDetails> {
Clipboard.setData(
ClipboardData(text: widget.room.canonicalAlias),
);
showToast(I18n.of(context).copiedToClipboard);
showToast(L10n.of(context).copiedToClipboard);
},
),
ChatSettingsPopupMenu(widget.room, false)
],
title: Text(widget.room.getLocalizedDisplayname(I18n.of(context)),
title: Text(widget.room.getLocalizedDisplayname(L10n.of(context)),
style: TextStyle(
color: Theme.of(context)
.appBarTheme
@ -215,13 +215,13 @@ class _ChatDetailsState extends State<ChatDetails> {
child: Icon(Icons.edit),
)
: null,
title: Text("${I18n.of(context).groupDescription}:",
title: Text("${L10n.of(context).groupDescription}:",
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold)),
subtitle: LinkText(
text: widget.room.topic?.isEmpty ?? true
? I18n.of(context).addGroupDescription
? L10n.of(context).addGroupDescription
: widget.room.topic,
linkStyle: TextStyle(color: Colors.blueAccent),
textStyle: TextStyle(
@ -236,7 +236,7 @@ class _ChatDetailsState extends State<ChatDetails> {
Divider(thickness: 1),
ListTile(
title: Text(
I18n.of(context).settings,
L10n.of(context).settings,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
@ -251,9 +251,9 @@ class _ChatDetailsState extends State<ChatDetails> {
foregroundColor: Colors.grey,
child: Icon(Icons.people),
),
title: Text(I18n.of(context).changeTheNameOfTheGroup),
title: Text(L10n.of(context).changeTheNameOfTheGroup),
subtitle: Text(widget.room
.getLocalizedDisplayname(I18n.of(context))),
.getLocalizedDisplayname(L10n.of(context))),
onTap: () => setDisplaynameAction(context),
),
if (widget.room.canSendEvent("m.room.canonical_alias") &&
@ -266,11 +266,11 @@ class _ChatDetailsState extends State<ChatDetails> {
child: Icon(Icons.link),
),
onTap: () => setCanonicalAliasAction(context),
title: Text(I18n.of(context).setInvitationLink),
title: Text(L10n.of(context).setInvitationLink),
subtitle: Text(
(widget.room.canonicalAlias?.isNotEmpty ?? false)
? widget.room.canonicalAlias
: I18n.of(context).none),
: L10n.of(context).none),
),
PopupMenuButton(
child: ListTile(
@ -280,10 +280,10 @@ class _ChatDetailsState extends State<ChatDetails> {
foregroundColor: Colors.grey,
child: Icon(Icons.public)),
title: Text(
I18n.of(context).whoIsAllowedToJoinThisGroup),
L10n.of(context).whoIsAllowedToJoinThisGroup),
subtitle: Text(
widget.room.joinRules
.getLocalizedString(I18n.of(context)),
.getLocalizedString(L10n.of(context)),
),
),
onSelected: (JoinRules joinRule) =>
@ -296,13 +296,13 @@ class _ChatDetailsState extends State<ChatDetails> {
PopupMenuItem<JoinRules>(
value: JoinRules.public,
child: Text(JoinRules.public
.getLocalizedString(I18n.of(context))),
.getLocalizedString(L10n.of(context))),
),
if (widget.room.canChangeJoinRules)
PopupMenuItem<JoinRules>(
value: JoinRules.invite,
child: Text(JoinRules.invite
.getLocalizedString(I18n.of(context))),
.getLocalizedString(L10n.of(context))),
),
],
),
@ -315,10 +315,10 @@ class _ChatDetailsState extends State<ChatDetails> {
child: Icon(Icons.visibility),
),
title:
Text(I18n.of(context).visibilityOfTheChatHistory),
Text(L10n.of(context).visibilityOfTheChatHistory),
subtitle: Text(
widget.room.historyVisibility
.getLocalizedString(I18n.of(context)),
.getLocalizedString(L10n.of(context)),
),
),
onSelected: (HistoryVisibility historyVisibility) =>
@ -331,25 +331,25 @@ class _ChatDetailsState extends State<ChatDetails> {
PopupMenuItem<HistoryVisibility>(
value: HistoryVisibility.invited,
child: Text(HistoryVisibility.invited
.getLocalizedString(I18n.of(context))),
.getLocalizedString(L10n.of(context))),
),
if (widget.room.canChangeHistoryVisibility)
PopupMenuItem<HistoryVisibility>(
value: HistoryVisibility.joined,
child: Text(HistoryVisibility.joined
.getLocalizedString(I18n.of(context))),
.getLocalizedString(L10n.of(context))),
),
if (widget.room.canChangeHistoryVisibility)
PopupMenuItem<HistoryVisibility>(
value: HistoryVisibility.shared,
child: Text(HistoryVisibility.shared
.getLocalizedString(I18n.of(context))),
.getLocalizedString(L10n.of(context))),
),
if (widget.room.canChangeHistoryVisibility)
PopupMenuItem<HistoryVisibility>(
value: HistoryVisibility.world_readable,
child: Text(HistoryVisibility.world_readable
.getLocalizedString(I18n.of(context))),
.getLocalizedString(L10n.of(context))),
),
],
),
@ -363,10 +363,10 @@ class _ChatDetailsState extends State<ChatDetails> {
child: Icon(Icons.info_outline),
),
title:
Text(I18n.of(context).areGuestsAllowedToJoin),
Text(L10n.of(context).areGuestsAllowedToJoin),
subtitle: Text(
widget.room.guestAccess
.getLocalizedString(I18n.of(context)),
.getLocalizedString(L10n.of(context)),
),
),
onSelected: (GuestAccess guestAccess) =>
@ -381,7 +381,7 @@ class _ChatDetailsState extends State<ChatDetails> {
value: GuestAccess.can_join,
child: Text(
GuestAccess.can_join
.getLocalizedString(I18n.of(context)),
.getLocalizedString(L10n.of(context)),
),
),
if (widget.room.canChangeGuestAccess)
@ -389,7 +389,7 @@ class _ChatDetailsState extends State<ChatDetails> {
value: GuestAccess.forbidden,
child: Text(
GuestAccess.forbidden
.getLocalizedString(I18n.of(context)),
.getLocalizedString(L10n.of(context)),
),
),
],
@ -398,9 +398,9 @@ class _ChatDetailsState extends State<ChatDetails> {
ListTile(
title: Text(
actualMembersCount > 1
? I18n.of(context).countParticipants(
? L10n.of(context).countParticipants(
actualMembersCount.toString())
: I18n.of(context).emptyChat,
: L10n.of(context).emptyChat,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
@ -409,7 +409,7 @@ class _ChatDetailsState extends State<ChatDetails> {
),
widget.room.canInvite
? ListTile(
title: Text(I18n.of(context).inviteContact),
title: Text(L10n.of(context).inviteContact),
leading: CircleAvatar(
child: Icon(Icons.add),
backgroundColor: Theme.of(context).primaryColor,
@ -428,7 +428,7 @@ class _ChatDetailsState extends State<ChatDetails> {
: i < members.length + 1
? ParticipantListItem(members[i - 1])
: ListTile(
title: Text(I18n.of(context).loadCountMoreParticipants(
title: Text(L10n.of(context).loadCountMoreParticipants(
(actualMembersCount - members.length).toString())),
leading: CircleAvatar(
backgroundColor:

View file

@ -5,7 +5,7 @@ import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/components/avatar.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/utils/beautify_string_extension.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/views/chat_list.dart';
import 'package:flutter/material.dart';
@ -52,7 +52,7 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).participatingUserDevices),
title: Text(L10n.of(context).participatingUserDevices),
),
body: Column(
children: <Widget>[
@ -61,7 +61,7 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
builder: (BuildContext context, snapshot) {
if (snapshot.hasError) {
return Center(
child: Text(I18n.of(context).oopsSomethingWentWrong +
child: Text(L10n.of(context).oopsSomethingWentWrong +
": " +
snapshot.error.toString()),
);
@ -99,7 +99,7 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
),
CheckboxListTile(
title: Text(
"${deviceKeys[i].unsigned["device_display_name"] ?? I18n.of(context).unknownDevice} - ${deviceKeys[i].deviceId}",
"${deviceKeys[i].unsigned["device_display_name"] ?? L10n.of(context).unknownDevice} - ${deviceKeys[i].deviceId}",
style: TextStyle(
color: deviceKeys[i].blocked
? Colors.red

View file

@ -15,7 +15,7 @@ import '../components/theme_switcher.dart';
import '../components/adaptive_page_layout.dart';
import '../components/list_items/chat_list_item.dart';
import '../components/matrix.dart';
import '../i18n/i18n.dart';
import '../l10n/l10n.dart';
import '../utils/app_route.dart';
import '../utils/url_launcher.dart';
import '../utils/client_presence_extension.dart';
@ -185,9 +185,9 @@ class _ChatListState extends State<ChatList> {
Navigator.of(context).pop();
final status = await SimpleDialogs(context).enterText(
multiLine: true,
titleText: I18n.of(context).setStatus,
labelText: I18n.of(context).setStatus,
hintText: I18n.of(context).statusExampleMessage,
titleText: L10n.of(context).setStatus,
labelText: L10n.of(context).setStatus,
hintText: L10n.of(context).statusExampleMessage,
);
if (status?.isEmpty ?? true) return;
await SimpleDialogs(context).tryRequestWithLoadingDialog(
@ -238,31 +238,31 @@ class _ChatListState extends State<ChatList> {
children: <Widget>[
ListTile(
leading: Icon(Icons.edit),
title: Text(I18n.of(context).setStatus),
title: Text(L10n.of(context).setStatus),
onTap: () => _setStatus(context),
),
Divider(height: 1),
ListTile(
leading: Icon(Icons.people_outline),
title: Text(I18n.of(context).createNewGroup),
title: Text(L10n.of(context).createNewGroup),
onTap: () => _drawerTapAction(NewGroupView()),
),
ListTile(
leading: Icon(Icons.person_add),
title: Text(I18n.of(context).newPrivateChat),
title: Text(L10n.of(context).newPrivateChat),
onTap: () => _drawerTapAction(NewPrivateChatView()),
),
Divider(height: 1),
ListTile(
leading: Icon(Icons.archive),
title: Text(I18n.of(context).archive),
title: Text(L10n.of(context).archive),
onTap: () => _drawerTapAction(
Archive(),
),
),
ListTile(
leading: Icon(Icons.settings),
title: Text(I18n.of(context).settings),
title: Text(L10n.of(context).settings),
onTap: () => _drawerTapAction(
SettingsView(),
),
@ -270,10 +270,10 @@ class _ChatListState extends State<ChatList> {
Divider(height: 1),
ListTile(
leading: Icon(Icons.share),
title: Text(I18n.of(context).inviteContact),
title: Text(L10n.of(context).inviteContact),
onTap: () {
Navigator.of(context).pop();
Share.share(I18n.of(context).inviteText(
Share.share(L10n.of(context).inviteText(
Matrix.of(context).client.userID,
"https://matrix.to/#/${Matrix.of(context).client.userID}"));
},
@ -291,7 +291,7 @@ class _ChatListState extends State<ChatList> {
),
titleSpacing: 0,
title: selectMode == SelectMode.share
? Text(I18n.of(context).share)
? Text(L10n.of(context).share)
: Container(
padding: EdgeInsets.all(8),
height: 42,
@ -316,7 +316,7 @@ class _ChatListState extends State<ChatList> {
: Icon(Icons.search),
contentPadding: EdgeInsets.all(9),
border: InputBorder.none,
hintText: I18n.of(context).searchForAChat,
hintText: L10n.of(context).searchForAChat,
),
),
),
@ -334,7 +334,7 @@ class _ChatListState extends State<ChatList> {
child: Icon(Icons.people_outline),
foregroundColor: Colors.white,
backgroundColor: Colors.blue,
label: I18n.of(context).createNewGroup,
label: L10n.of(context).createNewGroup,
labelStyle: TextStyle(fontSize: 18.0, color: Colors.black),
onTap: () => Navigator.of(context).pushAndRemoveUntil(
AppRoute.defaultRoute(context, NewGroupView()),
@ -344,7 +344,7 @@ class _ChatListState extends State<ChatList> {
child: Icon(Icons.person_add),
foregroundColor: Colors.white,
backgroundColor: Colors.green,
label: I18n.of(context).newPrivateChat,
label: L10n.of(context).newPrivateChat,
labelStyle: TextStyle(fontSize: 18.0, color: Colors.black),
onTap: () => Navigator.of(context).pushAndRemoveUntil(
AppRoute.defaultRoute(context, NewPrivateChatView()),
@ -373,8 +373,8 @@ class _ChatListState extends State<ChatList> {
color: Colors.grey,
),
Text(searchMode
? I18n.of(context).noRoomsFound
: I18n.of(context).startYourFirstChat),
? L10n.of(context).noRoomsFound
: L10n.of(context).startYourFirstChat),
],
),
);
@ -388,7 +388,7 @@ class _ChatListState extends State<ChatList> {
? Material(
elevation: 2,
child: ListTile(
title: Text(I18n.of(context).publicRooms),
title: Text(L10n.of(context).publicRooms),
),
)
: Container(),

View file

@ -2,7 +2,7 @@ import 'dart:math';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/sign_up.dart';
import 'package:flutter/material.dart';
@ -10,7 +10,7 @@ import 'package:flutter/material.dart';
class HomeserverPicker extends StatelessWidget {
_setHomeserverAction(BuildContext context) async {
final homeserver = await SimpleDialogs(context).enterText(
titleText: I18n.of(context).enterYourHomeserver,
titleText: L10n.of(context).enterYourHomeserver,
hintText: Matrix.defaultHomeserver,
prefixText: 'https://');
if (homeserver?.isEmpty ?? true) return;
@ -45,7 +45,7 @@ class HomeserverPicker extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
I18n.of(context).welcomeText,
L10n.of(context).welcomeText,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
@ -66,7 +66,7 @@ class HomeserverPicker extends StatelessWidget {
borderRadius: BorderRadius.circular(6),
),
child: Text(
I18n.of(context).connect.toUpperCase(),
L10n.of(context).connect.toUpperCase(),
style: TextStyle(color: Colors.white, fontSize: 16),
),
onPressed: () => _checkHomeserverAction(
@ -80,7 +80,7 @@ class HomeserverPicker extends StatelessWidget {
child: Opacity(
opacity: 0.75,
child: Text(
I18n.of(context).byDefaultYouWillBeConnectedTo(
L10n.of(context).byDefaultYouWillBeConnectedTo(
Matrix.defaultHomeserver),
textAlign: TextAlign.center,
style: TextStyle(
@ -91,7 +91,7 @@ class HomeserverPicker extends StatelessWidget {
),
FlatButton(
child: Text(
I18n.of(context).changeTheHomeserver,
L10n.of(context).changeTheHomeserver,
style: TextStyle(
decoration: TextDecoration.underline,
color: Colors.blue,

View file

@ -5,7 +5,7 @@ import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/components/avatar.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
@ -58,7 +58,7 @@ class _InvitationSelectionState extends State<InvitationSelection> {
widget.room.invite(id),
);
if (success != false) {
showToast(I18n.of(context).contactHasBeenInvitedToTheGroup);
showToast(L10n.of(context).contactHasBeenInvitedToTheGroup);
}
}
@ -116,14 +116,14 @@ class _InvitationSelectionState extends State<InvitationSelection> {
@override
Widget build(BuildContext context) {
final String groupName = widget.room.name?.isEmpty ?? false
? I18n.of(context).group
? L10n.of(context).group
: widget.room.name;
return AdaptivePageLayout(
primaryPage: FocusPage.SECOND,
firstScaffold: ChatList(activeChat: widget.room.id),
secondScaffold: Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).inviteContact),
title: Text(L10n.of(context).inviteContact),
bottom: PreferredSize(
preferredSize: Size.fromHeight(92),
child: Padding(
@ -139,8 +139,8 @@ class _InvitationSelectionState extends State<InvitationSelection> {
decoration: InputDecoration(
border: OutlineInputBorder(),
prefixText: "@",
hintText: I18n.of(context).username,
labelText: I18n.of(context).inviteContactToGroup(groupName),
hintText: L10n.of(context).username,
labelText: L10n.of(context).inviteContactToGroup(groupName),
suffixIcon: loading
? Container(
padding: const EdgeInsets.all(8.0),

View file

@ -2,7 +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/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/utils/firebase_controller.dart';
import 'package:flutter/foundation.dart';
@ -26,12 +26,12 @@ class _LoginState extends State<Login> {
void login(BuildContext context) async {
MatrixState matrix = Matrix.of(context);
if (usernameController.text.isEmpty) {
setState(() => usernameError = I18n.of(context).pleaseEnterYourUsername);
setState(() => usernameError = L10n.of(context).pleaseEnterYourUsername);
} else {
setState(() => usernameError = null);
}
if (passwordController.text.isEmpty) {
setState(() => passwordError = I18n.of(context).pleaseEnterYourPassword);
setState(() => passwordError = L10n.of(context).pleaseEnterYourPassword);
} else {
setState(() => passwordError = null);
}
@ -77,7 +77,7 @@ class _LoginState extends State<Login> {
leading: loading ? Container() : null,
elevation: 0,
title: Text(
I18n.of(context).logInTo(Matrix.of(context)
L10n.of(context).logInTo(Matrix.of(context)
.client
.homeserver
.replaceFirst('https://', '')),
@ -101,9 +101,9 @@ class _LoginState extends State<Login> {
controller: usernameController,
decoration: InputDecoration(
hintText:
"@${I18n.of(context).username.toLowerCase()}:domain",
"@${L10n.of(context).username.toLowerCase()}:domain",
errorText: usernameError,
labelText: I18n.of(context).username),
labelText: L10n.of(context).username),
),
),
ListTile(
@ -129,7 +129,7 @@ class _LoginState extends State<Login> {
onPressed: () =>
setState(() => showPassword = !showPassword),
),
labelText: I18n.of(context).password),
labelText: L10n.of(context).password),
),
),
SizedBox(height: 20),
@ -147,7 +147,7 @@ class _LoginState extends State<Login> {
child: loading
? CircularProgressIndicator()
: Text(
I18n.of(context).login.toUpperCase(),
L10n.of(context).login.toUpperCase(),
style: TextStyle(color: Colors.white, fontSize: 16),
),
onPressed: () => loading ? null : login(context),

View file

@ -1,7 +1,7 @@
import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:flutter/material.dart';
import 'package:pedantic/pedantic.dart';
@ -72,7 +72,7 @@ class _NewGroupState extends State<_NewGroup> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).createNewGroup),
title: Text(L10n.of(context).createNewGroup),
elevation: 0,
),
body: Column(
@ -88,13 +88,13 @@ class _NewGroupState extends State<_NewGroup> {
onSubmitted: (s) => submitAction(context),
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: I18n.of(context).optionalGroupName,
labelText: L10n.of(context).optionalGroupName,
prefixIcon: Icon(Icons.people),
hintText: I18n.of(context).enterAGroupName),
hintText: L10n.of(context).enterAGroupName),
),
),
SwitchListTile(
title: Text(I18n.of(context).groupIsPublic),
title: Text(L10n.of(context).groupIsPublic),
value: publicGroup,
onChanged: (bool b) => setState(() => publicGroup = b),
),

View file

@ -5,7 +5,7 @@ import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/components/avatar.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:flutter/material.dart';
import 'package:share/share.dart';
@ -110,7 +110,7 @@ class _NewPrivateChatState extends State<_NewPrivateChat> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(I18n.of(context).newPrivateChat),
title: Text(L10n.of(context).newPrivateChat),
elevation: 0,
),
body: Column(
@ -129,24 +129,24 @@ class _NewPrivateChatState extends State<_NewPrivateChat> {
onFieldSubmitted: (s) => submitAction(context),
validator: (value) {
if (value.isEmpty) {
return I18n.of(context).pleaseEnterAMatrixIdentifier;
return L10n.of(context).pleaseEnterAMatrixIdentifier;
}
final MatrixState matrix = Matrix.of(context);
String mxid = "@" + controller.text.trim();
if (mxid == matrix.client.userID) {
return I18n.of(context).youCannotInviteYourself;
return L10n.of(context).youCannotInviteYourself;
}
if (!mxid.contains("@")) {
return I18n.of(context).makeSureTheIdentifierIsValid;
return L10n.of(context).makeSureTheIdentifierIsValid;
}
if (!mxid.contains(":")) {
return I18n.of(context).makeSureTheIdentifierIsValid;
return L10n.of(context).makeSureTheIdentifierIsValid;
}
return null;
},
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: I18n.of(context).enterAUsername,
labelText: L10n.of(context).enterAUsername,
prefixIcon: loading
? Container(
padding: const EdgeInsets.all(8.0),
@ -168,7 +168,7 @@ class _NewPrivateChatState extends State<_NewPrivateChat> {
)
: Icon(Icons.account_circle),
prefixText: "@",
hintText: "${I18n.of(context).username.toLowerCase()}",
hintText: "${L10n.of(context).username.toLowerCase()}",
),
),
),
@ -217,11 +217,11 @@ class _NewPrivateChatState extends State<_NewPrivateChat> {
Icons.share,
size: 16,
),
onTap: () => Share.share(I18n.of(context).inviteText(
onTap: () => Share.share(L10n.of(context).inviteText(
Matrix.of(context).client.userID,
"https://matrix.to/#/${Matrix.of(context).client.userID}")),
title: Text(
"${I18n.of(context).yourOwnUsername}:",
"${L10n.of(context).yourOwnUsername}:",
style: TextStyle(
fontStyle: FontStyle.italic,
),

View file

@ -15,7 +15,7 @@ import '../components/adaptive_page_layout.dart';
import '../components/dialogs/simple_dialogs.dart';
import '../components/content_banner.dart';
import '../components/matrix.dart';
import '../i18n/i18n.dart';
import '../l10n/l10n.dart';
import '../utils/app_route.dart';
class SettingsView extends StatelessWidget {
@ -52,9 +52,9 @@ class _SettingsState extends State<Settings> {
void setJitsiInstanceAction(BuildContext context) async {
var jitsi = await SimpleDialogs(context).enterText(
titleText: I18n.of(context).editJitsiInstance,
titleText: L10n.of(context).editJitsiInstance,
hintText: Matrix.of(context).jitsiInstance,
labelText: I18n.of(context).editJitsiInstance,
labelText: L10n.of(context).editJitsiInstance,
);
if (jitsi == null) return;
if (!jitsi.endsWith('/')) {
@ -67,10 +67,10 @@ class _SettingsState extends State<Settings> {
void setDisplaynameAction(BuildContext context) async {
final String displayname = await SimpleDialogs(context).enterText(
titleText: I18n.of(context).editDisplayname,
titleText: L10n.of(context).editDisplayname,
hintText:
profile?.displayname ?? Matrix.of(context).client.userID.localpart,
labelText: I18n.of(context).enterAUsername,
labelText: L10n.of(context).enterAUsername,
);
if (displayname == null) return;
final MatrixState matrix = Matrix.of(context);
@ -147,7 +147,7 @@ class _SettingsState extends State<Settings> {
backgroundColor: Theme.of(context).appBarTheme.color,
flexibleSpace: FlexibleSpaceBar(
title: Text(
I18n.of(context).settings,
L10n.of(context).settings,
style: TextStyle(
color: Theme.of(context)
.appBarTheme
@ -169,7 +169,7 @@ class _SettingsState extends State<Settings> {
children: <Widget>[
ListTile(
title: Text(
I18n.of(context).changeTheme,
L10n.of(context).changeTheme,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
@ -181,7 +181,7 @@ class _SettingsState extends State<Settings> {
if (!kIsWeb && client.storeAPI != null)
ListTile(
title: Text(
I18n.of(context).wallpaper,
L10n.of(context).wallpaper,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
@ -204,7 +204,7 @@ class _SettingsState extends State<Settings> {
if (!kIsWeb && client.storeAPI != null)
Builder(builder: (context) {
return ListTile(
title: Text(I18n.of(context).changeWallpaper),
title: Text(L10n.of(context).changeWallpaper),
trailing: Icon(Icons.wallpaper),
onTap: () => setWallpaperAction(context),
);
@ -212,7 +212,7 @@ class _SettingsState extends State<Settings> {
Divider(thickness: 1),
ListTile(
title: Text(
I18n.of(context).account,
L10n.of(context).account,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
@ -221,19 +221,19 @@ class _SettingsState extends State<Settings> {
),
ListTile(
trailing: Icon(Icons.edit),
title: Text(I18n.of(context).editDisplayname),
title: Text(L10n.of(context).editDisplayname),
subtitle: Text(profile?.displayname ?? client.userID.localpart),
onTap: () => setDisplaynameAction(context),
),
ListTile(
trailing: Icon(Icons.phone),
title: Text(I18n.of(context).editJitsiInstance),
title: Text(L10n.of(context).editJitsiInstance),
subtitle: Text(Matrix.of(context).jitsiInstance),
onTap: () => setJitsiInstanceAction(context),
),
ListTile(
trailing: Icon(Icons.devices_other),
title: Text(I18n.of(context).devices),
title: Text(L10n.of(context).devices),
onTap: () async => await Navigator.of(context).push(
AppRoute.defaultRoute(
context,
@ -243,7 +243,7 @@ class _SettingsState extends State<Settings> {
),
ListTile(
trailing: Icon(Icons.account_circle),
title: Text(I18n.of(context).accountInformations),
title: Text(L10n.of(context).accountInformations),
onTap: () => Navigator.of(context).push(
AppRoute.defaultRoute(
context,
@ -253,13 +253,13 @@ class _SettingsState extends State<Settings> {
),
ListTile(
trailing: Icon(Icons.exit_to_app),
title: Text(I18n.of(context).logout),
title: Text(L10n.of(context).logout),
onTap: () => logoutAction(context),
),
Divider(thickness: 1),
ListTile(
title: Text(
I18n.of(context).about,
L10n.of(context).about,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
@ -268,19 +268,19 @@ class _SettingsState extends State<Settings> {
),
ListTile(
trailing: Icon(Icons.help),
title: Text(I18n.of(context).help),
title: Text(L10n.of(context).help),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter/issues"),
),
ListTile(
trailing: Icon(Icons.link),
title: Text(I18n.of(context).license),
title: Text(L10n.of(context).license),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter/raw/master/LICENSE"),
),
ListTile(
trailing: Icon(Icons.code),
title: Text(I18n.of(context).sourceCode),
title: Text(L10n.of(context).sourceCode),
onTap: () => launch(
"https://gitlab.com/ChristianPauly/fluffychat-flutter"),
),

View file

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import '../utils/date_time_extension.dart';
import '../components/adaptive_page_layout.dart';
import '../components/matrix.dart';
import '../i18n/i18n.dart';
import '../l10n/l10n.dart';
import 'chat_list.dart';
class DevicesSettingsView extends StatelessWidget {
@ -46,8 +46,8 @@ class DevicesSettingsState extends State<DevicesSettings> {
.tryRequestWithLoadingDialog(matrix.client.deleteDevices(deviceIds),
onAdditionalAuth: (MatrixException exception) async {
final String password = await SimpleDialogs(context).enterText(
titleText: I18n.of(context).pleaseEnterYourPassword,
labelText: I18n.of(context).pleaseEnterYourPassword,
titleText: L10n.of(context).pleaseEnterYourPassword,
labelText: L10n.of(context).pleaseEnterYourPassword,
hintText: "******",
password: true);
if (password == null) return;
@ -63,7 +63,7 @@ class DevicesSettingsState extends State<DevicesSettings> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(I18n.of(context).devices)),
appBar: AppBar(title: Text(L10n.of(context).devices)),
body: FutureBuilder<bool>(
future: _loadUserDevices(context),
builder: (BuildContext context, snapshot) {
@ -99,7 +99,7 @@ class DevicesSettingsState extends State<DevicesSettings> {
if (devices.isNotEmpty)
ListTile(
title: Text(
I18n.of(context).removeAllOtherDevices,
L10n.of(context).removeAllOtherDevices,
style: TextStyle(color: Colors.red),
),
trailing: Icon(Icons.delete_outline),
@ -152,7 +152,7 @@ class UserDeviceListItem extends StatelessWidget {
itemBuilder: (BuildContext context) => [
PopupMenuItem<String>(
value: "remove",
child: Text(I18n.of(context).removeDevice,
child: Text(L10n.of(context).removeDevice,
style: TextStyle(color: Colors.red)),
),
],
@ -164,7 +164,7 @@ class UserDeviceListItem extends StatelessWidget {
child: Text(
(userDevice.displayName?.isNotEmpty ?? false)
? userDevice.displayName
: I18n.of(context).unknownDevice,
: L10n.of(context).unknownDevice,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@ -175,8 +175,8 @@ class UserDeviceListItem extends StatelessWidget {
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("${I18n.of(context).id}: ${userDevice.deviceId}"),
Text("${I18n.of(context).lastSeenIp}: ${userDevice.lastSeenIp}"),
Text("${L10n.of(context).id}: ${userDevice.deviceId}"),
Text("${L10n.of(context).lastSeenIp}: ${userDevice.lastSeenIp}"),
],
),
),

View file

@ -3,7 +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/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/login.dart';
import 'package:fluffychat/views/sign_up_password.dart';
@ -35,7 +35,7 @@ class _SignUpState extends State<SignUp> {
void signUpAction(BuildContext context) async {
MatrixState matrix = Matrix.of(context);
if (usernameController.text.isEmpty) {
setState(() => usernameError = I18n.of(context).pleaseChooseAUsername);
setState(() => usernameError = L10n.of(context).pleaseChooseAUsername);
} else {
setState(() => usernameError = null);
}
@ -105,8 +105,8 @@ class _SignUpState extends State<SignUp> {
color: Colors.red,
),
title: Text(avatar == null
? I18n.of(context).setAProfilePicture
: I18n.of(context).discardPicture),
? L10n.of(context).setAProfilePicture
: L10n.of(context).discardPicture),
onTap: avatar == null
? setAvatarAction
: () => setState(() => avatar = null),
@ -126,9 +126,9 @@ class _SignUpState extends State<SignUp> {
controller: usernameController,
onSubmitted: (s) => signUpAction(context),
decoration: InputDecoration(
hintText: I18n.of(context).username,
hintText: L10n.of(context).username,
errorText: usernameError,
labelText: I18n.of(context).chooseAUsername),
labelText: L10n.of(context).chooseAUsername),
),
),
SizedBox(height: 20),
@ -146,7 +146,7 @@ class _SignUpState extends State<SignUp> {
child: loading
? CircularProgressIndicator()
: Text(
I18n.of(context).signUp.toUpperCase(),
L10n.of(context).signUp.toUpperCase(),
style: TextStyle(color: Colors.white, fontSize: 16),
),
onPressed: () => loading ? null : signUpAction(context),
@ -156,7 +156,7 @@ class _SignUpState extends State<SignUp> {
Center(
child: FlatButton(
child: Text(
I18n.of(context).alreadyHaveAnAccount,
L10n.of(context).alreadyHaveAnAccount,
style: TextStyle(
decoration: TextDecoration.underline,
color: Colors.blue,

View file

@ -3,7 +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/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/auth_web_view.dart';
import 'package:flutter/material.dart';
@ -29,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 = I18n.of(context).pleaseEnterYourPassword);
setState(() => passwordError = L10n.of(context).pleaseEnterYourPassword);
} else {
setState(() => passwordError = null);
}
@ -96,7 +96,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
try {
await matrix.client.setDisplayname(widget.displayname);
} catch (exception) {
showToast(I18n.of(context).couldNotSetDisplayname);
showToast(L10n.of(context).couldNotSetDisplayname);
}
if (widget.avatar != null) {
try {
@ -107,7 +107,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
),
);
} catch (exception) {
showToast(I18n.of(context).couldNotSetAvatar);
showToast(L10n.of(context).couldNotSetAvatar);
}
}
await Navigator.of(context).pushAndRemoveUntil(
@ -122,7 +122,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
elevation: 0,
leading: loading ? Container() : null,
title: Text(
I18n.of(context).chooseAStrongPassword,
L10n.of(context).chooseAStrongPassword,
),
),
body: ListView(
@ -149,7 +149,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
onPressed: () =>
setState(() => showPassword = !showPassword),
),
labelText: I18n.of(context).password),
labelText: L10n.of(context).password),
),
),
SizedBox(height: 20),
@ -167,7 +167,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
child: loading
? CircularProgressIndicator()
: Text(
I18n.of(context).createAccountNow.toUpperCase(),
L10n.of(context).createAccountNow.toUpperCase(),
style: TextStyle(color: Colors.white, fontSize: 16),
),
onPressed: () => loading ? null : _signUpAction(context),