BlueGit

ict rusty-teams

fix(app): English UI strings for notifications

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-07 · 7 weeks ago

Hash
9c0a9281e6fa5579e5a8e65b1b4ff4f8a2303370
Parent
89a829d0
8 files changed +56 −56
crates/app/src/notify/center.rs +6 −6
@@ -640,7 +640,7 @@ impl NotificationCenter {
640 640 cx,
641 641 ))),
642 642 titlebar: Some(TitlebarOptions {
643 title: Some("Benachrichtigungen".into()),
643 title: Some("Notifications".into()),
644 644 ..Default::default()
645 645 }),
646 646 is_resizable: false,
@@ -662,7 +662,7 @@ impl NotificationCenter {
662 662 chat_title: "Mara Lindqvist".to_owned(),
663 663 sender_id: None,
664 664 sender_name: "Mara Lindqvist".to_owned(),
665 preview: Preview::Text("Das ist eine Testbenachrichtigung.".to_owned()),
665 preview: Preview::Text("This is a test notification.".to_owned()),
666 666 mentions_me: false,
667 667 muted: false,
668 668 };
@@ -753,7 +753,7 @@ fn demo_incoming() -> Vec<Incoming> {
753 753 ChatKind::Direct,
754 754 "Tobias Klein",
755 755 "Tobias Klein",
756 "Passt, ich schaue morgen drauf.",
756 "Sounds good, I will look at it tomorrow.",
757 757 false,
758 758 ),
759 759 item(
@@ -761,18 +761,18 @@ fn demo_incoming() -> Vec<Incoming> {
761 761 ChatKind::Group { member_count: 5 },
762 762 "Retro-Team",
763 763 "Priya Nair",
764 "Themen bitte bis 17 Uhr eintragen.",
764 "Please add topics by 5 pm.",
765 765 false,
766 766 ),
767 767 item(
768 768 "demo-toast-mention",
769 769 ChatKind::Channel {
770 team: "Plattform".to_owned(),
770 team: "Platform".to_owned(),
771 771 channel: "Releases".to_owned(),
772 772 },
773 773 "Releases",
774 774 "Mara Lindqvist",
775 "@Jonas kannst du den Merge freigeben? Pipeline wartet.",
775 "@Jonas can you approve the merge? The pipeline is waiting.",
776 776 true,
777 777 ),
778 778 ]
@@ -640,7 +640,7 @@ impl NotificationCenter {
640 cx,
640 cx,
641 ))),
641 ))),
642 titlebar: Some(TitlebarOptions {
642 titlebar: Some(TitlebarOptions {
643 title: Some("Benachrichtigungen".into()),
643 title: Some("Notifications".into()),
644 ..Default::default()
644 ..Default::default()
645 }),
645 }),
646 is_resizable: false,
646 is_resizable: false,
@@ -662,7 +662,7 @@ impl NotificationCenter {
662 chat_title: "Mara Lindqvist".to_owned(),
662 chat_title: "Mara Lindqvist".to_owned(),
663 sender_id: None,
663 sender_id: None,
664 sender_name: "Mara Lindqvist".to_owned(),
664 sender_name: "Mara Lindqvist".to_owned(),
665 preview: Preview::Text("Das ist eine Testbenachrichtigung.".to_owned()),
665 preview: Preview::Text("This is a test notification.".to_owned()),
666 mentions_me: false,
666 mentions_me: false,
667 muted: false,
667 muted: false,
668 };
668 };
@@ -753,7 +753,7 @@ fn demo_incoming() -> Vec<Incoming> {
753 ChatKind::Direct,
753 ChatKind::Direct,
754 "Tobias Klein",
754 "Tobias Klein",
755 "Tobias Klein",
755 "Tobias Klein",
756 "Passt, ich schaue morgen drauf.",
756 "Sounds good, I will look at it tomorrow.",
757 false,
757 false,
758 ),
758 ),
759 item(
759 item(
@@ -761,18 +761,18 @@ fn demo_incoming() -> Vec<Incoming> {
761 ChatKind::Group { member_count: 5 },
761 ChatKind::Group { member_count: 5 },
762 "Retro-Team",
762 "Retro-Team",
763 "Priya Nair",
763 "Priya Nair",
764 "Themen bitte bis 17 Uhr eintragen.",
764 "Please add topics by 5 pm.",
765 false,
765 false,
766 ),
766 ),
767 item(
767 item(
768 "demo-toast-mention",
768 "demo-toast-mention",
769 ChatKind::Channel {
769 ChatKind::Channel {
770 team: "Plattform".to_owned(),
770 team: "Platform".to_owned(),
771 channel: "Releases".to_owned(),
771 channel: "Releases".to_owned(),
772 },
772 },
773 "Releases",
773 "Releases",
774 "Mara Lindqvist",
774 "Mara Lindqvist",
775 "@Jonas kannst du den Merge freigeben? Pipeline wartet.",
775 "@Jonas can you approve the merge? The pipeline is waiting.",
776 true,
776 true,
777 ),
777 ),
778 ]
778 ]
crates/app/src/notify/incoming.rs +1 −1
@@ -7,7 +7,7 @@ use super::rules::{ChatKind, Incoming, Preview};
7 7 use crate::app_state::chat_title;
8 8
9 9 const RECENT_WINDOW: usize = 20;
10 const FILE_FALLBACK: &str = "Datei";
10 const FILE_FALLBACK: &str = "File";
11 11
12 12 pub struct IncomingTracker {
13 13 started: DateTime<Utc>,
@@ -7,7 +7,7 @@ use super::rules::{ChatKind, Incoming, Preview};
7use crate::app_state::chat_title;
7use crate::app_state::chat_title;
8
8
9const RECENT_WINDOW: usize = 20;
9const RECENT_WINDOW: usize = 20;
10const FILE_FALLBACK: &str = "Datei";
10const FILE_FALLBACK: &str = "File";
11
11
12pub struct IncomingTracker {
12pub struct IncomingTracker {
13 started: DateTime<Utc>,
13 started: DateTime<Utc>,
crates/app/src/notify/platform/windows_impl.rs +6 −6
@@ -176,7 +176,7 @@ pub fn set_badge(handle: NativeHandle, badge: Option<&Badge>) {
176 176 let Some(icon) = icon_from_badge(badge) else {
177 177 return;
178 178 };
179 let _ = taskbar.SetOverlayIcon(hwnd(handle), icon, w!("Ungelesene Chats"));
179 let _ = taskbar.SetOverlayIcon(hwnd(handle), icon, w!("Unread chats"));
180 180 let _ = DestroyIcon(icon);
181 181 }
182 182 }
@@ -237,17 +237,17 @@ pub struct Tray {
237 237 impl Tray {
238 238 pub fn new(sound_on: bool, do_not_disturb: bool) -> Option<Self> {
239 239 let (plain, with_dot) = tray_icons()?;
240 let open = MenuItem::with_id(ID_OPEN, "Rusty Teams öffnen", true, None);
241 let sound = CheckMenuItem::with_id(ID_SOUND, "Ton aus", true, !sound_on, None);
240 let open = MenuItem::with_id(ID_OPEN, "Open", true, None);
241 let sound = CheckMenuItem::with_id(ID_SOUND, "Mute sound", true, !sound_on, None);
242 242 let dnd = CheckMenuItem::with_id(
243 243 ID_DO_NOT_DISTURB,
244 "Nicht stören",
244 "Do not disturb",
245 245 true,
246 246 do_not_disturb,
247 247 None,
248 248 );
249 let settings = MenuItem::with_id(ID_SETTINGS, "Benachrichtigungen", true, None);
250 let quit = MenuItem::with_id(ID_QUIT, "Beenden", true, None);
249 let settings = MenuItem::with_id(ID_SETTINGS, "Notifications", true, None);
250 let quit = MenuItem::with_id(ID_QUIT, "Quit", true, None);
251 251 let menu = Menu::new();
252 252 menu.append_items(&[
253 253 &open,
@@ -176,7 +176,7 @@ pub fn set_badge(handle: NativeHandle, badge: Option<&Badge>) {
176 let Some(icon) = icon_from_badge(badge) else {
176 let Some(icon) = icon_from_badge(badge) else {
177 return;
177 return;
178 };
178 };
179 let _ = taskbar.SetOverlayIcon(hwnd(handle), icon, w!("Ungelesene Chats"));
179 let _ = taskbar.SetOverlayIcon(hwnd(handle), icon, w!("Unread chats"));
180 let _ = DestroyIcon(icon);
180 let _ = DestroyIcon(icon);
181 }
181 }
182 }
182 }
@@ -237,17 +237,17 @@ pub struct Tray {
237impl Tray {
237impl Tray {
238 pub fn new(sound_on: bool, do_not_disturb: bool) -> Option<Self> {
238 pub fn new(sound_on: bool, do_not_disturb: bool) -> Option<Self> {
239 let (plain, with_dot) = tray_icons()?;
239 let (plain, with_dot) = tray_icons()?;
240 let open = MenuItem::with_id(ID_OPEN, "Rusty Teams öffnen", true, None);
240 let open = MenuItem::with_id(ID_OPEN, "Open", true, None);
241 let sound = CheckMenuItem::with_id(ID_SOUND, "Ton aus", true, !sound_on, None);
241 let sound = CheckMenuItem::with_id(ID_SOUND, "Mute sound", true, !sound_on, None);
242 let dnd = CheckMenuItem::with_id(
242 let dnd = CheckMenuItem::with_id(
243 ID_DO_NOT_DISTURB,
243 ID_DO_NOT_DISTURB,
244 "Nicht stören",
244 "Do not disturb",
245 true,
245 true,
246 do_not_disturb,
246 do_not_disturb,
247 None,
247 None,
248 );
248 );
249 let settings = MenuItem::with_id(ID_SETTINGS, "Benachrichtigungen", true, None);
249 let settings = MenuItem::with_id(ID_SETTINGS, "Notifications", true, None);
250 let quit = MenuItem::with_id(ID_QUIT, "Beenden", true, None);
250 let quit = MenuItem::with_id(ID_QUIT, "Quit", true, None);
251 let menu = Menu::new();
251 let menu = Menu::new();
252 menu.append_items(&[
252 menu.append_items(&[
253 &open,
253 &open,
crates/app/src/notify/rules.rs +5 −5
@@ -22,10 +22,10 @@ impl Corner {
22 22
23 23 pub fn label(self) -> &'static str {
24 24 match self {
25 Corner::TopLeft => "Oben links",
26 Corner::TopRight => "Oben rechts",
27 Corner::BottomLeft => "Unten links",
28 Corner::BottomRight => "Unten rechts",
25 Corner::TopLeft => "Top left",
26 Corner::TopRight => "Top right",
27 Corner::BottomLeft => "Bottom left",
28 Corner::BottomRight => "Bottom right",
29 29 }
30 30 }
31 31
@@ -185,7 +185,7 @@ mod tests {
185 185 chat_title: "Chat".into(),
186 186 sender_id: Some("u1".into()),
187 187 sender_name: "Mara".into(),
188 preview: Preview::Text("Hallo".into()),
188 preview: Preview::Text("Hello".into()),
189 189 mentions_me: false,
190 190 muted: false,
191 191 }
@@ -22,10 +22,10 @@ impl Corner {
22
22
23 pub fn label(self) -> &'static str {
23 pub fn label(self) -> &'static str {
24 match self {
24 match self {
25 Corner::TopLeft => "Oben links",
25 Corner::TopLeft => "Top left",
26 Corner::TopRight => "Oben rechts",
26 Corner::TopRight => "Top right",
27 Corner::BottomLeft => "Unten links",
27 Corner::BottomLeft => "Bottom left",
28 Corner::BottomRight => "Unten rechts",
28 Corner::BottomRight => "Bottom right",
29 }
29 }
30 }
30 }
31
31
@@ -185,7 +185,7 @@ mod tests {
185 chat_title: "Chat".into(),
185 chat_title: "Chat".into(),
186 sender_id: Some("u1".into()),
186 sender_id: Some("u1".into()),
187 sender_name: "Mara".into(),
187 sender_name: "Mara".into(),
188 preview: Preview::Text("Hallo".into()),
188 preview: Preview::Text("Hello".into()),
189 mentions_me: false,
189 mentions_me: false,
190 muted: false,
190 muted: false,
191 }
191 }
crates/app/src/notify/settings_view.rs +12 −12
@@ -15,28 +15,28 @@ struct Row {
15 15
16 16 const ROWS: [Row; 5] = [
17 17 Row {
18 title: "Ton",
19 detail: "Nachricht und Erwähnung",
18 title: "Sound",
19 detail: "Messages and mentions",
20 20 field: |settings| &mut settings.sound,
21 21 },
22 22 Row {
23 title: "Nur Erwähnungen",
24 detail: "Direktnachrichten und @Erwähnungen",
23 title: "Mentions only",
24 detail: "Direct messages and @mentions",
25 25 field: |settings| &mut settings.mentions_only,
26 26 },
27 27 Row {
28 title: "Vorschau anzeigen",
29 detail: "Aus: nur \"Neue Nachricht\"",
28 title: "Show preview",
29 detail: "Off: only \"New message\"",
30 30 field: |settings| &mut settings.preview,
31 31 },
32 32 Row {
33 title: "Taskleiste blinken",
34 detail: "Bei Erwähnung, wenn das Fenster nicht aktiv ist",
33 title: "Flash taskbar",
34 detail: "On mention, when the window is not active",
35 35 field: |settings| &mut settings.flash,
36 36 },
37 37 Row {
38 title: "Beim Schließen in den Tray",
39 detail: "Das X im Titel versteckt das Fenster",
38 title: "Minimize to tray on close",
39 detail: "The title bar X hides the window",
40 40 field: |settings| &mut settings.close_to_tray,
41 41 },
42 42 ];
@@ -172,7 +172,7 @@ impl Render for SettingsView {
172 172 div()
173 173 .text_size(px(12.))
174 174 .text_color(theme::text_muted())
175 .child("Ecke auf dem Hauptbildschirm"),
175 .child("Corner of the main screen"),
176 176 ),
177 177 )
178 178 .child(button(corner.label()).on_click(move |_, _, cx| {
@@ -188,7 +188,7 @@ impl Render for SettingsView {
188 188 .w_full()
189 189 .px(px(20.))
190 190 .pt(px(12.))
191 .child(button("Testbenachrichtigung").on_click(move |_, _, cx| {
191 .child(button("Send test notification").on_click(move |_, _, cx| {
192 192 test_center.update(cx, |center, cx| center.send_test_notification(cx));
193 193 })),
194 194 )
@@ -15,28 +15,28 @@ struct Row {
15
15
16const ROWS: [Row; 5] = [
16const ROWS: [Row; 5] = [
17 Row {
17 Row {
18 title: "Ton",
18 title: "Sound",
19 detail: "Nachricht und Erwähnung",
19 detail: "Messages and mentions",
20 field: |settings| &mut settings.sound,
20 field: |settings| &mut settings.sound,
21 },
21 },
22 Row {
22 Row {
23 title: "Nur Erwähnungen",
23 title: "Mentions only",
24 detail: "Direktnachrichten und @Erwähnungen",
24 detail: "Direct messages and @mentions",
25 field: |settings| &mut settings.mentions_only,
25 field: |settings| &mut settings.mentions_only,
26 },
26 },
27 Row {
27 Row {
28 title: "Vorschau anzeigen",
28 title: "Show preview",
29 detail: "Aus: nur \"Neue Nachricht\"",
29 detail: "Off: only \"New message\"",
30 field: |settings| &mut settings.preview,
30 field: |settings| &mut settings.preview,
31 },
31 },
32 Row {
32 Row {
33 title: "Taskleiste blinken",
33 title: "Flash taskbar",
34 detail: "Bei Erwähnung, wenn das Fenster nicht aktiv ist",
34 detail: "On mention, when the window is not active",
35 field: |settings| &mut settings.flash,
35 field: |settings| &mut settings.flash,
36 },
36 },
37 Row {
37 Row {
38 title: "Beim Schließen in den Tray",
38 title: "Minimize to tray on close",
39 detail: "Das X im Titel versteckt das Fenster",
39 detail: "The title bar X hides the window",
40 field: |settings| &mut settings.close_to_tray,
40 field: |settings| &mut settings.close_to_tray,
41 },
41 },
42];
42];
@@ -172,7 +172,7 @@ impl Render for SettingsView {
172 div()
172 div()
173 .text_size(px(12.))
173 .text_size(px(12.))
174 .text_color(theme::text_muted())
174 .text_color(theme::text_muted())
175 .child("Ecke auf dem Hauptbildschirm"),
175 .child("Corner of the main screen"),
176 ),
176 ),
177 )
177 )
178 .child(button(corner.label()).on_click(move |_, _, cx| {
178 .child(button(corner.label()).on_click(move |_, _, cx| {
@@ -188,7 +188,7 @@ impl Render for SettingsView {
188 .w_full()
188 .w_full()
189 .px(px(20.))
189 .px(px(20.))
190 .pt(px(12.))
190 .pt(px(12.))
191 .child(button("Testbenachrichtigung").on_click(move |_, _, cx| {
191 .child(button("Send test notification").on_click(move |_, _, cx| {
192 test_center.update(cx, |center, cx| center.send_test_notification(cx));
192 test_center.update(cx, |center, cx| center.send_test_notification(cx));
193 })),
193 })),
194 )
194 )
crates/app/src/notify/stack.rs +1 −1
@@ -242,7 +242,7 @@ mod tests {
242 242 chat_title: "Chat".into(),
243 243 sender_id: None,
244 244 sender_name: "Mara".into(),
245 preview: Preview::Text("Hallo".into()),
245 preview: Preview::Text("Hello".into()),
246 246 mentions_me: mention,
247 247 muted: false,
248 248 }
@@ -242,7 +242,7 @@ mod tests {
242 chat_title: "Chat".into(),
242 chat_title: "Chat".into(),
243 sender_id: None,
243 sender_id: None,
244 sender_name: "Mara".into(),
244 sender_name: "Mara".into(),
245 preview: Preview::Text("Hallo".into()),
245 preview: Preview::Text("Hello".into()),
246 mentions_me: mention,
246 mentions_me: mention,
247 muted: false,
247 muted: false,
248 }
248 }
crates/app/src/notify/text.rs +14 −14
@@ -2,9 +2,9 @@ use super::rules::{ChatKind, Preview};
2 2 use super::stack::ToastModel;
3 3 use crate::format;
4 4
5 const PREVIEW_OFF: &str = "Neue Nachricht";
6 const IMAGE_LABEL: &str = "Bild";
7 const UNKNOWN_SENDER: &str = "Unbekannt";
5 const PREVIEW_OFF: &str = "New message";
6 const IMAGE_LABEL: &str = "Image";
7 const UNKNOWN_SENDER: &str = "Unknown";
8 8
9 9 #[derive(Debug, Clone, PartialEq, Eq)]
10 10 pub struct ToastText {
@@ -27,10 +27,10 @@ pub fn describe(model: &ToastModel, preview_on: bool) -> ToastText {
27 27 model.sender_name.as_str()
28 28 };
29 29 let (title, subtitle) = match &model.kind {
30 ChatKind::Direct => (sender.to_owned(), "Direkt".to_owned()),
30 ChatKind::Direct => (sender.to_owned(), "Direct".to_owned()),
31 31 ChatKind::Group { member_count } => (
32 32 model.chat_title.clone(),
33 format!("Gruppe, {member_count} Personen"),
33 format!("Group, {member_count} people"),
34 34 ),
35 35 ChatKind::Channel { team, channel } => (sender.to_owned(), format!("{team} > {channel}")),
36 36 };
@@ -100,10 +100,10 @@ mod tests {
100 100
101 101 #[test]
102 102 fn direct_shows_sender_and_plain_preview() {
103 let text = describe(&model(ChatKind::Direct, Preview::Text("Hallo".into())), true);
103 let text = describe(&model(ChatKind::Direct, Preview::Text("Hello".into())), true);
104 104 assert_eq!(text.title, "Priya Nair");
105 assert_eq!(text.subtitle, "Direkt");
106 assert_eq!(text.preview, "Hallo");
105 assert_eq!(text.subtitle, "Direct");
106 assert_eq!(text.preview, "Hello");
107 107 }
108 108
109 109 #[test]
@@ -113,39 +113,39 @@ mod tests {
113 113 true,
114 114 );
115 115 assert_eq!(text.title, "Retro-Team");
116 assert_eq!(text.subtitle, "Gruppe, 5 Personen");
116 assert_eq!(text.subtitle, "Group, 5 people");
117 117 assert_eq!(text.preview, "Priya: Hi");
118 118 }
119 119
120 120 #[test]
121 121 fn channel_shows_path_and_prefixes_sender() {
122 122 let kind = ChatKind::Channel {
123 team: "Plattform".into(),
123 team: "Platform".into(),
124 124 channel: "Releases".into(),
125 125 };
126 126 let text = describe(&model(kind, Preview::Text("Go".into())), true);
127 127 assert_eq!(text.title, "Priya Nair");
128 assert_eq!(text.subtitle, "Plattform > Releases");
128 assert_eq!(text.subtitle, "Platform > Releases");
129 129 assert_eq!(text.preview, "Priya: Go");
130 130 }
131 131
132 132 #[test]
133 133 fn preview_off_hides_content_but_keeps_name() {
134 134 let text = describe(&model(ChatKind::Direct, Preview::Text("geheim".into())), false);
135 assert_eq!(text.preview, "Neue Nachricht");
135 assert_eq!(text.preview, "New message");
136 136 assert!(!text.narration().contains("geheim"));
137 137 }
138 138
139 139 #[test]
140 140 fn image_only_is_flagged() {
141 141 let text = describe(&model(ChatKind::Direct, Preview::Image), true);
142 assert_eq!(text.preview, "Bild");
142 assert_eq!(text.preview, "Image");
143 143 assert!(text.image_only);
144 144 }
145 145
146 146 #[test]
147 147 fn mention_ranges_cover_first_word_after_at() {
148 let text = "Ping @Jonas kannst du @Mara fragen @";
148 let text = "Ping @Jonas can you ask @Mara @";
149 149 let found: Vec<&str> = mention_ranges(text).into_iter().map(|range| &text[range]).collect();
150 150 assert_eq!(found, ["@Jonas", "@Mara"]);
151 151 }
@@ -2,9 +2,9 @@ use super::rules::{ChatKind, Preview};
2use super::stack::ToastModel;
2use super::stack::ToastModel;
3use crate::format;
3use crate::format;
4
4
5const PREVIEW_OFF: &str = "Neue Nachricht";
5const PREVIEW_OFF: &str = "New message";
6const IMAGE_LABEL: &str = "Bild";
6const IMAGE_LABEL: &str = "Image";
7const UNKNOWN_SENDER: &str = "Unbekannt";
7const UNKNOWN_SENDER: &str = "Unknown";
8
8
9#[derive(Debug, Clone, PartialEq, Eq)]
9#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct ToastText {
10pub struct ToastText {
@@ -27,10 +27,10 @@ pub fn describe(model: &ToastModel, preview_on: bool) -> ToastText {
27 model.sender_name.as_str()
27 model.sender_name.as_str()
28 };
28 };
29 let (title, subtitle) = match &model.kind {
29 let (title, subtitle) = match &model.kind {
30 ChatKind::Direct => (sender.to_owned(), "Direkt".to_owned()),
30 ChatKind::Direct => (sender.to_owned(), "Direct".to_owned()),
31 ChatKind::Group { member_count } => (
31 ChatKind::Group { member_count } => (
32 model.chat_title.clone(),
32 model.chat_title.clone(),
33 format!("Gruppe, {member_count} Personen"),
33 format!("Group, {member_count} people"),
34 ),
34 ),
35 ChatKind::Channel { team, channel } => (sender.to_owned(), format!("{team} > {channel}")),
35 ChatKind::Channel { team, channel } => (sender.to_owned(), format!("{team} > {channel}")),
36 };
36 };
@@ -100,10 +100,10 @@ mod tests {
100
100
101 #[test]
101 #[test]
102 fn direct_shows_sender_and_plain_preview() {
102 fn direct_shows_sender_and_plain_preview() {
103 let text = describe(&model(ChatKind::Direct, Preview::Text("Hallo".into())), true);
103 let text = describe(&model(ChatKind::Direct, Preview::Text("Hello".into())), true);
104 assert_eq!(text.title, "Priya Nair");
104 assert_eq!(text.title, "Priya Nair");
105 assert_eq!(text.subtitle, "Direkt");
105 assert_eq!(text.subtitle, "Direct");
106 assert_eq!(text.preview, "Hallo");
106 assert_eq!(text.preview, "Hello");
107 }
107 }
108
108
109 #[test]
109 #[test]
@@ -113,39 +113,39 @@ mod tests {
113 true,
113 true,
114 );
114 );
115 assert_eq!(text.title, "Retro-Team");
115 assert_eq!(text.title, "Retro-Team");
116 assert_eq!(text.subtitle, "Gruppe, 5 Personen");
116 assert_eq!(text.subtitle, "Group, 5 people");
117 assert_eq!(text.preview, "Priya: Hi");
117 assert_eq!(text.preview, "Priya: Hi");
118 }
118 }
119
119
120 #[test]
120 #[test]
121 fn channel_shows_path_and_prefixes_sender() {
121 fn channel_shows_path_and_prefixes_sender() {
122 let kind = ChatKind::Channel {
122 let kind = ChatKind::Channel {
123 team: "Plattform".into(),
123 team: "Platform".into(),
124 channel: "Releases".into(),
124 channel: "Releases".into(),
125 };
125 };
126 let text = describe(&model(kind, Preview::Text("Go".into())), true);
126 let text = describe(&model(kind, Preview::Text("Go".into())), true);
127 assert_eq!(text.title, "Priya Nair");
127 assert_eq!(text.title, "Priya Nair");
128 assert_eq!(text.subtitle, "Plattform > Releases");
128 assert_eq!(text.subtitle, "Platform > Releases");
129 assert_eq!(text.preview, "Priya: Go");
129 assert_eq!(text.preview, "Priya: Go");
130 }
130 }
131
131
132 #[test]
132 #[test]
133 fn preview_off_hides_content_but_keeps_name() {
133 fn preview_off_hides_content_but_keeps_name() {
134 let text = describe(&model(ChatKind::Direct, Preview::Text("geheim".into())), false);
134 let text = describe(&model(ChatKind::Direct, Preview::Text("geheim".into())), false);
135 assert_eq!(text.preview, "Neue Nachricht");
135 assert_eq!(text.preview, "New message");
136 assert!(!text.narration().contains("geheim"));
136 assert!(!text.narration().contains("geheim"));
137 }
137 }
138
138
139 #[test]
139 #[test]
140 fn image_only_is_flagged() {
140 fn image_only_is_flagged() {
141 let text = describe(&model(ChatKind::Direct, Preview::Image), true);
141 let text = describe(&model(ChatKind::Direct, Preview::Image), true);
142 assert_eq!(text.preview, "Bild");
142 assert_eq!(text.preview, "Image");
143 assert!(text.image_only);
143 assert!(text.image_only);
144 }
144 }
145
145
146 #[test]
146 #[test]
147 fn mention_ranges_cover_first_word_after_at() {
147 fn mention_ranges_cover_first_word_after_at() {
148 let text = "Ping @Jonas kannst du @Mara fragen @";
148 let text = "Ping @Jonas can you ask @Mara @";
149 let found: Vec<&str> = mention_ranges(text).into_iter().map(|range| &text[range]).collect();
149 let found: Vec<&str> = mention_ranges(text).into_iter().map(|range| &text[range]).collect();
150 assert_eq!(found, ["@Jonas", "@Mara"]);
150 assert_eq!(found, ["@Jonas", "@Mara"]);
151 }
151 }
crates/app/src/notify/toast.rs +11 −11
@@ -45,7 +45,7 @@ impl ToastView {
45 45 TextareaState::new(window, cx)
46 46 .auto_grow(1, 4)
47 47 .submit_on_enter(true)
48 .placeholder("Antworten ...")
48 .placeholder("Reply ...")
49 49 });
50 50 let subscriptions = vec![
51 51 cx.subscribe_in(&input, window, |this, input, event: &InputEvent, window, cx| {
@@ -238,10 +238,10 @@ impl ToastView {
238 238 .into_any_element();
239 239 }
240 240 if model.mentions_me {
241 return side_chip("Erwähnung".to_owned(), true).into_any_element();
241 return side_chip("Mention".to_owned(), true).into_any_element();
242 242 }
243 243 if model.count > 1 {
244 return side_chip(format!("{} neue", model.count), false).into_any_element();
244 return side_chip(format!("{} new", model.count), false).into_any_element();
245 245 }
246 246 div()
247 247 .text_size(px(12.))
@@ -314,12 +314,12 @@ impl ToastView {
314 314 .w_full()
315 315 .mt(px(4.))
316 316 .justify_between()
317 .child(pill_button("Gelesen", "done", false).on_click(move |_, _, cx| {
317 .child(pill_button("Mark as read", "done", false).on_click(move |_, _, cx| {
318 318 cx.stop_propagation();
319 319 center.update(cx, |center, cx| center.mark_read(id, cx));
320 320 }))
321 321 .child(
322 pill_button("Antworten", "reply", true).on_click(cx.listener(
322 pill_button("Reply", "reply", true).on_click(cx.listener(
323 323 |this, _, window, cx| {
324 324 cx.stop_propagation();
325 325 this.open_reply(window, cx);
@@ -398,17 +398,17 @@ impl ToastView {
398 398 .text_size(px(11.))
399 399 .text_color(theme::text_muted())
400 400 .child(hint("Enter", "senden"))
401 .child(hint("Umschalt+Enter", "Zeilenumbruch"))
402 .child(hint("Esc", "schließen")),
401 .child(hint("Shift+Enter", "new line"))
402 .child(hint("Esc", "close")),
403 403 )
404 404 }
405 405
406 406 fn confirmation(&self, model: &ToastModel, cx: &mut Context<Self>) -> Div {
407 407 let sent = model.reply == ReplyState::Sent;
408 408 let label = if sent {
409 format!("Gesendet an {}", target_name(model))
409 format!("Sent to {}", target_name(model))
410 410 } else {
411 "Senden fehlgeschlagen".to_owned()
411 "Couldn't send".to_owned()
412 412 };
413 413 let (icon_name, tone) = if sent {
414 414 ("check_circle", theme::green())
@@ -439,7 +439,7 @@ impl ToastView {
439 439 )
440 440 })
441 441 .when(!sent, |row| {
442 row.child(pill_button("Erneut", "reply", true).on_click(cx.listener(
442 row.child(pill_button("Retry", "reply", true).on_click(cx.listener(
443 443 |this, _, _, cx| {
444 444 cx.stop_propagation();
445 445 this.retry(cx);
@@ -593,7 +593,7 @@ impl Render for PillView {
593 593 .text_size(px(13.))
594 594 .font_weight(FontWeight::SEMIBOLD)
595 595 .text_color(theme::text())
596 .child(format!("+{hidden} weitere"))
596 .child(format!("+{hidden} more"))
597 597 .on_click(move |_, _, cx| {
598 598 center.update(cx, |center, cx| center.open_chat_list(cx));
599 599 })
@@ -45,7 +45,7 @@ impl ToastView {
45 TextareaState::new(window, cx)
45 TextareaState::new(window, cx)
46 .auto_grow(1, 4)
46 .auto_grow(1, 4)
47 .submit_on_enter(true)
47 .submit_on_enter(true)
48 .placeholder("Antworten ...")
48 .placeholder("Reply ...")
49 });
49 });
50 let subscriptions = vec![
50 let subscriptions = vec![
51 cx.subscribe_in(&input, window, |this, input, event: &InputEvent, window, cx| {
51 cx.subscribe_in(&input, window, |this, input, event: &InputEvent, window, cx| {
@@ -238,10 +238,10 @@ impl ToastView {
238 .into_any_element();
238 .into_any_element();
239 }
239 }
240 if model.mentions_me {
240 if model.mentions_me {
241 return side_chip("Erwähnung".to_owned(), true).into_any_element();
241 return side_chip("Mention".to_owned(), true).into_any_element();
242 }
242 }
243 if model.count > 1 {
243 if model.count > 1 {
244 return side_chip(format!("{} neue", model.count), false).into_any_element();
244 return side_chip(format!("{} new", model.count), false).into_any_element();
245 }
245 }
246 div()
246 div()
247 .text_size(px(12.))
247 .text_size(px(12.))
@@ -314,12 +314,12 @@ impl ToastView {
314 .w_full()
314 .w_full()
315 .mt(px(4.))
315 .mt(px(4.))
316 .justify_between()
316 .justify_between()
317 .child(pill_button("Gelesen", "done", false).on_click(move |_, _, cx| {
317 .child(pill_button("Mark as read", "done", false).on_click(move |_, _, cx| {
318 cx.stop_propagation();
318 cx.stop_propagation();
319 center.update(cx, |center, cx| center.mark_read(id, cx));
319 center.update(cx, |center, cx| center.mark_read(id, cx));
320 }))
320 }))
321 .child(
321 .child(
322 pill_button("Antworten", "reply", true).on_click(cx.listener(
322 pill_button("Reply", "reply", true).on_click(cx.listener(
323 |this, _, window, cx| {
323 |this, _, window, cx| {
324 cx.stop_propagation();
324 cx.stop_propagation();
325 this.open_reply(window, cx);
325 this.open_reply(window, cx);
@@ -398,17 +398,17 @@ impl ToastView {
398 .text_size(px(11.))
398 .text_size(px(11.))
399 .text_color(theme::text_muted())
399 .text_color(theme::text_muted())
400 .child(hint("Enter", "senden"))
400 .child(hint("Enter", "senden"))
401 .child(hint("Umschalt+Enter", "Zeilenumbruch"))
401 .child(hint("Shift+Enter", "new line"))
402 .child(hint("Esc", "schließen")),
402 .child(hint("Esc", "close")),
403 )
403 )
404 }
404 }
405
405
406 fn confirmation(&self, model: &ToastModel, cx: &mut Context<Self>) -> Div {
406 fn confirmation(&self, model: &ToastModel, cx: &mut Context<Self>) -> Div {
407 let sent = model.reply == ReplyState::Sent;
407 let sent = model.reply == ReplyState::Sent;
408 let label = if sent {
408 let label = if sent {
409 format!("Gesendet an {}", target_name(model))
409 format!("Sent to {}", target_name(model))
410 } else {
410 } else {
411 "Senden fehlgeschlagen".to_owned()
411 "Couldn't send".to_owned()
412 };
412 };
413 let (icon_name, tone) = if sent {
413 let (icon_name, tone) = if sent {
414 ("check_circle", theme::green())
414 ("check_circle", theme::green())
@@ -439,7 +439,7 @@ impl ToastView {
439 )
439 )
440 })
440 })
441 .when(!sent, |row| {
441 .when(!sent, |row| {
442 row.child(pill_button("Erneut", "reply", true).on_click(cx.listener(
442 row.child(pill_button("Retry", "reply", true).on_click(cx.listener(
443 |this, _, _, cx| {
443 |this, _, _, cx| {
444 cx.stop_propagation();
444 cx.stop_propagation();
445 this.retry(cx);
445 this.retry(cx);
@@ -593,7 +593,7 @@ impl Render for PillView {
593 .text_size(px(13.))
593 .text_size(px(13.))
594 .font_weight(FontWeight::SEMIBOLD)
594 .font_weight(FontWeight::SEMIBOLD)
595 .text_color(theme::text())
595 .text_color(theme::text())
596 .child(format!("+{hidden} weitere"))
596 .child(format!("+{hidden} more"))
597 .on_click(move |_, _, cx| {
597 .on_click(move |_, _, cx| {
598 center.update(cx, |center, cx| center.open_chat_list(cx));
598 center.update(cx, |center, cx| center.open_chat_list(cx));
599 })
599 })