Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add message dialog localization #880

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions lib/components/chat_history/message.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
import 'package:rtchat/components/chat_history/ad.dart';
import 'package:rtchat/components/chat_history/auxiliary/realtimecash_donation.dart';
Expand Down Expand Up @@ -96,8 +97,9 @@ class ChatHistoryMessage extends StatelessWidget {
leading: const Icon(
Icons.volume_up_rounded,
color: Colors.deepPurpleAccent),
title: Text(
'Unmute ${m.author.displayName}'),
title: Text(AppLocalizations.of(context)!
.unmuteUser(m.author.displayName ??
m.author.login)),
onTap: () {
ttsModel.unmute(m.author);
Navigator.pop(context);
Expand All @@ -107,7 +109,9 @@ class ChatHistoryMessage extends StatelessWidget {
leading: const Icon(
Icons.volume_off_rounded,
color: Colors.redAccent),
title: Text('Mute ${m.author.displayName}'),
title: Text(AppLocalizations.of(context)!
.muteUser(m.author.displayName ??
m.author.login)),
onTap: () {
ttsModel.mute(m.author);
Navigator.pop(context);
Expand All @@ -116,7 +120,8 @@ class ChatHistoryMessage extends StatelessWidget {
ListTile(
leading: const Icon(Icons.delete,
color: Colors.redAccent),
title: const Text('Delete Message'),
title: Text(AppLocalizations.of(context)!
.deleteMessage),
onTap: () {
ActionsAdapter.instance
.delete(channel, m.messageId);
Expand All @@ -125,16 +130,19 @@ class ChatHistoryMessage extends StatelessWidget {
ListTile(
leading: const Icon(Icons.timer_outlined,
color: Colors.orangeAccent),
title:
Text('Timeout ${m.author.displayName}'),
title: Text(AppLocalizations.of(context)!
.timeoutUser(m.author.displayName ??
m.author.login)),
onTap: () {
Navigator.pop(context, true);
}),
ListTile(
leading: const Icon(
Icons.dnd_forwardslash_outlined,
color: Colors.redAccent),
title: Text('Ban ${m.author.displayName}'),
title: Text(AppLocalizations.of(context)!
.banUser(m.author.displayName ??
m.author.login)),
onTap: () {
ActionsAdapter.instance
.ban(channel, m.author.login);
Expand All @@ -143,7 +151,9 @@ class ChatHistoryMessage extends StatelessWidget {
ListTile(
leading: const Icon(Icons.circle_outlined,
color: Colors.greenAccent),
title: Text('Unban ${m.author.displayName}'),
title: Text(AppLocalizations.of(context)!
.unbanUser(m.author.displayName ??
m.author.login)),
onTap: () {
ActionsAdapter.instance
.unban(channel, m.author.login);
Expand All @@ -152,7 +162,8 @@ class ChatHistoryMessage extends StatelessWidget {
ListTile(
leading: const Icon(Icons.copy_outlined,
color: Colors.greenAccent),
title: const Text('Copy message'),
title: Text(AppLocalizations.of(context)!
.copyMessage),
onTap: () {
Clipboard.setData(
ClipboardData(text: m.message));
Expand All @@ -161,8 +172,9 @@ class ChatHistoryMessage extends StatelessWidget {
ListTile(
leading: const Icon(Icons.link_outlined,
color: Colors.blueAccent),
title: Text(
'View ${m.author.displayName}\'s profile'),
title: Text(AppLocalizations.of(context)!
.viewProfile(m.author.displayName ??
m.author.login)),
onTap: () {
openUrl(Uri.parse(
"https://www.twitch.tv/${m.author.displayName}"));
Expand All @@ -176,7 +188,8 @@ class ChatHistoryMessage extends StatelessWidget {
context: context,
builder: (context) {
return TimeoutDialog(
title: "Timeout ${m.author.displayName}",
title: AppLocalizations.of(context)!.timeoutUser(
m.author.displayName ?? m.author.login),
onPressed: (duration) {
ActionsAdapter.instance.timeout(
channel,
Expand Down
68 changes: 68 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -358,5 +358,73 @@
"format": "decimalPattern"
}
}
},
"unmuteUser": "Unmute {displayName}",
"@unmuteUser": {
"description": "Unmute option shown when long pressing on a chat message",
"placeholders": {
"displayName": {
"type": "String",
"example": "muxfd"
}
}
},
"muteUser": "Mute {displayName}",
"@muteUser": {
"description": "Mute option shown when long pressing on a chat message",
"placeholders": {
"displayName": {
"type": "String",
"example": "muxfd"
}
}
},
"timeoutUser": "Timeout {displayName}",
"@timeoutUser": {
"description": "Timeout option shown when long pressing on a chat message",
"placeholders": {
"displayName": {
"type": "String",
"example": "muxfd"
}
}
},
"banUser": "Ban {displayName}",
"@banUser": {
"description": "Ban option shown when long pressing on a chat message",
"placeholders": {
"displayName": {
"type": "String",
"example": "muxfd"
}
}
},
"unbanUser": "Unban {displayName}",
"@unbanUser": {
"description": "Unban option shown when long pressing on a chat message",
"placeholders": {
"displayName": {
"type": "String",
"example": "muxfd"
}
}
},
"viewProfile": "View {displayName}'s profile",
"@viewProfile": {
"description": "Unban option shown when long pressing on a chat message",
"placeholders": {
"displayName": {
"type": "String",
"example": "muxfd"
}
}
},
"copyMessage": "Copy Message",
"@copyMessage": {
"description": "Copy option shown when long pressing on a chat message"
},
"deleteMessage": "Delete Message",
"@deleteMessage": {
"description": "Delete option shown when long pressing on a chat message"
}
}
10 changes: 9 additions & 1 deletion lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,13 @@
"thirdPartyServicesSubtitle": "Conecta un servicio de terceros",
"followingEvent": "<bold>{displayName}</bold> te está siguiendo",
"followingEvent2": "<bold>{displayName}</bold> y <bold>{displayNameTwo}</bold> te están siguiendo",
"followingEvent3": "<bold>{displayName}</bold>, <bold>{displayNameTwo}</bold>, y {others} otros te están siguiendo"
"followingEvent3": "<bold>{displayName}</bold>, <bold>{displayNameTwo}</bold>, y {others} otros te están siguiendo",
"unmuteUser": "Quitar silencio a {displayName}",
"muteUser": "Silenciar a {displayName}",
"timeoutUser": "Suspender a {displayName}",
"banUser": "Bannear a {displayName}",
"unbanUser": "Quitar ban a {displayName}",
"viewProfile": "Ver perfil de {displayName}",
"copyMessage": "Copiar mensaje",
"deleteMessage": "Eliminar mensaje"
}