Refactoring l10n
This commit is contained in:
parent
5f7148cc3c
commit
6f1ed6120f
42 changed files with 287 additions and 287 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue