feat: Add strings 'You left the channel.' and 'Scan to join Channel' (#7266)

Close https://github.com/chatmail/core/issues/7233

Part of https://github.com/chatmail/core/issues/6884
This commit is contained in:
Hocuri
2025-10-02 16:57:24 +02:00
committed by GitHub
parent d509b0cf5c
commit 9ec0332483
6 changed files with 46 additions and 18 deletions

View File

@@ -279,7 +279,7 @@ pub enum StockMessage {
#[strum(props(fallback = "Member %1$s removed by %2$s."))]
MsgDelMemberBy = 131,
#[strum(props(fallback = "You left."))]
#[strum(props(fallback = "You left the group."))]
MsgYouLeftGroup = 132,
#[strum(props(fallback = "Group left by %1$s."))]
@@ -439,6 +439,12 @@ https://delta.chat/donate"))]
#[strum(props(fallback = "Missed Call"))]
MissedCall = 198,
#[strum(props(fallback = "You left the channel."))]
MsgYouLeftBroadcast = 200,
#[strum(props(fallback = "Scan to join channel %1$s"))]
SecureJoinBrodcastQRDescription = 201,
}
impl StockMessage {
@@ -711,7 +717,7 @@ pub(crate) async fn msg_group_left_remote(context: &Context) -> String {
translated(context, StockMessage::MsgILeftGroup).await
}
/// Stock string: `You left.` or `Group left by %1$s.`.
/// Stock string: `You left the group.` or `Group left by %1$s.`.
pub(crate) async fn msg_group_left_local(context: &Context, by_contact: ContactId) -> String {
if by_contact == ContactId::SELF {
translated(context, StockMessage::MsgYouLeftGroup).await
@@ -722,6 +728,11 @@ pub(crate) async fn msg_group_left_local(context: &Context, by_contact: ContactI
}
}
/// Stock string: `You left the channel.`
pub(crate) async fn msg_you_left_broadcast(context: &Context) -> String {
translated(context, StockMessage::MsgYouLeftBroadcast).await
}
/// Stock string: `You reacted %1$s to "%2$s"` or `%1$s reacted %2$s to "%3$s"`.
pub(crate) async fn msg_reacted(
context: &Context,
@@ -857,13 +868,20 @@ pub(crate) async fn setup_contact_qr_description(
.replace1(&name)
}
/// Stock string: `Scan to join %1$s`.
/// Stock string: `Scan to join group %1$s`.
pub(crate) async fn secure_join_group_qr_description(context: &Context, chat: &Chat) -> String {
translated(context, StockMessage::SecureJoinGroupQRDescription)
.await
.replace1(chat.get_name())
}
/// Stock string: `Scan to join channel %1$s`.
pub(crate) async fn secure_join_broadcast_qr_description(context: &Context, chat: &Chat) -> String {
translated(context, StockMessage::SecureJoinBrodcastQRDescription)
.await
.replace1(chat.get_name())
}
/// Stock string: `%1$s verified.`.
#[allow(dead_code)]
pub(crate) async fn contact_verified(context: &Context, contact: &Contact) -> String {