mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 09:28:41 +00:00
translate group actions
This commit is contained in:
parent
4bc7db75e9
commit
b06011dc49
6 changed files with 319 additions and 19 deletions
|
|
@ -380,5 +380,7 @@
|
||||||
"makeAdminRightsOkBtn": "Zum Admin machen",
|
"makeAdminRightsOkBtn": "Zum Admin machen",
|
||||||
"updateGroup": "Gruppe aktualisieren",
|
"updateGroup": "Gruppe aktualisieren",
|
||||||
"alreadyInGroup": "Bereits Mitglied",
|
"alreadyInGroup": "Bereits Mitglied",
|
||||||
"removeContactFromGroupTitle": "{username} aus dieser Gruppe entfernen?"
|
"removeContactFromGroupTitle": "{username} aus dieser Gruppe entfernen?",
|
||||||
|
"groupActionYou": "dich",
|
||||||
|
"groupActionYour": "deine"
|
||||||
}
|
}
|
||||||
|
|
@ -536,5 +536,21 @@
|
||||||
"makeAdminRightsOkBtn": "Make admin",
|
"makeAdminRightsOkBtn": "Make admin",
|
||||||
"updateGroup": "Update group",
|
"updateGroup": "Update group",
|
||||||
"alreadyInGroup": "Already in Group",
|
"alreadyInGroup": "Already in Group",
|
||||||
"removeContactFromGroupTitle": "Remove {username} from this group?"
|
"removeContactFromGroupTitle": "Remove {username} from this group?",
|
||||||
|
"youChangedGroupName": "Du hast den Gruppennamen zu „{newGroupName}“ geändert.",
|
||||||
|
"makerChangedGroupName": "{maker} hat den Gruppennamen zu „{newGroupName}“ geändert.",
|
||||||
|
"youCreatedGroup": "Du hast die Gruppe erstellt.",
|
||||||
|
"makerCreatedGroup": "{maker} hat die Gruppe erstellt.",
|
||||||
|
"youRemovedMember": "Du hast {affected} aus der Gruppe entfernt.",
|
||||||
|
"makerRemovedMember": "{maker} hat {affected} aus der Gruppe entfernt.",
|
||||||
|
"youAddedMember": "Du hast {affected} zur Gruppe hinzugefügt.",
|
||||||
|
"makerAddedMember": "{maker} hat {affected} zur Gruppe hinzugefügt.",
|
||||||
|
"youMadeAdmin": "Du hast {affected} zum Administrator gemacht.",
|
||||||
|
"makerMadeAdmin": "{maker} hat {affected} zum Administrator gemacht.",
|
||||||
|
"youRevokedAdminRights": "Du hast {affectedR} die Administratorrechte entzogen.",
|
||||||
|
"makerRevokedAdminRights": "{maker} hat {affectedR} die Administratorrechte entzogen.",
|
||||||
|
"youLeftGroup": "Du hast die Gruppe verlassen.",
|
||||||
|
"makerLeftGroup": "{maker} hat die Gruppe verlassen.",
|
||||||
|
"groupActionYou": "you",
|
||||||
|
"groupActionYour": "your"
|
||||||
}
|
}
|
||||||
|
|
@ -2323,6 +2323,102 @@ abstract class AppLocalizations {
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Remove {username} from this group?'**
|
/// **'Remove {username} from this group?'**
|
||||||
String removeContactFromGroupTitle(Object username);
|
String removeContactFromGroupTitle(Object username);
|
||||||
|
|
||||||
|
/// No description provided for @youChangedGroupName.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Du hast den Gruppennamen zu „{newGroupName}“ geändert.'**
|
||||||
|
String youChangedGroupName(Object newGroupName);
|
||||||
|
|
||||||
|
/// No description provided for @makerChangedGroupName.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{maker} hat den Gruppennamen zu „{newGroupName}“ geändert.'**
|
||||||
|
String makerChangedGroupName(Object maker, Object newGroupName);
|
||||||
|
|
||||||
|
/// No description provided for @youCreatedGroup.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Du hast die Gruppe erstellt.'**
|
||||||
|
String get youCreatedGroup;
|
||||||
|
|
||||||
|
/// No description provided for @makerCreatedGroup.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{maker} hat die Gruppe erstellt.'**
|
||||||
|
String makerCreatedGroup(Object maker);
|
||||||
|
|
||||||
|
/// No description provided for @youRemovedMember.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Du hast {affected} aus der Gruppe entfernt.'**
|
||||||
|
String youRemovedMember(Object affected);
|
||||||
|
|
||||||
|
/// No description provided for @makerRemovedMember.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{maker} hat {affected} aus der Gruppe entfernt.'**
|
||||||
|
String makerRemovedMember(Object affected, Object maker);
|
||||||
|
|
||||||
|
/// No description provided for @youAddedMember.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Du hast {affected} zur Gruppe hinzugefügt.'**
|
||||||
|
String youAddedMember(Object affected);
|
||||||
|
|
||||||
|
/// No description provided for @makerAddedMember.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{maker} hat {affected} zur Gruppe hinzugefügt.'**
|
||||||
|
String makerAddedMember(Object affected, Object maker);
|
||||||
|
|
||||||
|
/// No description provided for @youMadeAdmin.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Du hast {affected} zum Administrator gemacht.'**
|
||||||
|
String youMadeAdmin(Object affected);
|
||||||
|
|
||||||
|
/// No description provided for @makerMadeAdmin.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{maker} hat {affected} zum Administrator gemacht.'**
|
||||||
|
String makerMadeAdmin(Object affected, Object maker);
|
||||||
|
|
||||||
|
/// No description provided for @youRevokedAdminRights.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Du hast {affectedR} die Administratorrechte entzogen.'**
|
||||||
|
String youRevokedAdminRights(Object affectedR);
|
||||||
|
|
||||||
|
/// No description provided for @makerRevokedAdminRights.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{maker} hat {affectedR} die Administratorrechte entzogen.'**
|
||||||
|
String makerRevokedAdminRights(Object affectedR, Object maker);
|
||||||
|
|
||||||
|
/// No description provided for @youLeftGroup.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Du hast die Gruppe verlassen.'**
|
||||||
|
String get youLeftGroup;
|
||||||
|
|
||||||
|
/// No description provided for @makerLeftGroup.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{maker} hat die Gruppe verlassen.'**
|
||||||
|
String makerLeftGroup(Object maker);
|
||||||
|
|
||||||
|
/// No description provided for @groupActionYou.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'you'**
|
||||||
|
String get groupActionYou;
|
||||||
|
|
||||||
|
/// No description provided for @groupActionYour.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'your'**
|
||||||
|
String get groupActionYour;
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppLocalizationsDelegate
|
class _AppLocalizationsDelegate
|
||||||
|
|
|
||||||
|
|
@ -1236,4 +1236,76 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||||
String removeContactFromGroupTitle(Object username) {
|
String removeContactFromGroupTitle(Object username) {
|
||||||
return '$username aus dieser Gruppe entfernen?';
|
return '$username aus dieser Gruppe entfernen?';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youChangedGroupName(Object newGroupName) {
|
||||||
|
return 'Du hast den Gruppennamen zu „$newGroupName“ geändert.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerChangedGroupName(Object maker, Object newGroupName) {
|
||||||
|
return '$maker hat den Gruppennamen zu „$newGroupName“ geändert.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get youCreatedGroup => 'Du hast die Gruppe erstellt.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerCreatedGroup(Object maker) {
|
||||||
|
return '$maker hat die Gruppe erstellt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youRemovedMember(Object affected) {
|
||||||
|
return 'Du hast $affected aus der Gruppe entfernt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerRemovedMember(Object affected, Object maker) {
|
||||||
|
return '$maker hat $affected aus der Gruppe entfernt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youAddedMember(Object affected) {
|
||||||
|
return 'Du hast $affected zur Gruppe hinzugefügt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerAddedMember(Object affected, Object maker) {
|
||||||
|
return '$maker hat $affected zur Gruppe hinzugefügt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youMadeAdmin(Object affected) {
|
||||||
|
return 'Du hast $affected zum Administrator gemacht.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerMadeAdmin(Object affected, Object maker) {
|
||||||
|
return '$maker hat $affected zum Administrator gemacht.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youRevokedAdminRights(Object affectedR) {
|
||||||
|
return 'Du hast $affectedR die Administratorrechte entzogen.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerRevokedAdminRights(Object affectedR, Object maker) {
|
||||||
|
return '$maker hat $affectedR die Administratorrechte entzogen.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get youLeftGroup => 'Du hast die Gruppe verlassen.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerLeftGroup(Object maker) {
|
||||||
|
return '$maker hat die Gruppe verlassen.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get groupActionYou => 'dich';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get groupActionYour => 'deine';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1229,4 +1229,76 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||||
String removeContactFromGroupTitle(Object username) {
|
String removeContactFromGroupTitle(Object username) {
|
||||||
return 'Remove $username from this group?';
|
return 'Remove $username from this group?';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youChangedGroupName(Object newGroupName) {
|
||||||
|
return 'Du hast den Gruppennamen zu „$newGroupName“ geändert.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerChangedGroupName(Object maker, Object newGroupName) {
|
||||||
|
return '$maker hat den Gruppennamen zu „$newGroupName“ geändert.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get youCreatedGroup => 'Du hast die Gruppe erstellt.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerCreatedGroup(Object maker) {
|
||||||
|
return '$maker hat die Gruppe erstellt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youRemovedMember(Object affected) {
|
||||||
|
return 'Du hast $affected aus der Gruppe entfernt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerRemovedMember(Object affected, Object maker) {
|
||||||
|
return '$maker hat $affected aus der Gruppe entfernt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youAddedMember(Object affected) {
|
||||||
|
return 'Du hast $affected zur Gruppe hinzugefügt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerAddedMember(Object affected, Object maker) {
|
||||||
|
return '$maker hat $affected zur Gruppe hinzugefügt.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youMadeAdmin(Object affected) {
|
||||||
|
return 'Du hast $affected zum Administrator gemacht.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerMadeAdmin(Object affected, Object maker) {
|
||||||
|
return '$maker hat $affected zum Administrator gemacht.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String youRevokedAdminRights(Object affectedR) {
|
||||||
|
return 'Du hast $affectedR die Administratorrechte entzogen.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerRevokedAdminRights(Object affectedR, Object maker) {
|
||||||
|
return '$maker hat $affectedR die Administratorrechte entzogen.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get youLeftGroup => 'Du hast die Gruppe verlassen.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String makerLeftGroup(Object maker) {
|
||||||
|
return '$maker hat die Gruppe verlassen.';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get groupActionYou => 'you';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get groupActionYour => 'your';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import 'package:twonly/globals.dart';
|
||||||
import 'package:twonly/src/database/daos/contacts.dao.dart';
|
import 'package:twonly/src/database/daos/contacts.dao.dart';
|
||||||
import 'package:twonly/src/database/tables/groups.table.dart';
|
import 'package:twonly/src/database/tables/groups.table.dart';
|
||||||
import 'package:twonly/src/database/twonly.db.dart';
|
import 'package:twonly/src/database/twonly.db.dart';
|
||||||
|
import 'package:twonly/src/utils/misc.dart';
|
||||||
|
|
||||||
class ChatGroupAction extends StatefulWidget {
|
class ChatGroupAction extends StatefulWidget {
|
||||||
const ChatGroupAction({
|
const ChatGroupAction({
|
||||||
|
|
@ -47,47 +48,88 @@ class _ChatGroupActionState extends State<ChatGroupAction> {
|
||||||
IconData? icon;
|
IconData? icon;
|
||||||
|
|
||||||
final affected = (affectedContact == null)
|
final affected = (affectedContact == null)
|
||||||
? 'you'
|
? context.lang.groupActionYou
|
||||||
: getContactDisplayName(affectedContact!);
|
: getContactDisplayName(affectedContact!);
|
||||||
final affectedR = (affectedContact == null) ? 'your' : "$affected'";
|
final affectedR =
|
||||||
|
(affectedContact == null) ? context.lang.groupActionYour : affected;
|
||||||
final maker = (contact == null) ? '' : getContactDisplayName(contact!);
|
final maker = (contact == null) ? '' : getContactDisplayName(contact!);
|
||||||
|
|
||||||
switch (widget.action.type) {
|
switch (widget.action.type) {
|
||||||
case GroupActionType.updatedGroupName:
|
case GroupActionType.updatedGroupName:
|
||||||
text = (contact == null)
|
text = (contact == null)
|
||||||
? 'You have changed the group name to "${widget.action.newGroupName}".'
|
? context.lang.youChangedGroupName(widget.action.newGroupName!)
|
||||||
: '$maker has changed the group name to "${widget.action.newGroupName}".';
|
: context.lang
|
||||||
|
.makerChangedGroupName(maker, widget.action.newGroupName!);
|
||||||
icon = FontAwesomeIcons.pencil;
|
icon = FontAwesomeIcons.pencil;
|
||||||
case GroupActionType.createdGroup:
|
case GroupActionType.createdGroup:
|
||||||
icon = FontAwesomeIcons.penToSquare;
|
icon = FontAwesomeIcons.penToSquare;
|
||||||
text = (contact == null)
|
text = (contact == null)
|
||||||
? 'You have created the group.'
|
? context.lang.youCreatedGroup
|
||||||
: '$maker has created the group.';
|
: context.lang.makerCreatedGroup(maker);
|
||||||
case GroupActionType.removedMember:
|
case GroupActionType.removedMember:
|
||||||
icon = FontAwesomeIcons.userMinus;
|
icon = FontAwesomeIcons.userMinus;
|
||||||
text = (contact == null)
|
text = (contact == null)
|
||||||
? 'You have removed $affected from the group.'
|
? context.lang.youRemovedMember(affected)
|
||||||
: '$maker has removed $affected from the group.';
|
: context.lang.makerRemovedMember(affected, maker);
|
||||||
case GroupActionType.addMember:
|
case GroupActionType.addMember:
|
||||||
icon = FontAwesomeIcons.userPlus;
|
icon = FontAwesomeIcons.userPlus;
|
||||||
text = (contact == null)
|
text = (contact == null)
|
||||||
? 'You have added $affected to the group.'
|
? context.lang.youAddedMember(affected)
|
||||||
: '$maker has added $affected to the group.';
|
: context.lang.makerAddedMember(affected, maker);
|
||||||
case GroupActionType.leftGroup:
|
|
||||||
break;
|
|
||||||
case GroupActionType.promoteToAdmin:
|
case GroupActionType.promoteToAdmin:
|
||||||
icon = FontAwesomeIcons.key;
|
icon = FontAwesomeIcons.key;
|
||||||
text = (contact == null)
|
text = (contact == null)
|
||||||
? 'You made $affected an admin.'
|
? context.lang.youMadeAdmin(affected)
|
||||||
: '$maker made $affected an admin.';
|
: context.lang.makerMadeAdmin(affected, maker);
|
||||||
case GroupActionType.demoteToMember:
|
case GroupActionType.demoteToMember:
|
||||||
icon = FontAwesomeIcons.key;
|
icon = FontAwesomeIcons.key;
|
||||||
text = (contact == null)
|
text = (contact == null)
|
||||||
? 'You revoked $affectedR admin rights.'
|
? context.lang.youRevokedAdminRights(affected)
|
||||||
: '$maker revoked $affectedR admin rights.';
|
: context.lang.makerRevokedAdminRights(affectedR, maker);
|
||||||
|
case GroupActionType.leftGroup:
|
||||||
|
icon = FontAwesomeIcons.userMinus;
|
||||||
|
text = (contact == null)
|
||||||
|
? context.lang.youLeftGroup
|
||||||
|
: context.lang.makerLeftGroup(maker);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text == '' || icon == null) return Container();
|
// switch (widget.action.type) {
|
||||||
|
// case GroupActionType.updatedGroupName:
|
||||||
|
// text = (contact == null)
|
||||||
|
// ? 'You have changed the group name to "${widget.action.newGroupName}".'
|
||||||
|
// : '$maker has changed the group name to "${widget.action.newGroupName}".';
|
||||||
|
// icon = FontAwesomeIcons.pencil;
|
||||||
|
// case GroupActionType.createdGroup:
|
||||||
|
// icon = FontAwesomeIcons.penToSquare;
|
||||||
|
// text = (contact == null)
|
||||||
|
// ? 'You have created the group.'
|
||||||
|
// : '$maker has created the group.';
|
||||||
|
// case GroupActionType.removedMember:
|
||||||
|
// icon = FontAwesomeIcons.userMinus;
|
||||||
|
// text = (contact == null)
|
||||||
|
// ? 'You have removed $affected from the group.'
|
||||||
|
// : '$maker has removed $affected from the group.';
|
||||||
|
// case GroupActionType.addMember:
|
||||||
|
// icon = FontAwesomeIcons.userPlus;
|
||||||
|
// text = (contact == null)
|
||||||
|
// ? 'You have added $affected to the group.'
|
||||||
|
// : '$maker has added $affected to the group.';
|
||||||
|
// case GroupActionType.promoteToAdmin:
|
||||||
|
// icon = FontAwesomeIcons.key;
|
||||||
|
// text = (contact == null)
|
||||||
|
// ? 'You made $affected an admin.'
|
||||||
|
// : '$maker made $affected an admin.';
|
||||||
|
// case GroupActionType.demoteToMember:
|
||||||
|
// icon = FontAwesomeIcons.key;
|
||||||
|
// text = (contact == null)
|
||||||
|
// ? 'You revoked $affectedR admin rights.'
|
||||||
|
// : '$maker revoked $affectedR admin rights.';
|
||||||
|
// case GroupActionType.leftGroup:
|
||||||
|
// icon = FontAwesomeIcons.userMinus;
|
||||||
|
// text = (contact == null)
|
||||||
|
// ? 'You have left the group.'
|
||||||
|
// : '$maker has left the group.';
|
||||||
|
// }
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue