Refactoring l10n

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

View file

@ -72,23 +72,23 @@ Text("Hello world"),
```
with a method call:
```
Text(I18n.of(context).helloWorld),
Text(L10n.of(context).helloWorld),
```
And add the method to `/lib/i18n/i18n.dart`:
And add the method to `/lib/l10n/l10n.dart`:
```
String get helloWorld => Intl.message('Hello world');
```
2. Add the string to the .arb files with this command:
```
flutter pub run intl_translation:extract_to_arb --output-dir=lib/i18n lib/i18n/i18n.dart
flutter pub run intl_translation:extract_to_arb --output-dir=lib/l10n lib/l10n/l10n.dart
```
3. Copy the new translation objects from `/lib/i18n/intl_message.arb` to `/lib/i18n/intl_<yourlanguage>.arb` and translate it or create a new file for your language by copying `intl_message.arb`.
3. Copy the new translation objects from `/lib/l10n/intl_message.arb` to `/lib/l10n/intl_<yourlanguage>.arb` and translate it or create a new file for your language by copying `intl_message.arb`.
4. Update the translations with this command:
```
flutter pub pub run intl_translation:generate_from_arb --output-dir=lib/i18n --no-use-deferred-loading lib/i18n/i18n.dart lib/i18n/intl_*.arb
flutter pub pub run intl_translation:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/l10n/l10n.dart lib/l10n/intl_*.arb
```
5. Make sure your language is in `supportedLocales` in `/lib/main.dart`.

View file

@ -1,7 +1,7 @@
import 'dart:async';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/chat_details.dart';
import 'package:fluffychat/views/chat_list.dart';
@ -56,19 +56,19 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
widget.room.pushRuleState == PushRuleState.notify
? PopupMenuItem<String>(
value: "mute",
child: Text(I18n.of(context).muteChat),
child: Text(L10n.of(context).muteChat),
)
: PopupMenuItem<String>(
value: "unmute",
child: Text(I18n.of(context).unmuteChat),
child: Text(L10n.of(context).unmuteChat),
),
PopupMenuItem<String>(
value: "call",
child: Text(I18n.of(context).videoCall),
child: Text(L10n.of(context).videoCall),
),
PopupMenuItem<String>(
value: "leave",
child: Text(I18n.of(context).leave),
child: Text(L10n.of(context).leave),
),
];
if (widget.displayChatDetails) {
@ -76,7 +76,7 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
0,
PopupMenuItem<String>(
value: "details",
child: Text(I18n.of(context).chatDetails),
child: Text(L10n.of(context).chatDetails),
),
);
}

View file

@ -1,6 +1,6 @@
import 'dart:async';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_sound/flutter_sound.dart';
import 'package:intl/intl.dart';
@ -67,7 +67,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
SizedBox(width: 8),
Expanded(
child: Text(
"${I18n.of(context).recording}: $time",
"${L10n.of(context).recording}: $time",
style: TextStyle(
fontSize: 18,
),
@ -78,7 +78,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
actions: <Widget>[
FlatButton(
child: Text(
I18n.of(context).cancel.toUpperCase(),
L10n.of(context).cancel.toUpperCase(),
style: TextStyle(
color: Theme.of(context).textTheme.bodyText2.color.withAlpha(150),
),
@ -88,7 +88,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
FlatButton(
child: Row(
children: <Widget>[
Text(I18n.of(context).send.toUpperCase()),
Text(L10n.of(context).send.toUpperCase()),
SizedBox(width: 4),
Icon(Icons.send, size: 15),
],

View file

@ -1,4 +1,4 @@
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
@ -51,14 +51,14 @@ class SimpleDialogs {
FlatButton(
child: Text(
cancelText?.toUpperCase() ??
I18n.of(context).close.toUpperCase(),
L10n.of(context).close.toUpperCase(),
style: TextStyle(color: Colors.blueGrey)),
onPressed: () => Navigator.of(context).pop(),
),
FlatButton(
child: Text(
confirmText?.toUpperCase() ??
I18n.of(context).confirm.toUpperCase(),
L10n.of(context).confirm.toUpperCase(),
),
onPressed: () {
input = controller.text;
@ -81,20 +81,20 @@ class SimpleDialogs {
await showDialog(
context: context,
builder: (c) => AlertDialog(
title: Text(titleText ?? I18n.of(context).areYouSure),
title: Text(titleText ?? L10n.of(context).areYouSure),
content: contentText != null ? Text(contentText) : null,
actions: <Widget>[
FlatButton(
child: Text(
cancelText?.toUpperCase() ??
I18n.of(context).close.toUpperCase(),
L10n.of(context).close.toUpperCase(),
style: TextStyle(color: Colors.blueGrey)),
onPressed: () => Navigator.of(context).pop(),
),
FlatButton(
child: Text(
confirmText?.toUpperCase() ??
I18n.of(context).confirm.toUpperCase(),
L10n.of(context).confirm.toUpperCase(),
),
onPressed: () {
confirmed = true;
@ -142,7 +142,7 @@ class SimpleDialogs {
children: <Widget>[
CircularProgressIndicator(),
SizedBox(width: 16),
Text(I18n.of(context).loadingPleaseWait),
Text(L10n.of(context).loadingPleaseWait),
],
),
),

View file

@ -1,7 +1,7 @@
import 'dart:async';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/chat_encryption_settings.dart';
import 'package:flutter/material.dart';
@ -22,7 +22,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
void _enableEncryptionAction() async {
if (widget.room.encrypted) {
showToast(I18n.of(context).warningEncryptionInBeta);
showToast(L10n.of(context).warningEncryptionInBeta);
await Navigator.of(context).push(
AppRoute.defaultRoute(
context,
@ -32,15 +32,15 @@ class _EncryptionButtonState extends State<EncryptionButton> {
return;
}
if (!widget.room.client.encryptionEnabled) {
showToast(I18n.of(context).needPantalaimonWarning);
showToast(L10n.of(context).needPantalaimonWarning);
return;
}
if (await SimpleDialogs(context).askConfirmation(
titleText: I18n.of(context).enableEncryptionWarning,
titleText: L10n.of(context).enableEncryptionWarning,
contentText: widget.room.client.encryptionEnabled
? I18n.of(context).warningEncryptionInBeta
: I18n.of(context).needPantalaimonWarning,
confirmText: I18n.of(context).yes,
? L10n.of(context).warningEncryptionInBeta
: L10n.of(context).needPantalaimonWarning,
confirmText: L10n.of(context).yes,
) ==
true) {
await SimpleDialogs(context).tryRequestWithLoadingDialog(

View file

@ -5,7 +5,7 @@ import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
import 'package:pedantic/pedantic.dart';
import '../../i18n/i18n.dart';
import '../../l10n/l10n.dart';
import '../../utils/app_route.dart';
import '../../utils/date_time_extension.dart';
import '../../views/chat.dart';
@ -31,7 +31,7 @@ class ChatListItem extends StatelessWidget {
}
if (room.membership == Membership.ban) {
showToast(I18n.of(context).youHaveBeenBannedFromThisChat);
showToast(L10n.of(context).youHaveBeenBannedFromThisChat);
return;
}
@ -39,16 +39,16 @@ class ChatListItem extends StatelessWidget {
await showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text(I18n.of(context).archivedRoom),
content: Text(I18n.of(context).thisRoomHasBeenArchived),
title: Text(L10n.of(context).archivedRoom),
content: Text(L10n.of(context).thisRoomHasBeenArchived),
actions: <Widget>[
FlatButton(
child: Text(I18n.of(context).close.toUpperCase(),
child: Text(L10n.of(context).close.toUpperCase(),
style: TextStyle(color: Colors.blueGrey)),
onPressed: () => Navigator.of(context).pop(),
),
FlatButton(
child: Text(I18n.of(context).delete.toUpperCase(),
child: Text(L10n.of(context).delete.toUpperCase(),
style: TextStyle(color: Colors.red)),
onPressed: () async {
await archiveAction(context);
@ -56,7 +56,7 @@ class ChatListItem extends StatelessWidget {
},
),
FlatButton(
child: Text(I18n.of(context).rejoin.toUpperCase(),
child: Text(L10n.of(context).rejoin.toUpperCase(),
style: TextStyle(color: Colors.blue)),
onPressed: () async {
await SimpleDialogs(context)
@ -122,14 +122,14 @@ class ChatListItem extends StatelessWidget {
secondaryActions: <Widget>[
if ([Membership.join, Membership.invite].contains(room.membership))
IconSlideAction(
caption: I18n.of(context).leave,
caption: L10n.of(context).leave,
color: Colors.red,
icon: Icons.archive,
onTap: () => archiveAction(context),
),
if ([Membership.leave, Membership.ban].contains(room.membership))
IconSlideAction(
caption: I18n.of(context).delete,
caption: L10n.of(context).delete,
color: Colors.red,
icon: Icons.delete_forever,
onTap: () => archiveAction(context),
@ -151,7 +151,7 @@ class ChatListItem extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
room.getLocalizedDisplayname(I18n.of(context)),
room.getLocalizedDisplayname(L10n.of(context)),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@ -181,13 +181,13 @@ class ChatListItem extends StatelessWidget {
Expanded(
child: room.membership == Membership.invite
? Text(
I18n.of(context).youAreInvitedToThisChat,
L10n.of(context).youAreInvitedToThisChat,
style: TextStyle(
color: Theme.of(context).primaryColor,
),
)
: Text(
room.lastEvent.getLocalizedBody(I18n.of(context),
room.lastEvent.getLocalizedBody(L10n.of(context),
withSenderNamePrefix: true, hideReply: true),
maxLines: 1,
overflow: TextOverflow.ellipsis,

View file

@ -3,7 +3,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/components/message_content.dart';
import 'package:fluffychat/components/reply_content.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/date_time_extension.dart';
import 'package:fluffychat/utils/event_extension.dart';
import 'package:fluffychat/utils/string_color.dart';
@ -114,7 +114,7 @@ class Message extends StatelessWidget {
RaisedButton(
color: color.withAlpha(100),
child: Text(
I18n.of(context).requestPermission,
L10n.of(context).requestPermission,
style: TextStyle(color: textColor),
),
onPressed: () => SimpleDialogs(context)

View file

@ -1,6 +1,6 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/chat.dart';
import 'package:flutter/material.dart';
@ -65,19 +65,19 @@ class ParticipantListItem extends StatelessWidget {
Widget build(BuildContext context) {
Map<Membership, String> membershipBatch = {
Membership.join: "",
Membership.ban: I18n.of(context).banned,
Membership.invite: I18n.of(context).invited,
Membership.leave: I18n.of(context).leftTheChat,
Membership.ban: L10n.of(context).banned,
Membership.invite: L10n.of(context).invited,
Membership.leave: L10n.of(context).leftTheChat,
};
final String permissionBatch = user.powerLevel == 100
? I18n.of(context).admin
: user.powerLevel >= 50 ? I18n.of(context).moderator : "";
? L10n.of(context).admin
: user.powerLevel >= 50 ? L10n.of(context).moderator : "";
List<PopupMenuEntry<String>> items = <PopupMenuEntry<String>>[];
if (user.id != Matrix.of(context).client.userID) {
items.add(
PopupMenuItem(
child: Text(I18n.of(context).sendAMessage), value: "message"),
child: Text(L10n.of(context).sendAMessage), value: "message"),
);
}
if (user.canChangePowerLevel &&
@ -85,7 +85,7 @@ class ParticipantListItem extends StatelessWidget {
user.powerLevel != 100) {
items.add(
PopupMenuItem(
child: Text(I18n.of(context).makeAnAdmin), value: "admin"),
child: Text(L10n.of(context).makeAnAdmin), value: "admin"),
);
}
if (user.canChangePowerLevel &&
@ -93,29 +93,29 @@ class ParticipantListItem extends StatelessWidget {
user.powerLevel != 50) {
items.add(
PopupMenuItem(
child: Text(I18n.of(context).makeAModerator), value: "moderator"),
child: Text(L10n.of(context).makeAModerator), value: "moderator"),
);
}
if (user.canChangePowerLevel && user.powerLevel != 0) {
items.add(
PopupMenuItem(
child: Text(I18n.of(context).revokeAllPermissions), value: "user"),
child: Text(L10n.of(context).revokeAllPermissions), value: "user"),
);
}
if (user.canKick) {
items.add(
PopupMenuItem(
child: Text(I18n.of(context).kickFromChat), value: "kick"),
child: Text(L10n.of(context).kickFromChat), value: "kick"),
);
}
if (user.canBan && user.membership != Membership.ban) {
items.add(
PopupMenuItem(child: Text(I18n.of(context).banFromChat), value: "ban"),
PopupMenuItem(child: Text(L10n.of(context).banFromChat), value: "ban"),
);
} else if (user.canBan && user.membership == Membership.ban) {
items.add(
PopupMenuItem(
child: Text(I18n.of(context).removeExile), value: "unban"),
child: Text(L10n.of(context).removeExile), value: "unban"),
);
}
return PopupMenuButton(

View file

@ -1,5 +1,5 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/chat.dart';
import 'package:flutter/material.dart';
@ -62,7 +62,7 @@ class PresenceListItem extends StatelessWidget {
actions: <Widget>[
if (presence.sender != Matrix.of(context).client.userID)
FlatButton(
child: Text(I18n.of(context).sendAMessage),
child: Text(L10n.of(context).sendAMessage),
onPressed: () async {
final String roomId = await User(
presence.sender,
@ -77,7 +77,7 @@ class PresenceListItem extends StatelessWidget {
},
),
FlatButton(
child: Text(I18n.of(context).close),
child: Text(L10n.of(context).close),
onPressed: () => Navigator.of(context).pop(),
),
],

View file

@ -2,7 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:flutter/material.dart';
import '../../i18n/i18n.dart';
import '../../l10n/l10n.dart';
import '../../utils/app_route.dart';
import '../../views/chat.dart';
import '../avatar.dart';
@ -41,7 +41,7 @@ class PublicRoomListItem extends StatelessWidget {
subtitle: Text(
hasTopic
? publicRoomEntry.topic
: I18n.of(context).countParticipants(
: L10n.of(context).countParticipants(
publicRoomEntry.numJoinedMembers?.toString() ?? "0"),
maxLines: 1,
),

View file

@ -1,6 +1,6 @@
import 'package:bubble/bubble.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
class StateMessage extends StatelessWidget {
@ -21,7 +21,7 @@ class StateMessage extends StatelessWidget {
color: Theme.of(context).backgroundColor.withOpacity(0.66),
alignment: Alignment.center,
child: Text(
event.getLocalizedBody(I18n.of(context)),
event.getLocalizedBody(L10n.of(context)),
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).textTheme.bodyText2.color,

View file

@ -9,7 +9,7 @@ import 'package:flutter/material.dart';
import 'package:localstorage/localstorage.dart';
import 'package:url_launcher/url_launcher.dart';
import '../i18n/i18n.dart';
import '../l10n/l10n.dart';
import '../utils/beautify_string_extension.dart';
import '../utils/famedlysdk_store.dart';
import 'avatar.dart';
@ -106,7 +106,7 @@ class MatrixState extends State<Matrix> {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(I18n.of(context).videoCall),
title: Text(L10n.of(context).videoCall),
content: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
@ -165,11 +165,11 @@ class MatrixState extends State<Matrix> {
final Room room = request.room;
final User sender = room.getUserByMXIDSync(request.sender);
if (await SimpleDialogs(context).askConfirmation(
titleText: I18n.of(context).requestToReadOlderMessages,
titleText: L10n.of(context).requestToReadOlderMessages,
contentText:
"${sender.id}\n\n${I18n.of(context).device}:\n${request.requestingDevice.deviceId}\n\n${I18n.of(context).identity}:\n${request.requestingDevice.curve25519Key.beautified}",
confirmText: I18n.of(context).verify,
cancelText: I18n.of(context).deny,
"${sender.id}\n\n${L10n.of(context).device}:\n${request.requestingDevice.deviceId}\n\n${L10n.of(context).identity}:\n${request.requestingDevice.curve25519Key.beautified}",
confirmText: L10n.of(context).verify,
cancelText: L10n.of(context).deny,
)) {
await request.forwardKey();
}

View file

@ -1,7 +1,7 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/audio_player.dart';
import 'package:fluffychat/components/image_bubble.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'package:link_text/link_text.dart';
import 'package:url_launcher/url_launcher.dart';
@ -50,14 +50,14 @@ class MessageContent extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(Icons.phone),
Text(I18n.of(context).videoCall),
Text(L10n.of(context).videoCall),
],
),
onPressed: () => launch(event.body),
);
}
return LinkText(
text: event.getLocalizedBody(I18n.of(context), hideReply: true),
text: event.getLocalizedBody(L10n.of(context), hideReply: true),
textStyle: TextStyle(
color: textColor,
decoration: event.redacted ? TextDecoration.lineThrough : null,
@ -67,7 +67,7 @@ class MessageContent extends StatelessWidget {
break;
default:
return Text(
I18n.of(context).userSentUnknownEvent(
L10n.of(context).userSentUnknownEvent(
event.sender.calcDisplayname(), event.typeKey),
style: TextStyle(
color: textColor,

View file

@ -1,5 +1,5 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'package:fluffychat/utils/matrix_file_extension.dart';
import 'package:fluffychat/utils/event_extension.dart';
@ -22,7 +22,7 @@ class MessageDownloadContent extends StatelessWidget {
RaisedButton(
color: Colors.blueGrey,
child: Text(
I18n.of(context).downloadFile,
L10n.of(context).downloadFile,
overflow: TextOverflow.fade,
softWrap: false,
maxLines: 1,

View file

@ -1,5 +1,5 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
class ReplyContent extends StatelessWidget {
@ -36,7 +36,7 @@ class ReplyContent extends StatelessWidget {
),
Text(
replyEvent?.getLocalizedBody(
I18n.of(context),
L10n.of(context),
withSenderNamePrefix: false,
hideReply: true,
) ??

View file

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import '../components/theme_switcher.dart';
import '../components/matrix.dart';
import '../i18n/i18n.dart';
import '../l10n/l10n.dart';
class ThemesSettings extends StatefulWidget {
@override
@ -25,7 +25,7 @@ class ThemesSettingsState extends State<ThemesSettings> {
children: <Widget>[
RadioListTile<Themes>(
title: Text(
I18n.of(context).systemTheme,
L10n.of(context).systemTheme,
),
value: Themes.system,
groupValue: _selectedTheme,
@ -39,7 +39,7 @@ class ThemesSettingsState extends State<ThemesSettings> {
),
RadioListTile<Themes>(
title: Text(
I18n.of(context).lightTheme,
L10n.of(context).lightTheme,
),
value: Themes.light,
groupValue: _selectedTheme,
@ -53,7 +53,7 @@ class ThemesSettingsState extends State<ThemesSettings> {
),
RadioListTile<Themes>(
title: Text(
I18n.of(context).darkTheme,
L10n.of(context).darkTheme,
),
value: Themes.dark,
groupValue: _selectedTheme,
@ -67,7 +67,7 @@ class ThemesSettingsState extends State<ThemesSettings> {
),
ListTile(
title: Text(
I18n.of(context).useAmoledTheme,
L10n.of(context).useAmoledTheme,
),
trailing: Switch(
value: _amoledEnabled,

View file

@ -1,5 +1,5 @@
{
"@@last_modified": "2020-05-06T19:24:19.377156",
"@@last_modified": "2020-05-07T07:52:19.301540",
"About": "About",
"@About": {
"type": "text",

View file

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'messages_all.dart';
class AppLocalizationsDelegate extends LocalizationsDelegate<I18n> {
class AppLocalizationsDelegate extends LocalizationsDelegate<L10n> {
const AppLocalizationsDelegate();
@override
@ -12,32 +12,32 @@ class AppLocalizationsDelegate extends LocalizationsDelegate<I18n> {
}
@override
Future<I18n> load(Locale locale) {
return I18n.load(locale);
Future<L10n> load(Locale locale) {
return L10n.load(locale);
}
@override
bool shouldReload(LocalizationsDelegate<I18n> old) {
bool shouldReload(LocalizationsDelegate<L10n> old) {
return false;
}
}
class I18n extends MatrixLocalizations {
I18n(this.localeName);
class L10n extends MatrixLocalizations {
L10n(this.localeName);
static Future<I18n> load(Locale locale) {
static Future<L10n> load(Locale locale) {
final String name =
locale.countryCode == null ? locale.languageCode : locale.toString();
final String localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((bool _) {
Intl.defaultLocale = localeName;
return I18n(localeName);
return L10n(localeName);
});
}
static I18n of(BuildContext context) {
return Localizations.of<I18n>(context, I18n);
static L10n of(BuildContext context) {
return Localizations.of<L10n>(context, L10n);
}
final String localeName;

View file

@ -8,7 +8,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
import 'i18n/i18n.dart';
import 'l10n/l10n.dart';
import 'components/theme_switcher.dart';
import 'components/matrix.dart';
import 'views/chat_list.dart';

View file

@ -1,4 +1,4 @@
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
/// Provides extra functionality for formatting the time.
@ -34,7 +34,7 @@ extension DateTimeExtension on DateTime {
/// Returns a simple time String.
/// TODO: Add localization
String localizedTimeOfDay(BuildContext context) {
return I18n.of(context).timeOfDay(_z(this.hour % 12), _z(this.hour),
return L10n.of(context).timeOfDay(_z(this.hour % 12), _z(this.hour),
_z(this.minute), this.hour > 11 ? 'pm' : 'am');
}
@ -57,26 +57,26 @@ extension DateTimeExtension on DateTime {
} else if (sameWeek) {
switch (this.weekday) {
case 1:
return I18n.of(context).monday;
return L10n.of(context).monday;
case 2:
return I18n.of(context).tuesday;
return L10n.of(context).tuesday;
case 3:
return I18n.of(context).wednesday;
return L10n.of(context).wednesday;
case 4:
return I18n.of(context).thursday;
return L10n.of(context).thursday;
case 5:
return I18n.of(context).friday;
return L10n.of(context).friday;
case 6:
return I18n.of(context).saturday;
return L10n.of(context).saturday;
case 7:
return I18n.of(context).sunday;
return L10n.of(context).sunday;
}
} else if (sameYear) {
return I18n.of(context).dateWithoutYear(
return L10n.of(context).dateWithoutYear(
this.month.toString().padLeft(2, '0'),
this.day.toString().padLeft(2, '0'));
}
return I18n.of(context).dateWithYear(
return L10n.of(context).dateWithYear(
this.year.toString(),
this.month.toString().padLeft(2, '0'),
this.day.toString().padLeft(2, '0'));
@ -93,7 +93,7 @@ extension DateTimeExtension on DateTime {
bool sameDay = sameYear && now.month == this.month && now.day == this.day;
if (sameDay) return localizedTimeOfDay(context);
return I18n.of(context).dateAndTimeOfDay(
return L10n.of(context).dateAndTimeOfDay(
localizedTimeShort(context), localizedTimeOfDay(context));
}

View file

@ -3,7 +3,7 @@ import 'dart:io';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/views/chat.dart';
import 'package:flutter/foundation.dart';
@ -31,7 +31,7 @@ abstract class FirebaseController {
}
if (token?.isEmpty ?? true) {
showToast(
I18n.of(context).noGoogleServicesWarning,
L10n.of(context).noGoogleServicesWarning,
duration: Duration(seconds: 15),
);
return;
@ -106,7 +106,7 @@ abstract class FirebaseController {
if (context != null && Matrix.of(context).activeRoomId == roomId) {
return null;
}
final i18n = context == null ? I18n('en') : I18n.of(context);
final i18n = context == null ? L10n('en') : L10n.of(context);
// Get the client
Client client;

View file

@ -1,5 +1,5 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'date_time_extension.dart';
@ -8,6 +8,6 @@ extension PresenceExtension on Presence {
if (statusMsg?.isNotEmpty ?? false) {
return statusMsg;
}
return I18n.of(context).lastActiveAgo(time.localizedTimeShort(context));
return L10n.of(context).lastActiveAgo(time.localizedTimeShort(context));
}
}

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