BlueGit

ict rusty-teams

Merge pull request #22: feat(ui): English and German UI locale with OS default

metis Daniel Däschle · pushed by metis

Authored 2026-11-13 · 2 weeks ago

Hash
8ba8a6e91a01bf2b20c8b13f26a7066c8e5c2222
51 files changed +2398 −362
crates/app-base/Cargo.toml +1 −0
@@ -30,6 +30,7 @@ image = { version = "0.25", default-features = false, features = ["bmp", "gif",
30 30 raw-window-handle = "0.6"
31 31 sha2 = "0.10"
32 32 sys-locale = "0.3"
33 rust-i18n = "4.2"
33 34 resvg = { version = "0.46", default-features = false, features = ["text"] }
34 35
35 36 [target.'cfg(target_os = "linux")'.dependencies]
@@ -30,6 +30,7 @@ image = { version = "0.25", default-features = false, features = ["bmp", "gif",
30raw-window-handle = "0.6"
30raw-window-handle = "0.6"
31sha2 = "0.10"
31sha2 = "0.10"
32sys-locale = "0.3"
32sys-locale = "0.3"
33rust-i18n = "4.2"
33resvg = { version = "0.46", default-features = false, features = ["text"] }
34resvg = { version = "0.46", default-features = false, features = ["text"] }
34
35
35[target.'cfg(target_os = "linux")'.dependencies]
36[target.'cfg(target_os = "linux")'.dependencies]
crates/app-base/locales/app.yml added +1168 −0
@@ -0,0 +1,1168 @@
1 _version: 2
2 common:
3 cancel:
4 en: Cancel
5 de: Abbrechen
6 save:
7 en: Save
8 de: Speichern
9 close:
10 en: Close
11 de: Schließen
12 delete:
13 en: Delete
14 de: Löschen
15 ok:
16 en: OK
17 de: OK
18 add:
19 en: Add
20 de: Hinzufügen
21 remove:
22 en: Remove
23 de: Entfernen
24 join:
25 en: Join
26 de: Beitreten
27 leave:
28 en: Leave
29 de: Verlassen
30 retry:
31 en: Retry
32 de: Erneut versuchen
33 invite:
34 en: Invite
35 de: Einladen
36 admit:
37 en: Admit
38 de: Zulassen
39 deny:
40 en: Deny
41 de: Ablehnen
42 stop:
43 en: Stop
44 de: Stoppen
45 resume:
46 en: Resume
47 de: Fortsetzen
48 done:
49 en: Done
50 de: Fertig
51 send:
52 en: Send
53 de: Senden
54 sending:
55 en: Sending...
56 de: Wird gesendet...
57 you:
58 en: You
59 de: Sie
60 create:
61 en: Create
62 de: Erstellen
63 attach:
64 en: Attach
65 de: Anhängen
66 chat:
67 en: Chat
68 de: Chat
69 call:
70 en: Call
71 de: Anruf
72 settings:
73 en: Settings
74 de: Einstellungen
75 open:
76 en: Open
77 de: Öffnen
78 quit:
79 en: Quit
80 de: Beenden
81 notice:
82 generic_detail:
83 en: "Something went wrong: %{detail}"
84 de: "Etwas ist schiefgelaufen: %{detail}"
85 settings:
86 search:
87 no_results:
88 en: No settings found
89 de: Keine Einstellungen gefunden
90 nav:
91 general:
92 en: General
93 de: Allgemein
94 notifications:
95 en: Notifications and activity
96 de: Benachrichtigungen und Aktivität
97 appearance:
98 en: Appearance and accessibility
99 de: Darstellung und Barrierefreiheit
100 chats:
101 en: Chats and channels
102 de: Chats und Kanäle
103 calls:
104 en: Calls
105 de: Anrufe
106 calendar:
107 en: Calendar
108 de: Kalender
109 devices:
110 en: Devices
111 de: Geräte
112 agents:
113 en: Agents
114 de: Agents
115 mcp:
116 en: MCP
117 de: MCP
118 about:
119 en: About
120 de: Info
121 caption:
122 system:
123 en: SYSTEM
124 de: SYSTEM
125 compose_box:
126 en: COMPOSE BOX
127 de: EINGABEFELD
128 translation:
129 en: TRANSLATION
130 de: ÜBERSETZUNG
131 language:
132 en: LANGUAGE
133 de: SPRACHE
134 theme:
135 en: THEME
136 de: DESIGN
137 app_icon:
138 en: APP ICON
139 de: APP-SYMBOL
140 appearance_and_sound:
141 en: APPEARANCE AND SOUND
142 de: DARSTELLUNG UND TON
143 sound:
144 en: SOUND
145 de: TON
146 general:
147 auto_start:
148 en: Auto-start Teams
149 de: Teams automatisch starten
150 open_in_background:
151 en: Open application in background
152 de: Anwendung im Hintergrund starten
153 close_to_tray:
154 en: On close, keep the application running
155 de: Beim Schließen Anwendung weiterlaufen lassen
156 close_to_tray_detail:
157 en: The title bar X hides the window to the tray
158 de: Das X in der Titelleiste blendet das Fenster ins Infobereich-Symbol aus
159 up_arrow:
160 en: Up arrow key behaviour in compose box
161 de: Verhalten der Aufwärtspfeil-Taste im Eingabefeld
162 up_arrow_detail:
163 en: Choose what happens when you press Up arrow at the beginning of the compose box.
164 de: Legen Sie fest, was passiert, wenn Sie am Anfang des Eingabefelds die Aufwärtspfeil-Taste drücken.
165 translation_not_loaded:
166 en: Translation settings not loaded yet
167 de: Übersetzungseinstellungen noch nicht geladen
168 translation_title:
169 en: Translation
170 de: Übersetzung
171 translate_into:
172 en: Translate messages into this language
173 de: Nachrichten in diese Sprache übersetzen
174 behavior_title:
175 en: How to handle messages in other languages
176 de: Umgang mit Nachrichten in anderen Sprachen
177 behavior_ask:
178 en: Ask me before translating
179 de: Vor dem Übersetzen nachfragen
180 behavior_auto:
181 en: Auto-translate all messages
182 de: Alle Nachrichten automatisch übersetzen
183 behavior_never:
184 en: Never translate
185 de: Nie übersetzen
186 never_translate:
187 en: Never translate messages in these languages
188 de: Nachrichten in diesen Sprachen nie übersetzen
189 notifications:
190 flash_taskbar:
191 en: Flash taskbar when notifications are received
192 de: Taskleiste bei Benachrichtigungen blinken lassen
193 flash_taskbar_detail:
194 en: On new messages, until you open the window
195 de: Bei neuen Nachrichten, bis Sie das Fenster öffnen
196 play_sounds:
197 en: Play sounds with notifications
198 de: Töne bei Benachrichtigungen abspielen
199 urgent_sounds:
200 en: Play sounds with urgent and priority contact notifications
201 de: Töne bei dringenden und Prioritätskontakt-Benachrichtigungen
202 call_sounds:
203 en: Play sounds with incoming calls, requests to join, and meeting start notifications
204 de: Töne bei eingehenden Anrufen, Beitrittsanfragen und Besprechungsstarts
205 busy_sounds:
206 en: Play sounds when I'm busy or in a meeting
207 de: Töne abspielen, wenn ich beschäftigt bin oder in einer Besprechung
208 hide_in_calls:
209 en: Hide notifications during calls and meetings
210 de: Benachrichtigungen während Anrufen und Besprechungen ausblenden
211 hide_in_calls_detail:
212 en: No message toasts while a call is active
213 de: Keine Nachrichten-Toasts während ein Anruf aktiv ist
214 position:
215 en: Position on the screen
216 de: Position auf dem Bildschirm
217 position_detail:
218 en: Corner of the main screen
219 de: Ecke des Hauptbildschirms
220 test:
221 en: Test notification
222 de: Testbenachrichtigung
223 test_detail:
224 en: Shows a toast with the settings above
225 de: Zeigt einen Toast mit den obigen Einstellungen
226 send_test:
227 en: Send test notification
228 de: Testbenachrichtigung senden
229 notification_sound:
230 en: Notification sound
231 de: Benachrichtigungston
232 urgent_sound:
233 en: Urgent sound
234 de: Dringlichkeitston
235 chat_messages:
236 en: Chat message notifications
237 de: Chatnachrichten-Benachrichtigungen
238 meeting_chats:
239 en: Meeting chat notifications
240 de: Besprechungschat-Benachrichtigungen
241 likes_reactions:
242 en: Likes and reactions
243 de: Likes und Reaktionen
244 teams_channels:
245 en: Teams and channels
246 de: Teams und Kanäle
247 show_preview:
248 en: Show message preview
249 de: Nachrichtenvorschau anzeigen
250 appearance:
251 color_scheme:
252 en: Color scheme
253 de: Farbschema
254 color_scheme_detail:
255 en: The colors to use for Rusty Teams
256 de: Die Farben für Rusty Teams
257 theme:
258 en: Theme
259 de: Design
260 theme_detail:
261 en: The theme to use for Teams
262 de: Das Design für Teams
263 theme_follow_os:
264 en: Follow operating system theme
265 de: Systemdesign folgen
266 theme_light:
267 en: Light
268 de: Hell
269 theme_dark:
270 en: Dark
271 de: Dunkel
272 theme_high_contrast:
273 en: High contrast
274 de: Hoher Kontrast
275 app_icon:
276 en: App icon
277 de: App-Symbol
278 app_icon_detail_windows:
279 en: Shown in the title bar, taskbar and tray. Pinned shortcuts keep the icon of the .exe
280 de: In Titelleiste, Taskleiste und Infobereich. Angeheftete Verknüpfungen behalten das Symbol der .exe
281 app_icon_detail:
282 en: Shown in the title bar, taskbar and tray
283 de: In Titelleiste, Taskleiste und Infobereich
284 language:
285 title:
286 en: Language
287 de: Sprache
288 detail:
289 en: Language for Rusty Teams and controls
290 de: Sprache für Rusty Teams und Steuerelemente
291 follow_system:
292 en: Follow system
293 de: Systemeinstellung folgen
294 english:
295 en: English
296 de: Englisch
297 german:
298 en: Deutsch
299 de: Deutsch
300 chats:
301 density:
302 en: Message density
303 de: Nachrichtendichte
304 read_receipts:
305 en: Read receipts
306 de: Lesebestätigungen
307 message_actions:
308 en: Show message actions on right click
309 de: Nachrichtenaktionen per Rechtsklick anzeigen
310 muted_section:
311 en: Show muted items in their own section
312 de: Stummgeschaltete Einträge in eigenem Abschnitt anzeigen
313 enter_to:
314 en: When writing a message, press Enter to
315 de: Beim Schreiben einer Nachricht führt Eingabetaste zu
316 markdown:
317 en: Format messages using mark-down
318 de: Nachrichten mit Mark-down formatieren
319 markdown_detail:
320 en: Use mark-down language to define the structure and appearance of messages. Your formatting will take effect once you send your message. When this is on, the formatting options menu won't be visible.
321 de: Verwenden Sie Mark-down, um Struktur und Darstellung von Nachrichten festzulegen. Die Formatierung gilt nach dem Senden. Ist diese Option aktiv, ist das Formatierungsmenü ausgeblendet.
322 calls:
323 ringtones:
324 en: Ringtones
325 de: Klingeltöne
326 rail:
327 activity:
328 en: Activity
329 de: Aktivität
330 chat:
331 en: Chat
332 de: Chat
333 teams:
334 en: Teams
335 de: Teams
336 calendar:
337 en: Calendar
338 de: Kalender
339 calls:
340 en: Calls
341 de: Anrufe
342 agents:
343 en: Agents
344 de: Agents
345 shortcut_activity:
346 en: Open Activity
347 de: Aktivität öffnen
348 shortcut_chats:
349 en: Show Chats
350 de: Chats anzeigen
351 shortcut_channels:
352 en: Show Channels
353 de: Kanäle anzeigen
354 shortcut_calendar:
355 en: Open Calendar
356 de: Kalender öffnen
357 shortcut_calls:
358 en: Show Calls
359 de: Anrufe anzeigen
360 shortcut_agents:
361 en: Open Agents
362 de: Agents öffnen
363 tray:
364 open:
365 en: Open
366 de: Öffnen
367 quit:
368 en: Quit
369 de: Beenden
370 do_not_disturb:
371 en: Do not disturb
372 de: Nicht stören
373 notifications:
374 en: Notifications
375 de: Benachrichtigungen
376 mute_sound:
377 en: Mute sound
378 de: Ton stumm schalten
379 calls:
380 notice:
381 not_connected:
382 en: Not connected to Teams yet
383 de: Noch nicht mit Teams verbunden
384 read_only:
385 en: Calls are off in read-only mode
386 de: Anrufe sind im Nur-Lesen-Modus deaktiviert
387 not_callable:
388 en: This chat cannot be called
389 de: Dieser Chat kann nicht angerufen werden
390 meeting_unavailable:
391 en: This meeting cannot be joined
392 de: Dieser Besprechung kann nicht beigetreten werden
393 answer_failed:
394 en: Could not answer the call
395 de: Anruf konnte nicht angenommen werden
396 consult_ended:
397 en: The consultation ended
398 de: Die Rücksprache ist beendet
399 report_saved:
400 en: Test report saved
401 de: Testbericht gespeichert
402 response_failed:
403 en: Could not send your response
404 de: Ihre Antwort konnte nicht gesendet werden
405 delete_failed:
406 en: Could not delete the meeting
407 de: Besprechung konnte nicht gelöscht werden
408 delete_read_only:
409 en: Meetings cannot be deleted in read-only mode.
410 de: Besprechungen können im Nur-Lesen-Modus nicht gelöscht werden.
411 no_meeting_chat:
412 en: This meeting chat is not available
413 de: Dieser Besprechungschat ist nicht verfügbar
414 invite_failed:
415 en: Could not add that person
416 de: Diese Person konnte nicht hinzugefügt werden
417 no_peer:
418 en: This call cannot be extended
419 de: Dieser Anruf kann nicht erweitert werden
420 missed:
421 en: Call missed
422 de: Anruf verpasst
423 not_found:
424 en: Could not find that meeting
425 de: Diese Besprechung wurde nicht gefunden
426 meet_now_failed:
427 en: Could not start the meeting
428 de: Besprechung konnte nicht gestartet werden
429 consent_first:
430 en: Accept the recording notice first
431 de: Bitte zuerst den Aufzeichnungshinweis bestätigen
432 on_hold:
433 en: Resume the call first
434 de: Setzen Sie den Anruf zuerst fort
435 change_running:
436 en: Another change is still running, try again in a moment
437 de: Eine andere Änderung läuft noch, versuchen Sie es gleich erneut
438 video_failed:
439 en: Video could not start, the call stays audio only
440 de: Video konnte nicht starten, der Anruf bleibt nur Audio
441 share_queued:
442 en: Sharing starts in a moment
443 de: Freigabe startet gleich
444 share_refused:
445 en: The other side did not accept the screen share
446 de: Die Gegenseite hat die Bildschirmfreigabe nicht akzeptiert
447 portal_unavailable:
448 en: Screen sharing needs a desktop portal on this system
449 de: Bildschirmfreigabe benötigt auf diesem System ein Desktop-Portal
450 files_later:
451 en: Files can be added once the chat exists.
452 de: Dateien können hinzugefügt werden, sobald der Chat existiert.
453 calendar_load_failed:
454 en: We couldn't load your calendar.
455 de: Ihr Kalender konnte nicht geladen werden.
456 no_calls:
457 en: No calls yet
458 de: Noch keine Anrufe
459 video_starts_once_connected:
460 en: Video starts once the call is connected
461 de: Video startet, sobald der Anruf verbunden ist
462 call_transferred:
463 en: Call transferred
464 de: Anruf weitergeleitet
465 transfer_failed:
466 en: The transfer did not go through
467 de: Die Weiterleitung ist fehlgeschlagen
468 recording_join_failed:
469 en: The recording service could not join
470 de: Der Aufzeichnungsdienst konnte nicht beitreten
471 captions_join_failed:
472 en: The captions service could not join
473 de: Der Untertitel-Dienst konnte nicht beitreten
474 caption_language_failed:
475 en: Could not change the spoken language
476 de: Gesprochene Sprache konnte nicht geändert werden
477 camera_start:
478 en: "Camera could not start: %{detail}"
479 de: "Kamera konnte nicht starten: %{detail}"
480 camera_restart:
481 en: "Camera could not restart: %{detail}"
482 de: "Kamera konnte nicht neu starten: %{detail}"
483 sharing_start:
484 en: "Sharing could not start: %{detail}"
485 de: "Freigabe konnte nicht starten: %{detail}"
486 raise_hand_failed:
487 en: Could not raise your hand
488 de: Hand heben ist fehlgeschlagen
489 lower_hand_failed:
490 en: Could not lower your hand
491 de: Hand senken ist fehlgeschlagen
492 lower_that_hand_failed:
493 en: Could not lower that hand
494 de: Diese Hand konnte nicht gesenkt werden
495 lower_all_hands_failed:
496 en: Could not lower all hands
497 de: Alle Hände konnten nicht gesenkt werden
498 confirm_recording_failed:
499 en: Could not confirm the recording notice
500 de: Aufzeichnungshinweis konnte nicht bestätigt werden
501 hold_failed:
502 en: Could not put the call on hold
503 de: Anruf konnte nicht gehalten werden
504 resume_failed:
505 en: Could not resume the call
506 de: Anruf konnte nicht fortgesetzt werden
507 transfer_not_allowed:
508 en: This call cannot be transferred
509 de: Dieser Anruf kann nicht weitergeleitet werden
510 transfer_call_failed:
511 en: Could not transfer the call
512 de: Anruf konnte nicht weitergeleitet werden
513 transferring:
514 en: "Transferring to %{detail}..."
515 de: "Weiterleitung an %{detail}..."
516 whiteboards_meetings_only:
517 en: Whiteboards belong to meetings
518 de: Whiteboards gehören zu Besprechungen
519 whiteboard_open_failed:
520 en: The whiteboard could not be opened
521 de: Das Whiteboard konnte nicht geöffnet werden
522 reaction_failed:
523 en: Could not send the reaction
524 de: Reaktion konnte nicht gesendet werden
525 recording_not_started:
526 en: The recording did not start
527 de: Die Aufzeichnung hat nicht gestartet
528 recording_start_failed:
529 en: The recording could not start
530 de: Die Aufzeichnung konnte nicht starten
531 captions_start_failed:
532 en: Captions could not start
533 de: Untertitel konnten nicht starten
534 hold_change_failed:
535 en: The hold did not go through
536 de: Halten ist fehlgeschlagen
537 recording_stop_failed:
538 en: The recording could not be stopped
539 de: Die Aufzeichnung konnte nicht gestoppt werden
540 background_image_failed:
541 en: That background image could not be used
542 de: Dieses Hintergrundbild konnte nicht verwendet werden
543 camera_stopped:
544 en: "Camera stopped: %{detail}"
545 de: "Kamera gestoppt: %{detail}"
546 screen_share_stopped:
547 en: "Screen share stopped: %{detail}"
548 de: "Bildschirmfreigabe gestoppt: %{detail}"
549 admit_failed:
550 en: Could not admit that person
551 de: Diese Person konnte nicht zugelassen werden
552 admit_all_failed:
553 en: Could not admit everyone
554 de: Nicht alle konnten zugelassen werden
555 deny_failed:
556 en: Could not deny that person
557 de: Diese Person konnte nicht abgewiesen werden
558 remove_participant_failed:
559 en: Could not remove that person
560 de: Diese Person konnte nicht entfernt werden
561 mute_participant_failed:
562 en: Could not mute that person
563 de: Diese Person konnte nicht stummgeschaltet werden
564 mute_all_failed:
565 en: Could not mute everyone
566 de: Nicht alle konnten stummgeschaltet werden
567 meeting_lock_failed:
568 en: Could not change the meeting lock
569 de: Besprechungssperre konnte nicht geändert werden
570 change_role_failed:
571 en: Could not change that role
572 de: Diese Rolle konnte nicht geändert werden
573 mic_setting_failed:
574 en: Could not change that microphone setting
575 de: Diese Mikrofoneinstellung konnte nicht geändert werden
576 camera_setting_failed:
577 en: Could not change that camera setting
578 de: Diese Kameraeinstellung konnte nicht geändert werden
579 attendee_settings_failed:
580 en: Could not change the attendee settings
581 de: Teilnehmereinstellungen konnten nicht geändert werden
582 invite_person_failed:
583 en: Could not invite that person
584 de: Diese Person konnte nicht eingeladen werden
585 spotlight_failed:
586 en: Could not spotlight that person
587 de: Diese Person konnte nicht hervorgehoben werden
588 stop_spotlight_failed:
589 en: Could not stop the spotlight
590 de: Hervorhebung konnte nicht beendet werden
591 page:
592 title:
593 en: Calls
594 de: Anrufe
595 history:
596 en: History
597 de: Verlauf
598 speed_dial:
599 en: Speed dial
600 de: Kurzwahl
601 speed_dial_empty:
602 en: Add people to speed dial for quick access.
603 de: Personen zur Kurzwahl hinzufügen für schnellen Zugriff.
604 speed_dial_add:
605 en: Add to speed dial
606 de: Zur Kurzwahl hinzufügen
607 pick_one:
608 en: Pick one person to call
609 de: Eine Person zum Anrufen wählen
610 chrome:
611 video_call:
612 en: Video call
613 de: Videoanruf
614 audio_call:
615 en: Audio call
616 de: Audioanruf
617 call_options:
618 en: Call options
619 de: Anrufoptionen
620 meet_now:
621 en: Meet now
622 de: Jetzt besprechen
623 stop_sharing:
624 en: Stop sharing
625 de: Freigabe beenden
626 raise_hand:
627 en: Raise hand
628 de: Hand heben
629 lower_hand:
630 en: Lower hand
631 de: Hand senken
632 lower_all_hands:
633 en: Lower all hands
634 de: Alle Hände senken
635 end_meeting_for_all:
636 en: End meeting for everyone
637 de: Besprechung für alle beenden
638 open_chat:
639 en: Open the chat
640 de: Chat öffnen
641 close_chat:
642 en: Close the chat
643 de: Chat schließen
644 share_entire_screen:
645 en: Share entire screen
646 de: Gesamten Bildschirm freigeben
647 share_screen_n:
648 en: "Share screen %{n}"
649 de: "Bildschirm %{n} freigeben"
650 share_window:
651 en: Share a window
652 de: Fenster freigeben
653 share_window_ellipsis:
654 en: Share a window...
655 de: Fenster freigeben...
656 computer_sound_on:
657 en: Computer sound on
658 de: Computerton ein
659 computer_sound_off:
660 en: Computer sound off
661 de: Computerton aus
662 sharing_label:
663 en: "You are sharing: %{label}"
664 de: "Sie geben frei: %{label}"
665 no_microphone:
666 en: No microphone found
667 de: Kein Mikrofon gefunden
668 audio_off_meeting:
669 en: Audio is off for this meeting
670 de: Audio ist für diese Besprechung aus
671 no_camera:
672 en: No camera found
673 de: Keine Kamera gefunden
674 sharing_when_connected:
675 en: Sharing starts once the call is connected
676 de: Freigabe startet, sobald der Anruf verbunden ist
677 no_windows:
678 en: No windows found
679 de: Keine Fenster gefunden
680 lobby_waiting:
681 en: Waiting in the lobby...
682 de: Warten in der Lobby...
683 include_computer_sound:
684 en: Include computer sound
685 de: Computerton einbeziehen
686 optimize_motion:
687 en: Optimize for motion
688 de: Für Bewegung optimieren
689 show_me_over_content:
690 en: Show me over my content
691 de: Mich über meinen Inhalt anzeigen
692 camera_on_first:
693 en: Turn your camera on first
694 de: Kamera zuerst einschalten
695 noise_suppression:
696 en: Noise suppression
697 de: Rauschunterdrückung
698 music_mode:
699 en: Music mode
700 de: Musikmodus
701 push_to_talk:
702 en: Unmuted - release Ctrl+Space to mute
703 de: Entstummt – Strg+Leertaste loslassen zum Stummschalten
704 hand_raised:
705 en: Hand raised
706 de: Hand gehoben
707 hand_position:
708 en: "Hand %{position}"
709 de: "Hand %{position}"
710 reconnecting:
711 en: Reconnecting...
712 de: Verbindung wird wiederhergestellt...
713 microphone:
714 en: Microphone
715 de: Mikrofon
716 speaker:
717 en: Speaker
718 de: Lautsprecher
719 return_main:
720 en: Return to main meeting
721 de: Zur Hauptbesprechung zurück
722 breakout_room:
723 en: Breakout room
724 de: Breakout-Raum
725 on_hold:
726 en: On hold
727 de: Gehalten
728 you_on_hold:
729 en: You're on hold
730 de: Sie sind in der Warteschleife
731 open_in_browser:
732 en: Open in browser
733 de: Im Browser öffnen
734 recording_notice:
735 en: This meeting is being recorded
736 de: Diese Besprechung wird aufgezeichnet
737 recording_accept_hint:
738 en: Your microphone and camera stay off until you accept.
739 de: Mikrofon und Kamera bleiben aus, bis Sie zustimmen.
740 transfer:
741 en: Transfer
742 de: Weiterleiten
743 resume_person:
744 en: "Resume %{name}"
745 de: "%{name} fortsetzen"
746 video_quality:
747 en: Video quality
748 de: Videoqualität
749 auto:
750 en: Auto
751 de: Auto
752 effects:
753 en: Effects
754 de: Effekte
755 mirror_video:
756 en: Mirror my video
757 de: Video spiegeln
758 auto_framing:
759 en: Auto framing
760 de: Automatischer Bildausschnitt
761 adjust_brightness:
762 en: Adjust brightness
763 de: Helligkeit anpassen
764 soft_focus:
765 en: Soft focus
766 de: Weichzeichner
767 background:
768 en: Background
769 de: Hintergrund
770 background_none:
771 en: None
772 de: Keiner
773 background_blur:
774 en: Blur
775 de: Unscharf
776 add_image:
777 en: Add image...
778 de: Bild hinzufügen...
779 prejoin:
780 camera_off:
781 en: Your camera is off
782 de: Ihre Kamera ist aus
783 default_device:
784 en: Default device
785 de: Standardgerät
786 starting_camera:
787 en: Starting camera...
788 de: Kamera wird gestartet...
789 camera_failed:
790 en: "Camera could not start: %{detail}"
791 de: "Kamera konnte nicht starten: %{detail}"
792 background:
793 en: Background
794 de: Hintergrund
795 camera:
796 en: Camera
797 de: Kamera
798 microphone:
799 en: Microphone
800 de: Mikrofon
801 speaker:
802 en: Speaker
803 de: Lautsprecher
804 join_now:
805 en: Join now
806 de: Jetzt beitreten
807 choose_av:
808 en: Choose your video and audio settings, then join
809 de: Video- und Audioeinstellungen wählen, dann beitreten
810 join_dialog:
811 title:
812 en: Join with a meeting ID
813 de: Mit Besprechungs-ID beitreten
814 meeting_id:
815 en: Meeting ID
816 de: Besprechungs-ID
817 passcode:
818 en: Passcode
819 de: Kenncode
820 passcode_placeholder:
821 en: Passcode (if the invitation has one)
822 de: Kenncode (falls in der Einladung angegeben)
823 meeting:
824 new_title:
825 en: New meeting
826 de: Neue Besprechung
827 title_label:
828 en: Title
829 de: Titel
830 title_placeholder:
831 en: Add a title
832 de: Titel hinzufügen
833 people:
834 en: People
835 de: Personen
836 date:
837 en: Date
838 de: Datum
839 start:
840 en: Start
841 de: Beginn
842 end:
843 en: End
844 de: Ende
845 repeat:
846 en: Repeat
847 de: Wiederholen
848 details:
849 en: Details
850 de: Details
851 details_placeholder:
852 en: Add details
853 de: Details hinzufügen
854 teams_link_added:
855 en: Teams meeting link is added
856 de: Teams-Besprechungslink wird hinzugefügt
857 agents:
858 start:
859 new_session:
860 en: New session
861 de: Neue Sitzung
862 recent_sessions:
863 en: Recent sessions
864 de: Letzte Sitzungen
865 other_sessions:
866 en: Other sessions
867 de: Weitere Sitzungen
868 recent:
869 en: Recent
870 de: Zuletzt
871 browse:
872 en: Browse...
873 de: Durchsuchen...
874 session:
875 en: Session
876 de: Sitzung
877 working_dir:
878 en: Working dir
879 de: Arbeitsverzeichnis
880 message_to_session:
881 en: Message to the session
882 de: Nachricht an die Sitzung
883 extra_instructions:
884 en: Extra instructions (optional)
885 de: Zusätzliche Anweisungen (optional)
886 show_prompt:
887 en: Show prompt
888 de: Prompt anzeigen
889 send:
890 en: Send
891 de: Senden
892 allow_and_start:
893 en: Allow and start
894 de: Erlauben und starten
895 start:
896 en: Start
897 de: Starten
898 message_placeholder:
899 en: Type the message to send
900 de: Nachricht zum Senden eingeben
901 chat_invisible:
902 en: Agents can't see this chat yet.
903 de: Agents sehen diesen Chat noch nicht.
904 settings:
905 note:
906 en: Agents get the message, its sender and up to 20 earlier messages. Nothing is sent to Teams without you.
907 de: Agents erhalten die Nachricht, den Absender und bis zu 20 frühere Nachrichten. Ohne Sie wird nichts an Teams gesendet.
908 on_this_computer:
909 en: ON THIS COMPUTER
910 de: AUF DIESEM COMPUTER
911 scan_again:
912 en: Scan again
913 de: Erneut suchen
914 no_cli_found:
915 en: No Claude, Copilot, Codex, Cursor or Antigravity CLI is waiting to be added.
916 de: Keine Claude-, Copilot-, Codex-, Cursor- oder Antigravity-CLI wartet auf Hinzufügen.
917 agents_header:
918 en: AGENTS
919 de: AGENTS
920 actions_header:
921 en: ACTIONS - IN THIS ORDER IN THE MENU
922 de: AKTIONEN – IN DIESER REIHENFOLGE IM MENÜ
923 write_with:
924 en: Write with
925 de: Schreiben mit
926 rewrite_hint:
927 en: Rewrite in the composer and the chat assistant island. Microsoft Copilot needs the licence.
928 de: Umschreiben im Editor und im Chat-Assistenten-Insel. Microsoft Copilot benötigt die Lizenz.
929 answer_with:
930 en: "Answer with %{name}"
931 de: "Antworten mit %{name}"
932 new_action:
933 en: New action
934 de: Neue Aktion
935 custom_agent:
936 en: Custom agent
937 de: Eigener Agent
938 unknown_agent:
939 en: Unknown agent
940 de: Unbekannter Agent
941 auth:
942 sign_in:
943 en: Sign in
944 de: Anmelden
945 shell:
946 settings_and_more:
947 en: Settings and more
948 de: Einstellungen und mehr
949 status_menu:
950 view_account:
951 en: View account
952 de: Konto anzeigen
953 set_status_message:
954 en: Set status message
955 de: Statusmeldung festlegen
956 resume_notifications:
957 en: Resume notifications
958 de: Benachrichtigungen fortsetzen
959 chat_list:
960 en: Chat list
961 de: Chatliste
962 translation:
963 en: Translation
964 de: Übersetzung
965 notification_settings:
966 en: Notification settings
967 de: Benachrichtigungseinstellungen
968 test_call:
969 en: Make a test call
970 de: Testanruf starten
971 simulate_incoming:
972 en: Simulate incoming call
973 de: Eingehenden Anruf simulieren
974 duration:
975 en: Duration
976 de: Dauer
977 reset_status:
978 en: Reset status
979 de: Status zurücksetzen
980 work_location_today:
981 en: Set work location for today
982 de: Arbeitsort für heute festlegen
983 office:
984 en: Office
985 de: Büro
986 remote:
987 en: Remote
988 de: Remote
989 clear_work_location:
990 en: Clear work location
991 de: Arbeitsort löschen
992 sidebar:
993 pinned:
994 en: Pinned
995 de: Angepinnt
996 quick_views:
997 en: Quick views
998 de: Schnellansichten
999 teams:
1000 en: Teams
1001 de: Teams
1002 mark_all_read:
1003 en: Mark all as read
1004 de: Alle als gelesen markieren
1005 collapse_all:
1006 en: Collapse all sections
1007 de: Alle Abschnitte einklappen
1008 hidden_teams:
1009 en: Hidden teams
1010 de: Ausgeblendete Teams
1011 see_all_channels:
1012 en: See all channels
1013 de: Alle Kanäle anzeigen
1014 see_fewer_channels:
1015 en: See fewer channels
1016 de: Weniger Kanäle anzeigen
1017 loading_older:
1018 en: Loading older chats
1019 de: Ältere Chats werden geladen
1020 new_chat:
1021 en: New chat
1022 de: Neuer Chat
1023 new_chat_shortcut:
1024 en: New chat (Ctrl+N)
1025 de: Neuer Chat (Strg+N)
1026 more_options:
1027 en: More options
1028 de: Weitere Optionen
1029 draft:
1030 en: Draft
1031 de: Entwurf
1032 draft_prefix:
1033 en: "Draft:"
1034 de: "Entwurf:"
1035 not_sent:
1036 en: Not sent
1037 de: Nicht gesendet
1038 see_more:
1039 en: "See more (%{count})"
1040 de: "Mehr anzeigen (%{count})"
1041 see_less:
1042 en: See less
1043 de: Weniger anzeigen
1044 new_section:
1045 en: New section
1046 de: Neuer Abschnitt
1047 rename_section:
1048 en: Rename section
1049 de: Abschnitt umbenennen
1050 move_up:
1051 en: Move up
1052 de: Nach oben
1053 move_down:
1054 en: Move down
1055 de: Nach unten
1056 delete_section:
1057 en: Delete section
1058 de: Abschnitt löschen
1059 delete_section_title:
1060 en: 'Delete section "%{name}"?'
1061 de: 'Abschnitt „%{name}" löschen?'
1062 delete_section_detail:
1063 en: Chats in it move back to Chats.
1064 de: Chats darin werden zurück zu Chats verschoben.
1065 new_channel:
1066 en: New channel
1067 de: Neuer Kanal
1068 new_message:
1069 en: New message
1070 de: Neue Nachricht
1071 new_items:
1072 en: New items
1073 de: Neue Elemente
1074 notifications:
1075 en: Notifications
1076 de: Benachrichtigungen
1077 notify_banner_activity:
1078 en: Banner and activity
1079 de: Banner und Aktivität
1080 notify_activity_only:
1081 en: Activity only
1082 de: Nur Aktivität
1083 notify_off:
1084 en: Off
1085 de: Aus
1086 include_thread_replies:
1087 en: Include thread replies
1088 de: Thread-Antworten einschließen
1089 filter:
1090 placeholder:
1091 en: Filter by person or chat name
1092 de: Nach Person oder Chatname filtern
1093 channel_placeholder:
1094 en: Filter by channel name
1095 de: Nach Kanalname filtern
1096 no_matches:
1097 en: We didn't find any matches.
1098 de: Keine Treffer gefunden.
1099 clear:
1100 en: Clear filters
1101 de: Filter zurücksetzen
1102 clear_text:
1103 en: Clear filter text
1104 de: Filtertext löschen
1105 show_box:
1106 en: Show filter text box
1107 de: Filterfeld anzeigen
1108 close_box:
1109 en: Close filter text box
1110 de: Filterfeld schließen
1111 show_shortcut:
1112 en: "%{label} (Ctrl+Shift+F)"
1113 de: "%{label} (Strg+Umschalt+F)"
1114 unread:
1115 en: Unread
1116 de: Ungelesen
1117 pill:
1118 unread:
1119 en: Unread
1120 de: Ungelesen
1121 mentions:
1122 en: "@Mentions"
1123 de: "@Erwähnungen"
1124 chats:
1125 en: Chats
1126 de: Chats
1127 meetings:
1128 en: Meeting chats
1129 de: Besprechungschats
1130 muted:
1131 en: Muted
1132 de: Stummgeschaltet
1133 quick_view:
1134 mentions:
1135 en: Mentions
1136 de: Erwähnungen
1137 drafts:
1138 en: Drafts
1139 de: Entwürfe
1140 saved:
1141 en: Saved
1142 de: Gespeichert
1143 mentions_empty:
1144 en: No mentions yet. When someone @mentions you, it shows up here.
1145 de: Noch keine Erwähnungen. Wenn Sie jemand @erwähnt, erscheint es hier.
1146 drafts_empty:
1147 en: No drafts. Messages you start and do not send show up here.
1148 de: Keine Entwürfe. Begonnene, aber nicht gesendete Nachrichten erscheinen hier.
1149 saved_empty:
1150 en: No saved messages. Use Save message in the ... menu of a message.
1151 de: Keine gespeicherten Nachrichten. Nutzen Sie «Nachricht speichern» im …-Menü einer Nachricht.
1152 shortcuts:
1153 title:
1154 en: Keyboard shortcuts
1155 de: Tastenkürzel
1156 group:
1157 general:
1158 en: General
1159 de: Allgemein
1160 navigation:
1161 en: Navigation
1162 de: Navigation
1163 composer:
1164 en: Messages and composer
1165 de: Nachrichten und Editor
1166 calls:
1167 en: Calls
1168 de: Anrufe
@@ -0,0 +1,1168 @@
1_version: 2
2common:
3 cancel:
4 en: Cancel
5 de: Abbrechen
6 save:
7 en: Save
8 de: Speichern
9 close:
10 en: Close
11 de: Schließen
12 delete:
13 en: Delete
14 de: Löschen
15 ok:
16 en: OK
17 de: OK
18 add:
19 en: Add
20 de: Hinzufügen
21 remove:
22 en: Remove
23 de: Entfernen
24 join:
25 en: Join
26 de: Beitreten
27 leave:
28 en: Leave
29 de: Verlassen
30 retry:
31 en: Retry
32 de: Erneut versuchen
33 invite:
34 en: Invite
35 de: Einladen
36 admit:
37 en: Admit
38 de: Zulassen
39 deny:
40 en: Deny
41 de: Ablehnen
42 stop:
43 en: Stop
44 de: Stoppen
45 resume:
46 en: Resume
47 de: Fortsetzen
48 done:
49 en: Done
50 de: Fertig
51 send:
52 en: Send
53 de: Senden
54 sending:
55 en: Sending...
56 de: Wird gesendet...
57 you:
58 en: You
59 de: Sie
60 create:
61 en: Create
62 de: Erstellen
63 attach:
64 en: Attach
65 de: Anhängen
66 chat:
67 en: Chat
68 de: Chat
69 call:
70 en: Call
71 de: Anruf
72 settings:
73 en: Settings
74 de: Einstellungen
75 open:
76 en: Open
77 de: Öffnen
78 quit:
79 en: Quit
80 de: Beenden
81notice:
82 generic_detail:
83 en: "Something went wrong: %{detail}"
84 de: "Etwas ist schiefgelaufen: %{detail}"
85settings:
86 search:
87 no_results:
88 en: No settings found
89 de: Keine Einstellungen gefunden
90 nav:
91 general:
92 en: General
93 de: Allgemein
94 notifications:
95 en: Notifications and activity
96 de: Benachrichtigungen und Aktivität
97 appearance:
98 en: Appearance and accessibility
99 de: Darstellung und Barrierefreiheit
100 chats:
101 en: Chats and channels
102 de: Chats und Kanäle
103 calls:
104 en: Calls
105 de: Anrufe
106 calendar:
107 en: Calendar
108 de: Kalender
109 devices:
110 en: Devices
111 de: Geräte
112 agents:
113 en: Agents
114 de: Agents
115 mcp:
116 en: MCP
117 de: MCP
118 about:
119 en: About
120 de: Info
121 caption:
122 system:
123 en: SYSTEM
124 de: SYSTEM
125 compose_box:
126 en: COMPOSE BOX
127 de: EINGABEFELD
128 translation:
129 en: TRANSLATION
130 de: ÜBERSETZUNG
131 language:
132 en: LANGUAGE
133 de: SPRACHE
134 theme:
135 en: THEME
136 de: DESIGN
137 app_icon:
138 en: APP ICON
139 de: APP-SYMBOL
140 appearance_and_sound:
141 en: APPEARANCE AND SOUND
142 de: DARSTELLUNG UND TON
143 sound:
144 en: SOUND
145 de: TON
146 general:
147 auto_start:
148 en: Auto-start Teams
149 de: Teams automatisch starten
150 open_in_background:
151 en: Open application in background
152 de: Anwendung im Hintergrund starten
153 close_to_tray:
154 en: On close, keep the application running
155 de: Beim Schließen Anwendung weiterlaufen lassen
156 close_to_tray_detail:
157 en: The title bar X hides the window to the tray
158 de: Das X in der Titelleiste blendet das Fenster ins Infobereich-Symbol aus
159 up_arrow:
160 en: Up arrow key behaviour in compose box
161 de: Verhalten der Aufwärtspfeil-Taste im Eingabefeld
162 up_arrow_detail:
163 en: Choose what happens when you press Up arrow at the beginning of the compose box.
164 de: Legen Sie fest, was passiert, wenn Sie am Anfang des Eingabefelds die Aufwärtspfeil-Taste drücken.
165 translation_not_loaded:
166 en: Translation settings not loaded yet
167 de: Übersetzungseinstellungen noch nicht geladen
168 translation_title:
169 en: Translation
170 de: Übersetzung
171 translate_into:
172 en: Translate messages into this language
173 de: Nachrichten in diese Sprache übersetzen
174 behavior_title:
175 en: How to handle messages in other languages
176 de: Umgang mit Nachrichten in anderen Sprachen
177 behavior_ask:
178 en: Ask me before translating
179 de: Vor dem Übersetzen nachfragen
180 behavior_auto:
181 en: Auto-translate all messages
182 de: Alle Nachrichten automatisch übersetzen
183 behavior_never:
184 en: Never translate
185 de: Nie übersetzen
186 never_translate:
187 en: Never translate messages in these languages
188 de: Nachrichten in diesen Sprachen nie übersetzen
189 notifications:
190 flash_taskbar:
191 en: Flash taskbar when notifications are received
192 de: Taskleiste bei Benachrichtigungen blinken lassen
193 flash_taskbar_detail:
194 en: On new messages, until you open the window
195 de: Bei neuen Nachrichten, bis Sie das Fenster öffnen
196 play_sounds:
197 en: Play sounds with notifications
198 de: Töne bei Benachrichtigungen abspielen
199 urgent_sounds:
200 en: Play sounds with urgent and priority contact notifications
201 de: Töne bei dringenden und Prioritätskontakt-Benachrichtigungen
202 call_sounds:
203 en: Play sounds with incoming calls, requests to join, and meeting start notifications
204 de: Töne bei eingehenden Anrufen, Beitrittsanfragen und Besprechungsstarts
205 busy_sounds:
206 en: Play sounds when I'm busy or in a meeting
207 de: Töne abspielen, wenn ich beschäftigt bin oder in einer Besprechung
208 hide_in_calls:
209 en: Hide notifications during calls and meetings
210 de: Benachrichtigungen während Anrufen und Besprechungen ausblenden
211 hide_in_calls_detail:
212 en: No message toasts while a call is active
213 de: Keine Nachrichten-Toasts während ein Anruf aktiv ist
214 position:
215 en: Position on the screen
216 de: Position auf dem Bildschirm
217 position_detail:
218 en: Corner of the main screen
219 de: Ecke des Hauptbildschirms
220 test:
221 en: Test notification
222 de: Testbenachrichtigung
223 test_detail:
224 en: Shows a toast with the settings above
225 de: Zeigt einen Toast mit den obigen Einstellungen
226 send_test:
227 en: Send test notification
228 de: Testbenachrichtigung senden
229 notification_sound:
230 en: Notification sound
231 de: Benachrichtigungston
232 urgent_sound:
233 en: Urgent sound
234 de: Dringlichkeitston
235 chat_messages:
236 en: Chat message notifications
237 de: Chatnachrichten-Benachrichtigungen
238 meeting_chats:
239 en: Meeting chat notifications
240 de: Besprechungschat-Benachrichtigungen
241 likes_reactions:
242 en: Likes and reactions
243 de: Likes und Reaktionen
244 teams_channels:
245 en: Teams and channels
246 de: Teams und Kanäle
247 show_preview:
248 en: Show message preview
249 de: Nachrichtenvorschau anzeigen
250 appearance:
251 color_scheme:
252 en: Color scheme
253 de: Farbschema
254 color_scheme_detail:
255 en: The colors to use for Rusty Teams
256 de: Die Farben für Rusty Teams
257 theme:
258 en: Theme
259 de: Design
260 theme_detail:
261 en: The theme to use for Teams
262 de: Das Design für Teams
263 theme_follow_os:
264 en: Follow operating system theme
265 de: Systemdesign folgen
266 theme_light:
267 en: Light
268 de: Hell
269 theme_dark:
270 en: Dark
271 de: Dunkel
272 theme_high_contrast:
273 en: High contrast
274 de: Hoher Kontrast
275 app_icon:
276 en: App icon
277 de: App-Symbol
278 app_icon_detail_windows:
279 en: Shown in the title bar, taskbar and tray. Pinned shortcuts keep the icon of the .exe
280 de: In Titelleiste, Taskleiste und Infobereich. Angeheftete Verknüpfungen behalten das Symbol der .exe
281 app_icon_detail:
282 en: Shown in the title bar, taskbar and tray
283 de: In Titelleiste, Taskleiste und Infobereich
284 language:
285 title:
286 en: Language
287 de: Sprache
288 detail:
289 en: Language for Rusty Teams and controls
290 de: Sprache für Rusty Teams und Steuerelemente
291 follow_system:
292 en: Follow system
293 de: Systemeinstellung folgen
294 english:
295 en: English
296 de: Englisch
297 german:
298 en: Deutsch
299 de: Deutsch
300 chats:
301 density:
302 en: Message density
303 de: Nachrichtendichte
304 read_receipts:
305 en: Read receipts
306 de: Lesebestätigungen
307 message_actions:
308 en: Show message actions on right click
309 de: Nachrichtenaktionen per Rechtsklick anzeigen
310 muted_section:
311 en: Show muted items in their own section
312 de: Stummgeschaltete Einträge in eigenem Abschnitt anzeigen
313 enter_to:
314 en: When writing a message, press Enter to
315 de: Beim Schreiben einer Nachricht führt Eingabetaste zu
316 markdown:
317 en: Format messages using mark-down
318 de: Nachrichten mit Mark-down formatieren
319 markdown_detail:
320 en: Use mark-down language to define the structure and appearance of messages. Your formatting will take effect once you send your message. When this is on, the formatting options menu won't be visible.
321 de: Verwenden Sie Mark-down, um Struktur und Darstellung von Nachrichten festzulegen. Die Formatierung gilt nach dem Senden. Ist diese Option aktiv, ist das Formatierungsmenü ausgeblendet.
322 calls:
323 ringtones:
324 en: Ringtones
325 de: Klingeltöne
326rail:
327 activity:
328 en: Activity
329 de: Aktivität
330 chat:
331 en: Chat
332 de: Chat
333 teams:
334 en: Teams
335 de: Teams
336 calendar:
337 en: Calendar
338 de: Kalender
339 calls:
340 en: Calls
341 de: Anrufe
342 agents:
343 en: Agents
344 de: Agents
345 shortcut_activity:
346 en: Open Activity
347 de: Aktivität öffnen
348 shortcut_chats:
349 en: Show Chats
350 de: Chats anzeigen
351 shortcut_channels:
352 en: Show Channels
353 de: Kanäle anzeigen
354 shortcut_calendar:
355 en: Open Calendar
356 de: Kalender öffnen
357 shortcut_calls:
358 en: Show Calls
359 de: Anrufe anzeigen
360 shortcut_agents:
361 en: Open Agents
362 de: Agents öffnen
363tray:
364 open:
365 en: Open
366 de: Öffnen
367 quit:
368 en: Quit
369 de: Beenden
370 do_not_disturb:
371 en: Do not disturb
372 de: Nicht stören
373 notifications:
374 en: Notifications
375 de: Benachrichtigungen
376 mute_sound:
377 en: Mute sound
378 de: Ton stumm schalten
379calls:
380 notice:
381 not_connected:
382 en: Not connected to Teams yet
383 de: Noch nicht mit Teams verbunden
384 read_only:
385 en: Calls are off in read-only mode
386 de: Anrufe sind im Nur-Lesen-Modus deaktiviert
387 not_callable:
388 en: This chat cannot be called
389 de: Dieser Chat kann nicht angerufen werden
390 meeting_unavailable:
391 en: This meeting cannot be joined
392 de: Dieser Besprechung kann nicht beigetreten werden
393 answer_failed:
394 en: Could not answer the call
395 de: Anruf konnte nicht angenommen werden
396 consult_ended:
397 en: The consultation ended
398 de: Die Rücksprache ist beendet
399 report_saved:
400 en: Test report saved
401 de: Testbericht gespeichert
402 response_failed:
403 en: Could not send your response
404 de: Ihre Antwort konnte nicht gesendet werden
405 delete_failed:
406 en: Could not delete the meeting
407 de: Besprechung konnte nicht gelöscht werden
408 delete_read_only:
409 en: Meetings cannot be deleted in read-only mode.
410 de: Besprechungen können im Nur-Lesen-Modus nicht gelöscht werden.
411 no_meeting_chat:
412 en: This meeting chat is not available
413 de: Dieser Besprechungschat ist nicht verfügbar
414 invite_failed:
415 en: Could not add that person
416 de: Diese Person konnte nicht hinzugefügt werden
417 no_peer:
418 en: This call cannot be extended
419 de: Dieser Anruf kann nicht erweitert werden
420 missed:
421 en: Call missed
422 de: Anruf verpasst
423 not_found:
424 en: Could not find that meeting
425 de: Diese Besprechung wurde nicht gefunden
426 meet_now_failed:
427 en: Could not start the meeting
428 de: Besprechung konnte nicht gestartet werden
429 consent_first:
430 en: Accept the recording notice first
431 de: Bitte zuerst den Aufzeichnungshinweis bestätigen
432 on_hold:
433 en: Resume the call first
434 de: Setzen Sie den Anruf zuerst fort
435 change_running:
436 en: Another change is still running, try again in a moment
437 de: Eine andere Änderung läuft noch, versuchen Sie es gleich erneut
438 video_failed:
439 en: Video could not start, the call stays audio only
440 de: Video konnte nicht starten, der Anruf bleibt nur Audio
441 share_queued:
442 en: Sharing starts in a moment
443 de: Freigabe startet gleich
444 share_refused:
445 en: The other side did not accept the screen share
446 de: Die Gegenseite hat die Bildschirmfreigabe nicht akzeptiert
447 portal_unavailable:
448 en: Screen sharing needs a desktop portal on this system
449 de: Bildschirmfreigabe benötigt auf diesem System ein Desktop-Portal
450 files_later:
451 en: Files can be added once the chat exists.
452 de: Dateien können hinzugefügt werden, sobald der Chat existiert.
453 calendar_load_failed:
454 en: We couldn't load your calendar.
455 de: Ihr Kalender konnte nicht geladen werden.
456 no_calls:
457 en: No calls yet
458 de: Noch keine Anrufe
459 video_starts_once_connected:
460 en: Video starts once the call is connected
461 de: Video startet, sobald der Anruf verbunden ist
462 call_transferred:
463 en: Call transferred
464 de: Anruf weitergeleitet
465 transfer_failed:
466 en: The transfer did not go through
467 de: Die Weiterleitung ist fehlgeschlagen
468 recording_join_failed:
469 en: The recording service could not join
470 de: Der Aufzeichnungsdienst konnte nicht beitreten
471 captions_join_failed:
472 en: The captions service could not join
473 de: Der Untertitel-Dienst konnte nicht beitreten
474 caption_language_failed:
475 en: Could not change the spoken language
476 de: Gesprochene Sprache konnte nicht geändert werden
477 camera_start:
478 en: "Camera could not start: %{detail}"
479 de: "Kamera konnte nicht starten: %{detail}"
480 camera_restart:
481 en: "Camera could not restart: %{detail}"
482 de: "Kamera konnte nicht neu starten: %{detail}"
483 sharing_start:
484 en: "Sharing could not start: %{detail}"
485 de: "Freigabe konnte nicht starten: %{detail}"
486 raise_hand_failed:
487 en: Could not raise your hand
488 de: Hand heben ist fehlgeschlagen
489 lower_hand_failed:
490 en: Could not lower your hand
491 de: Hand senken ist fehlgeschlagen
492 lower_that_hand_failed:
493 en: Could not lower that hand
494 de: Diese Hand konnte nicht gesenkt werden
495 lower_all_hands_failed:
496 en: Could not lower all hands
497 de: Alle Hände konnten nicht gesenkt werden
498 confirm_recording_failed:
499 en: Could not confirm the recording notice
500 de: Aufzeichnungshinweis konnte nicht bestätigt werden
501 hold_failed:
502 en: Could not put the call on hold
503 de: Anruf konnte nicht gehalten werden
504 resume_failed:
505 en: Could not resume the call
506 de: Anruf konnte nicht fortgesetzt werden
507 transfer_not_allowed:
508 en: This call cannot be transferred
509 de: Dieser Anruf kann nicht weitergeleitet werden
510 transfer_call_failed:
511 en: Could not transfer the call
512 de: Anruf konnte nicht weitergeleitet werden
513 transferring:
514 en: "Transferring to %{detail}..."
515 de: "Weiterleitung an %{detail}..."
516 whiteboards_meetings_only:
517 en: Whiteboards belong to meetings
518 de: Whiteboards gehören zu Besprechungen
519 whiteboard_open_failed:
520 en: The whiteboard could not be opened
521 de: Das Whiteboard konnte nicht geöffnet werden
522 reaction_failed:
523 en: Could not send the reaction
524 de: Reaktion konnte nicht gesendet werden
525 recording_not_started:
526 en: The recording did not start
527 de: Die Aufzeichnung hat nicht gestartet
528 recording_start_failed:
529 en: The recording could not start
530 de: Die Aufzeichnung konnte nicht starten
531 captions_start_failed:
532 en: Captions could not start
533 de: Untertitel konnten nicht starten
534 hold_change_failed:
535 en: The hold did not go through
536 de: Halten ist fehlgeschlagen
537 recording_stop_failed:
538 en: The recording could not be stopped
539 de: Die Aufzeichnung konnte nicht gestoppt werden
540 background_image_failed:
541 en: That background image could not be used
542 de: Dieses Hintergrundbild konnte nicht verwendet werden
543 camera_stopped:
544 en: "Camera stopped: %{detail}"
545 de: "Kamera gestoppt: %{detail}"
546 screen_share_stopped:
547 en: "Screen share stopped: %{detail}"
548 de: "Bildschirmfreigabe gestoppt: %{detail}"
549 admit_failed:
550 en: Could not admit that person
551 de: Diese Person konnte nicht zugelassen werden
552 admit_all_failed:
553 en: Could not admit everyone
554 de: Nicht alle konnten zugelassen werden
555 deny_failed:
556 en: Could not deny that person
557 de: Diese Person konnte nicht abgewiesen werden
558 remove_participant_failed:
559 en: Could not remove that person
560 de: Diese Person konnte nicht entfernt werden
561 mute_participant_failed:
562 en: Could not mute that person
563 de: Diese Person konnte nicht stummgeschaltet werden
564 mute_all_failed:
565 en: Could not mute everyone
566 de: Nicht alle konnten stummgeschaltet werden
567 meeting_lock_failed:
568 en: Could not change the meeting lock
569 de: Besprechungssperre konnte nicht geändert werden
570 change_role_failed:
571 en: Could not change that role
572 de: Diese Rolle konnte nicht geändert werden
573 mic_setting_failed:
574 en: Could not change that microphone setting
575 de: Diese Mikrofoneinstellung konnte nicht geändert werden
576 camera_setting_failed:
577 en: Could not change that camera setting
578 de: Diese Kameraeinstellung konnte nicht geändert werden
579 attendee_settings_failed:
580 en: Could not change the attendee settings
581 de: Teilnehmereinstellungen konnten nicht geändert werden
582 invite_person_failed:
583 en: Could not invite that person
584 de: Diese Person konnte nicht eingeladen werden
585 spotlight_failed:
586 en: Could not spotlight that person
587 de: Diese Person konnte nicht hervorgehoben werden
588 stop_spotlight_failed:
589 en: Could not stop the spotlight
590 de: Hervorhebung konnte nicht beendet werden
591 page:
592 title:
593 en: Calls
594 de: Anrufe
595 history:
596 en: History
597 de: Verlauf
598 speed_dial:
599 en: Speed dial
600 de: Kurzwahl
601 speed_dial_empty:
602 en: Add people to speed dial for quick access.
603 de: Personen zur Kurzwahl hinzufügen für schnellen Zugriff.
604 speed_dial_add:
605 en: Add to speed dial
606 de: Zur Kurzwahl hinzufügen
607 pick_one:
608 en: Pick one person to call
609 de: Eine Person zum Anrufen wählen
610 chrome:
611 video_call:
612 en: Video call
613 de: Videoanruf
614 audio_call:
615 en: Audio call
616 de: Audioanruf
617 call_options:
618 en: Call options
619 de: Anrufoptionen
620 meet_now:
621 en: Meet now
622 de: Jetzt besprechen
623 stop_sharing:
624 en: Stop sharing
625 de: Freigabe beenden
626 raise_hand:
627 en: Raise hand
628 de: Hand heben
629 lower_hand:
630 en: Lower hand
631 de: Hand senken
632 lower_all_hands:
633 en: Lower all hands
634 de: Alle Hände senken
635 end_meeting_for_all:
636 en: End meeting for everyone
637 de: Besprechung für alle beenden
638 open_chat:
639 en: Open the chat
640 de: Chat öffnen
641 close_chat:
642 en: Close the chat
643 de: Chat schließen
644 share_entire_screen:
645 en: Share entire screen
646 de: Gesamten Bildschirm freigeben
647 share_screen_n:
648 en: "Share screen %{n}"
649 de: "Bildschirm %{n} freigeben"
650 share_window:
651 en: Share a window
652 de: Fenster freigeben
653 share_window_ellipsis:
654 en: Share a window...
655 de: Fenster freigeben...
656 computer_sound_on:
657 en: Computer sound on
658 de: Computerton ein
659 computer_sound_off:
660 en: Computer sound off
661 de: Computerton aus
662 sharing_label:
663 en: "You are sharing: %{label}"
664 de: "Sie geben frei: %{label}"
665 no_microphone:
666 en: No microphone found
667 de: Kein Mikrofon gefunden
668 audio_off_meeting:
669 en: Audio is off for this meeting
670 de: Audio ist für diese Besprechung aus
671 no_camera:
672 en: No camera found
673 de: Keine Kamera gefunden
674 sharing_when_connected:
675 en: Sharing starts once the call is connected
676 de: Freigabe startet, sobald der Anruf verbunden ist
677 no_windows:
678 en: No windows found
679 de: Keine Fenster gefunden
680 lobby_waiting:
681 en: Waiting in the lobby...
682 de: Warten in der Lobby...
683 include_computer_sound:
684 en: Include computer sound
685 de: Computerton einbeziehen
686 optimize_motion:
687 en: Optimize for motion
688 de: Für Bewegung optimieren
689 show_me_over_content:
690 en: Show me over my content
691 de: Mich über meinen Inhalt anzeigen
692 camera_on_first:
693 en: Turn your camera on first
694 de: Kamera zuerst einschalten
695 noise_suppression:
696 en: Noise suppression
697 de: Rauschunterdrückung
698 music_mode:
699 en: Music mode
700 de: Musikmodus
701 push_to_talk:
702 en: Unmuted - release Ctrl+Space to mute
703 de: Entstummt – Strg+Leertaste loslassen zum Stummschalten
704 hand_raised:
705 en: Hand raised
706 de: Hand gehoben
707 hand_position:
708 en: "Hand %{position}"
709 de: "Hand %{position}"
710 reconnecting:
711 en: Reconnecting...
712 de: Verbindung wird wiederhergestellt...
713 microphone:
714 en: Microphone
715 de: Mikrofon
716 speaker:
717 en: Speaker
718 de: Lautsprecher
719 return_main:
720 en: Return to main meeting
721 de: Zur Hauptbesprechung zurück
722 breakout_room:
723 en: Breakout room
724 de: Breakout-Raum
725 on_hold:
726 en: On hold
727 de: Gehalten
728 you_on_hold:
729 en: You're on hold
730 de: Sie sind in der Warteschleife
731 open_in_browser:
732 en: Open in browser
733 de: Im Browser öffnen
734 recording_notice:
735 en: This meeting is being recorded
736 de: Diese Besprechung wird aufgezeichnet
737 recording_accept_hint:
738 en: Your microphone and camera stay off until you accept.
739 de: Mikrofon und Kamera bleiben aus, bis Sie zustimmen.
740 transfer:
741 en: Transfer
742 de: Weiterleiten
743 resume_person:
744 en: "Resume %{name}"
745 de: "%{name} fortsetzen"
746 video_quality:
747 en: Video quality
748 de: Videoqualität
749 auto:
750 en: Auto
751 de: Auto
752 effects:
753 en: Effects
754 de: Effekte
755 mirror_video:
756 en: Mirror my video
757 de: Video spiegeln
758 auto_framing:
759 en: Auto framing
760 de: Automatischer Bildausschnitt
761 adjust_brightness:
762 en: Adjust brightness
763 de: Helligkeit anpassen
764 soft_focus:
765 en: Soft focus
766 de: Weichzeichner
767 background:
768 en: Background
769 de: Hintergrund
770 background_none:
771 en: None
772 de: Keiner
773 background_blur:
774 en: Blur
775 de: Unscharf
776 add_image:
777 en: Add image...
778 de: Bild hinzufügen...
779 prejoin:
780 camera_off:
781 en: Your camera is off
782 de: Ihre Kamera ist aus
783 default_device:
784 en: Default device
785 de: Standardgerät
786 starting_camera:
787 en: Starting camera...
788 de: Kamera wird gestartet...
789 camera_failed:
790 en: "Camera could not start: %{detail}"
791 de: "Kamera konnte nicht starten: %{detail}"
792 background:
793 en: Background
794 de: Hintergrund
795 camera:
796 en: Camera
797 de: Kamera
798 microphone:
799 en: Microphone
800 de: Mikrofon
801 speaker:
802 en: Speaker
803 de: Lautsprecher
804 join_now:
805 en: Join now
806 de: Jetzt beitreten
807 choose_av:
808 en: Choose your video and audio settings, then join
809 de: Video- und Audioeinstellungen wählen, dann beitreten
810 join_dialog:
811 title:
812 en: Join with a meeting ID
813 de: Mit Besprechungs-ID beitreten
814 meeting_id:
815 en: Meeting ID
816 de: Besprechungs-ID
817 passcode:
818 en: Passcode
819 de: Kenncode
820 passcode_placeholder:
821 en: Passcode (if the invitation has one)
822 de: Kenncode (falls in der Einladung angegeben)
823 meeting:
824 new_title:
825 en: New meeting
826 de: Neue Besprechung
827 title_label:
828 en: Title
829 de: Titel
830 title_placeholder:
831 en: Add a title
832 de: Titel hinzufügen
833 people:
834 en: People
835 de: Personen
836 date:
837 en: Date
838 de: Datum
839 start:
840 en: Start
841 de: Beginn
842 end:
843 en: End
844 de: Ende
845 repeat:
846 en: Repeat
847 de: Wiederholen
848 details:
849 en: Details
850 de: Details
851 details_placeholder:
852 en: Add details
853 de: Details hinzufügen
854 teams_link_added:
855 en: Teams meeting link is added
856 de: Teams-Besprechungslink wird hinzugefügt
857agents:
858 start:
859 new_session:
860 en: New session
861 de: Neue Sitzung
862 recent_sessions:
863 en: Recent sessions
864 de: Letzte Sitzungen
865 other_sessions:
866 en: Other sessions
867 de: Weitere Sitzungen
868 recent:
869 en: Recent
870 de: Zuletzt
871 browse:
872 en: Browse...
873 de: Durchsuchen...
874 session:
875 en: Session
876 de: Sitzung
877 working_dir:
878 en: Working dir
879 de: Arbeitsverzeichnis
880 message_to_session:
881 en: Message to the session
882 de: Nachricht an die Sitzung
883 extra_instructions:
884 en: Extra instructions (optional)
885 de: Zusätzliche Anweisungen (optional)
886 show_prompt:
887 en: Show prompt
888 de: Prompt anzeigen
889 send:
890 en: Send
891 de: Senden
892 allow_and_start:
893 en: Allow and start
894 de: Erlauben und starten
895 start:
896 en: Start
897 de: Starten
898 message_placeholder:
899 en: Type the message to send
900 de: Nachricht zum Senden eingeben
901 chat_invisible:
902 en: Agents can't see this chat yet.
903 de: Agents sehen diesen Chat noch nicht.
904 settings:
905 note:
906 en: Agents get the message, its sender and up to 20 earlier messages. Nothing is sent to Teams without you.
907 de: Agents erhalten die Nachricht, den Absender und bis zu 20 frühere Nachrichten. Ohne Sie wird nichts an Teams gesendet.
908 on_this_computer:
909 en: ON THIS COMPUTER
910 de: AUF DIESEM COMPUTER
911 scan_again:
912 en: Scan again
913 de: Erneut suchen
914 no_cli_found:
915 en: No Claude, Copilot, Codex, Cursor or Antigravity CLI is waiting to be added.
916 de: Keine Claude-, Copilot-, Codex-, Cursor- oder Antigravity-CLI wartet auf Hinzufügen.
917 agents_header:
918 en: AGENTS
919 de: AGENTS
920 actions_header:
921 en: ACTIONS - IN THIS ORDER IN THE MENU
922 de: AKTIONEN – IN DIESER REIHENFOLGE IM MENÜ
923 write_with:
924 en: Write with
925 de: Schreiben mit
926 rewrite_hint:
927 en: Rewrite in the composer and the chat assistant island. Microsoft Copilot needs the licence.
928 de: Umschreiben im Editor und im Chat-Assistenten-Insel. Microsoft Copilot benötigt die Lizenz.
929 answer_with:
930 en: "Answer with %{name}"
931 de: "Antworten mit %{name}"
932 new_action:
933 en: New action
934 de: Neue Aktion
935 custom_agent:
936 en: Custom agent
937 de: Eigener Agent
938 unknown_agent:
939 en: Unknown agent
940 de: Unbekannter Agent
941auth:
942 sign_in:
943 en: Sign in
944 de: Anmelden
945shell:
946 settings_and_more:
947 en: Settings and more
948 de: Einstellungen und mehr
949status_menu:
950 view_account:
951 en: View account
952 de: Konto anzeigen
953 set_status_message:
954 en: Set status message
955 de: Statusmeldung festlegen
956 resume_notifications:
957 en: Resume notifications
958 de: Benachrichtigungen fortsetzen
959 chat_list:
960 en: Chat list
961 de: Chatliste
962 translation:
963 en: Translation
964 de: Übersetzung
965 notification_settings:
966 en: Notification settings
967 de: Benachrichtigungseinstellungen
968 test_call:
969 en: Make a test call
970 de: Testanruf starten
971 simulate_incoming:
972 en: Simulate incoming call
973 de: Eingehenden Anruf simulieren
974 duration:
975 en: Duration
976 de: Dauer
977 reset_status:
978 en: Reset status
979 de: Status zurücksetzen
980 work_location_today:
981 en: Set work location for today
982 de: Arbeitsort für heute festlegen
983 office:
984 en: Office
985 de: Büro
986 remote:
987 en: Remote
988 de: Remote
989 clear_work_location:
990 en: Clear work location
991 de: Arbeitsort löschen
992sidebar:
993 pinned:
994 en: Pinned
995 de: Angepinnt
996 quick_views:
997 en: Quick views
998 de: Schnellansichten
999 teams:
1000 en: Teams
1001 de: Teams
1002 mark_all_read:
1003 en: Mark all as read
1004 de: Alle als gelesen markieren
1005 collapse_all:
1006 en: Collapse all sections
1007 de: Alle Abschnitte einklappen
1008 hidden_teams:
1009 en: Hidden teams
1010 de: Ausgeblendete Teams
1011 see_all_channels:
1012 en: See all channels
1013 de: Alle Kanäle anzeigen
1014 see_fewer_channels:
1015 en: See fewer channels
1016 de: Weniger Kanäle anzeigen
1017 loading_older:
1018 en: Loading older chats
1019 de: Ältere Chats werden geladen
1020 new_chat:
1021 en: New chat
1022 de: Neuer Chat
1023 new_chat_shortcut:
1024 en: New chat (Ctrl+N)
1025 de: Neuer Chat (Strg+N)
1026 more_options:
1027 en: More options
1028 de: Weitere Optionen
1029 draft:
1030 en: Draft
1031 de: Entwurf
1032 draft_prefix:
1033 en: "Draft:"
1034 de: "Entwurf:"
1035 not_sent:
1036 en: Not sent
1037 de: Nicht gesendet
1038 see_more:
1039 en: "See more (%{count})"
1040 de: "Mehr anzeigen (%{count})"
1041 see_less:
1042 en: See less
1043 de: Weniger anzeigen
1044 new_section:
1045 en: New section
1046 de: Neuer Abschnitt
1047 rename_section:
1048 en: Rename section
1049 de: Abschnitt umbenennen
1050 move_up:
1051 en: Move up
1052 de: Nach oben
1053 move_down:
1054 en: Move down
1055 de: Nach unten
1056 delete_section:
1057 en: Delete section
1058 de: Abschnitt löschen
1059 delete_section_title:
1060 en: 'Delete section "%{name}"?'
1061 de: 'Abschnitt „%{name}" löschen?'
1062 delete_section_detail:
1063 en: Chats in it move back to Chats.
1064 de: Chats darin werden zurück zu Chats verschoben.
1065 new_channel:
1066 en: New channel
1067 de: Neuer Kanal
1068 new_message:
1069 en: New message
1070 de: Neue Nachricht
1071 new_items:
1072 en: New items
1073 de: Neue Elemente
1074 notifications:
1075 en: Notifications
1076 de: Benachrichtigungen
1077 notify_banner_activity:
1078 en: Banner and activity
1079 de: Banner und Aktivität
1080 notify_activity_only:
1081 en: Activity only
1082 de: Nur Aktivität
1083 notify_off:
1084 en: Off
1085 de: Aus
1086 include_thread_replies:
1087 en: Include thread replies
1088 de: Thread-Antworten einschließen
1089 filter:
1090 placeholder:
1091 en: Filter by person or chat name
1092 de: Nach Person oder Chatname filtern
1093 channel_placeholder:
1094 en: Filter by channel name
1095 de: Nach Kanalname filtern
1096 no_matches:
1097 en: We didn't find any matches.
1098 de: Keine Treffer gefunden.
1099 clear:
1100 en: Clear filters
1101 de: Filter zurücksetzen
1102 clear_text:
1103 en: Clear filter text
1104 de: Filtertext löschen
1105 show_box:
1106 en: Show filter text box
1107 de: Filterfeld anzeigen
1108 close_box:
1109 en: Close filter text box
1110 de: Filterfeld schließen
1111 show_shortcut:
1112 en: "%{label} (Ctrl+Shift+F)"
1113 de: "%{label} (Strg+Umschalt+F)"
1114 unread:
1115 en: Unread
1116 de: Ungelesen
1117 pill:
1118 unread:
1119 en: Unread
1120 de: Ungelesen
1121 mentions:
1122 en: "@Mentions"
1123 de: "@Erwähnungen"
1124 chats:
1125 en: Chats
1126 de: Chats
1127 meetings:
1128 en: Meeting chats
1129 de: Besprechungschats
1130 muted:
1131 en: Muted
1132 de: Stummgeschaltet
1133 quick_view:
1134 mentions:
1135 en: Mentions
1136 de: Erwähnungen
1137 drafts:
1138 en: Drafts
1139 de: Entwürfe
1140 saved:
1141 en: Saved
1142 de: Gespeichert
1143 mentions_empty:
1144 en: No mentions yet. When someone @mentions you, it shows up here.
1145 de: Noch keine Erwähnungen. Wenn Sie jemand @erwähnt, erscheint es hier.
1146 drafts_empty:
1147 en: No drafts. Messages you start and do not send show up here.
1148 de: Keine Entwürfe. Begonnene, aber nicht gesendete Nachrichten erscheinen hier.
1149 saved_empty:
1150 en: No saved messages. Use Save message in the ... menu of a message.
1151 de: Keine gespeicherten Nachrichten. Nutzen Sie «Nachricht speichern» im …-Menü einer Nachricht.
1152shortcuts:
1153 title:
1154 en: Keyboard shortcuts
1155 de: Tastenkürzel
1156 group:
1157 general:
1158 en: General
1159 de: Allgemein
1160 navigation:
1161 en: Navigation
1162 de: Navigation
1163 composer:
1164 en: Messages and composer
1165 de: Nachrichten und Editor
1166 calls:
1167 en: Calls
1168 de: Anrufe
crates/app-base/src/lib.rs +3 −0
@@ -38,9 +38,12 @@ pub mod stickers;
38 38 pub mod task_dialog;
39 39 pub mod theme;
40 40 pub mod translation;
41 pub mod ui_locale;
41 42 pub mod updater;
42 43 pub mod user_activity;
43 44 pub mod version;
44 45 pub mod zoom;
45 46
46 47 pub const APP_NAME: &str = "Rusty Teams";
48
49 rust_i18n::i18n!("locales", fallback = "en");
@@ -38,9 +38,12 @@ pub mod stickers;
38pub mod task_dialog;
38pub mod task_dialog;
39pub mod theme;
39pub mod theme;
40pub mod translation;
40pub mod translation;
41pub mod ui_locale;
41pub mod updater;
42pub mod updater;
42pub mod user_activity;
43pub mod user_activity;
43pub mod version;
44pub mod version;
44pub mod zoom;
45pub mod zoom;
45
46
46pub const APP_NAME: &str = "Rusty Teams";
47pub const APP_NAME: &str = "Rusty Teams";
48
49rust_i18n::i18n!("locales", fallback = "en");
crates/app-base/src/notify/platform/stub.rs +2 −0
@@ -108,6 +108,8 @@ impl Tray {
108 108 }
109 109
110 110 pub fn sync(&self, _sound_on: bool, _do_not_disturb: bool, _mention: bool) {}
111
112 pub fn relocalize(&self) {}
111 113 }
112 114
113 115 pub fn animations_enabled() -> bool {
@@ -108,6 +108,8 @@ impl Tray {
108 }
108 }
109
109
110 pub fn sync(&self, _sound_on: bool, _do_not_disturb: bool, _mention: bool) {}
110 pub fn sync(&self, _sound_on: bool, _do_not_disturb: bool, _mention: bool) {}
111
112 pub fn relocalize(&self) {}
111}
113}
112
114
113pub fn animations_enabled() -> bool {
115pub fn animations_enabled() -> bool {
crates/app-base/src/notify/platform/windows_impl.rs +39 −5
@@ -659,26 +659,44 @@ const ID_QUIT: &str = "quit";
659 659
660 660 pub struct Tray {
661 661 icon: TrayIcon,
662 open: MenuItem,
662 663 sound: CheckMenuItem,
663 664 do_not_disturb: CheckMenuItem,
665 settings: MenuItem,
666 quit: MenuItem,
664 667 plain: Icon,
665 668 with_dot: Icon,
666 669 }
667 670
671 fn tray_menu_label(key: &str) -> String {
672 crate::ui_locale::tr(key)
673 }
674
668 675 impl Tray {
669 676 pub fn new(sound_on: bool, do_not_disturb: bool, icon_png: &[u8]) -> Option<Self> {
670 677 let (plain, with_dot) = tray_icons(icon_png)?;
671 let open = MenuItem::with_id(ID_OPEN, "Open", true, None);
672 let sound = CheckMenuItem::with_id(ID_SOUND, "Mute sound", true, !sound_on, None);
678 let open = MenuItem::with_id(ID_OPEN, tray_menu_label("tray.open"), true, None);
679 let sound = CheckMenuItem::with_id(
680 ID_SOUND,
681 tray_menu_label("tray.mute_sound"),
682 true,
683 !sound_on,
684 None,
685 );
673 686 let dnd = CheckMenuItem::with_id(
674 687 ID_DO_NOT_DISTURB,
675 "Do not disturb",
688 tray_menu_label("tray.do_not_disturb"),
676 689 true,
677 690 do_not_disturb,
678 691 None,
679 692 );
680 let settings = MenuItem::with_id(ID_SETTINGS, "Notifications", true, None);
681 let quit = MenuItem::with_id(ID_QUIT, "Quit", true, None);
693 let settings = MenuItem::with_id(
694 ID_SETTINGS,
695 tray_menu_label("tray.notifications"),
696 true,
697 None,
698 );
699 let quit = MenuItem::with_id(ID_QUIT, tray_menu_label("tray.quit"), true, None);
682 700 let menu = Menu::new();
683 701 menu.append_items(&[
684 702 &open,
@@ -699,13 +717,28 @@ impl Tray {
699 717 .ok()?;
700 718 Some(Tray {
701 719 icon,
720 open,
702 721 sound,
703 722 do_not_disturb: dnd,
723 settings,
724 quit,
704 725 plain,
705 726 with_dot,
706 727 })
707 728 }
708 729
730 pub fn relocalize(&self) {
731 let _ = self.open.set_text(tray_menu_label("tray.open"));
732 let _ = self.sound.set_text(tray_menu_label("tray.mute_sound"));
733 let _ = self
734 .do_not_disturb
735 .set_text(tray_menu_label("tray.do_not_disturb"));
736 let _ = self
737 .settings
738 .set_text(tray_menu_label("tray.notifications"));
739 let _ = self.quit.set_text(tray_menu_label("tray.quit"));
740 }
741
709 742 pub fn poll(&self) -> Vec<TrayCommand> {
710 743 let mut commands = Vec::new();
711 744 while let Ok(event) = MenuEvent::receiver().try_recv() {
@@ -743,6 +776,7 @@ impl Tray {
743 776 }
744 777
745 778 pub fn sync(&self, sound_on: bool, do_not_disturb: bool, mention: bool) {
779 self.relocalize();
746 780 self.sound.set_checked(!sound_on);
747 781 self.do_not_disturb.set_checked(do_not_disturb);
748 782 let icon = if mention { &self.with_dot } else { &self.plain };
@@ -659,26 +659,44 @@ const ID_QUIT: &str = "quit";
659
659
660pub struct Tray {
660pub struct Tray {
661 icon: TrayIcon,
661 icon: TrayIcon,
662 open: MenuItem,
662 sound: CheckMenuItem,
663 sound: CheckMenuItem,
663 do_not_disturb: CheckMenuItem,
664 do_not_disturb: CheckMenuItem,
665 settings: MenuItem,
666 quit: MenuItem,
664 plain: Icon,
667 plain: Icon,
665 with_dot: Icon,
668 with_dot: Icon,
666}
669}
667
670
671fn tray_menu_label(key: &str) -> String {
672 crate::ui_locale::tr(key)
673}
674
668impl Tray {
675impl Tray {
669 pub fn new(sound_on: bool, do_not_disturb: bool, icon_png: &[u8]) -> Option<Self> {
676 pub fn new(sound_on: bool, do_not_disturb: bool, icon_png: &[u8]) -> Option<Self> {
670 let (plain, with_dot) = tray_icons(icon_png)?;
677 let (plain, with_dot) = tray_icons(icon_png)?;
671 let open = MenuItem::with_id(ID_OPEN, "Open", true, None);
678 let open = MenuItem::with_id(ID_OPEN, tray_menu_label("tray.open"), true, None);
672 let sound = CheckMenuItem::with_id(ID_SOUND, "Mute sound", true, !sound_on, None);
679 let sound = CheckMenuItem::with_id(
680 ID_SOUND,
681 tray_menu_label("tray.mute_sound"),
682 true,
683 !sound_on,
684 None,
685 );
673 let dnd = CheckMenuItem::with_id(
686 let dnd = CheckMenuItem::with_id(
674 ID_DO_NOT_DISTURB,
687 ID_DO_NOT_DISTURB,
675 "Do not disturb",
688 tray_menu_label("tray.do_not_disturb"),
676 true,
689 true,
677 do_not_disturb,
690 do_not_disturb,
678 None,
691 None,
679 );
692 );
680 let settings = MenuItem::with_id(ID_SETTINGS, "Notifications", true, None);
693 let settings = MenuItem::with_id(
681 let quit = MenuItem::with_id(ID_QUIT, "Quit", true, None);
694 ID_SETTINGS,
695 tray_menu_label("tray.notifications"),
696 true,
697 None,
698 );
699 let quit = MenuItem::with_id(ID_QUIT, tray_menu_label("tray.quit"), true, None);
682 let menu = Menu::new();
700 let menu = Menu::new();
683 menu.append_items(&[
701 menu.append_items(&[
684 &open,
702 &open,
@@ -699,13 +717,28 @@ impl Tray {
699 .ok()?;
717 .ok()?;
700 Some(Tray {
718 Some(Tray {
701 icon,
719 icon,
720 open,
702 sound,
721 sound,
703 do_not_disturb: dnd,
722 do_not_disturb: dnd,
723 settings,
724 quit,
704 plain,
725 plain,
705 with_dot,
726 with_dot,
706 })
727 })
707 }
728 }
708
729
730 pub fn relocalize(&self) {
731 let _ = self.open.set_text(tray_menu_label("tray.open"));
732 let _ = self.sound.set_text(tray_menu_label("tray.mute_sound"));
733 let _ = self
734 .do_not_disturb
735 .set_text(tray_menu_label("tray.do_not_disturb"));
736 let _ = self
737 .settings
738 .set_text(tray_menu_label("tray.notifications"));
739 let _ = self.quit.set_text(tray_menu_label("tray.quit"));
740 }
741
709 pub fn poll(&self) -> Vec<TrayCommand> {
742 pub fn poll(&self) -> Vec<TrayCommand> {
710 let mut commands = Vec::new();
743 let mut commands = Vec::new();
711 while let Ok(event) = MenuEvent::receiver().try_recv() {
744 while let Ok(event) = MenuEvent::receiver().try_recv() {
@@ -743,6 +776,7 @@ impl Tray {
743 }
776 }
744
777
745 pub fn sync(&self, sound_on: bool, do_not_disturb: bool, mention: bool) {
778 pub fn sync(&self, sound_on: bool, do_not_disturb: bool, mention: bool) {
779 self.relocalize();
746 self.sound.set_checked(!sound_on);
780 self.sound.set_checked(!sound_on);
747 self.do_not_disturb.set_checked(do_not_disturb);
781 self.do_not_disturb.set_checked(do_not_disturb);
748 let icon = if mention { &self.with_dot } else { &self.plain };
782 let icon = if mention { &self.with_dot } else { &self.plain };
crates/app-base/src/ui_locale.rs added +249 −0
@@ -0,0 +1,249 @@
1 use std::collections::HashMap;
2
3 use store::Store;
4
5 const META_KEY: &str = "ui.locale";
6 const PREFERENCE_KEY: &str = "preference";
7
8 #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
9 pub enum LocalePreference {
10 #[default]
11 Auto,
12 English,
13 German,
14 }
15
16 impl LocalePreference {
17 pub const ALL: [LocalePreference; 3] = [
18 LocalePreference::Auto,
19 LocalePreference::English,
20 LocalePreference::German,
21 ];
22
23 pub fn key(self) -> &'static str {
24 match self {
25 LocalePreference::Auto => "auto",
26 LocalePreference::English => "en",
27 LocalePreference::German => "de",
28 }
29 }
30
31 pub fn from_key(key: &str) -> Option<LocalePreference> {
32 Self::ALL
33 .into_iter()
34 .find(|preference| preference.key() == key)
35 }
36 }
37
38 pub fn os_language_tag() -> String {
39 sys_locale::get_locale().unwrap_or_else(|| "en".to_owned())
40 }
41
42 pub fn effective_locale(pref: LocalePreference) -> &'static str {
43 effective_locale_for(pref, &os_language_tag())
44 }
45
46 pub(crate) fn effective_locale_for(pref: LocalePreference, os_tag: &str) -> &'static str {
47 match pref {
48 LocalePreference::German => "de",
49 LocalePreference::English => "en",
50 LocalePreference::Auto => {
51 if os_tag.to_lowercase().starts_with("de") {
52 "de"
53 } else {
54 "en"
55 }
56 }
57 }
58 }
59
60 pub fn apply_locale(locale: &str) {
61 rust_i18n::set_locale(locale);
62 gpui_kit::component::set_locale(locale);
63 }
64
65 pub fn load(store: &Store) -> LocalePreference {
66 store
67 .meta(META_KEY)
68 .ok()
69 .flatten()
70 .map(|text| parse(&text))
71 .unwrap_or_default()
72 }
73
74 pub fn save(store: &Store, pref: LocalePreference) {
75 let _ = store.set_meta(META_KEY, &serialize(pref));
76 }
77
78 fn serialize(pref: LocalePreference) -> String {
79 format!("{PREFERENCE_KEY}={}", pref.key())
80 }
81
82 fn parse(text: &str) -> LocalePreference {
83 for line in text.lines() {
84 if let Some((PREFERENCE_KEY, value)) = line.split_once('=') {
85 if let Some(pref) = LocalePreference::from_key(value.trim()) {
86 return pref;
87 }
88 }
89 }
90 LocalePreference::default()
91 }
92
93 pub fn tr(key: &str) -> String {
94 rust_i18n::t!(key).to_string()
95 }
96
97 pub fn tr_args(key: &str, args: &HashMap<String, String>) -> String {
98 if args.is_empty() {
99 return tr(key);
100 }
101 let patterns: Vec<&str> = args.keys().map(String::as_str).collect();
102 let values: Vec<String> = patterns.iter().map(|name| args[*name].clone()).collect();
103 rust_i18n::replace_patterns(&tr(key), &patterns, &values)
104 }
105
106 /// Separator between an i18n key and a detail payload in `CallUpdate::Notice`.
107 pub const NOTICE_DETAIL_SEP: char = '\u{1f}';
108
109 /// Resolve a call/UI notice payload: bare key, or `key` + detail after [`NOTICE_DETAIL_SEP`].
110 pub fn localize_notice(payload: &str) -> String {
111 if let Some((key, detail)) = payload.split_once(NOTICE_DETAIL_SEP) {
112 let mut args = HashMap::new();
113 args.insert("detail".to_owned(), detail.to_owned());
114 return tr_args(key, &args);
115 }
116 if payload.contains('.') {
117 return tr(payload);
118 }
119 payload.to_owned()
120 }
121
122 pub fn notice_payload(key: &str, detail: impl std::fmt::Display) -> String {
123 format!("{key}{NOTICE_DETAIL_SEP}{detail}")
124 }
125
126 #[cfg(test)]
127 mod tests {
128 use std::sync::{Mutex, MutexGuard};
129
130 use super::*;
131 use tempfile::tempdir;
132
133 fn locale_test_lock() -> MutexGuard<'static, ()> {
134 static LOCK: Mutex<()> = Mutex::new(());
135 LOCK.lock().unwrap_or_else(|error| error.into_inner())
136 }
137
138 #[test]
139 fn ui_locale_effective_prefers_explicit_english_and_german() {
140 let _guard = locale_test_lock();
141 assert_eq!(
142 effective_locale_for(LocalePreference::English, "de-DE"),
143 "en"
144 );
145 assert_eq!(
146 effective_locale_for(LocalePreference::German, "en-US"),
147 "de"
148 );
149 }
150
151 #[test]
152 fn ui_locale_effective_auto_follows_os_tag() {
153 let _guard = locale_test_lock();
154 assert_eq!(effective_locale_for(LocalePreference::Auto, "de-DE"), "de");
155 assert_eq!(effective_locale_for(LocalePreference::Auto, "de"), "de");
156 assert_eq!(effective_locale_for(LocalePreference::Auto, "en-US"), "en");
157 assert_eq!(effective_locale_for(LocalePreference::Auto, "fr-FR"), "en");
158 }
159
160 #[test]
161 fn ui_locale_load_save_roundtrip_in_store() {
162 let _guard = locale_test_lock();
163 let store = Store::open_in_memory().expect("in-memory store");
164 assert_eq!(load(&store), LocalePreference::Auto);
165 save(&store, LocalePreference::German);
166 assert_eq!(load(&store), LocalePreference::German);
167 save(&store, LocalePreference::English);
168 assert_eq!(load(&store), LocalePreference::English);
169 }
170
171 #[test]
172 fn ui_locale_persists_via_tempfile_store() {
173 let _guard = locale_test_lock();
174 let directory = tempdir().expect("tempdir");
175 let path = directory.path().join("locale.sqlite3");
176 let store = Store::open(&path).expect("store on disk");
177 save(&store, LocalePreference::German);
178 drop(store);
179 let store = Store::open(&path).expect("reopen store");
180 assert_eq!(load(&store), LocalePreference::German);
181 }
182
183 #[test]
184 fn ui_locale_unknown_preference_falls_back_to_auto() {
185 let _guard = locale_test_lock();
186 let store = Store::open_in_memory().expect("in-memory store");
187 let _ = store.set_meta(META_KEY, "preference=fr");
188 assert_eq!(load(&store), LocalePreference::Auto);
189 }
190
191 #[test]
192 fn ui_locale_tr_resolves_catalog_in_en_and_de() {
193 let _guard = locale_test_lock();
194 apply_locale("en");
195 assert_eq!(tr("common.cancel"), "Cancel");
196 apply_locale("de");
197 assert_eq!(tr("common.cancel"), "Abbrechen");
198 }
199
200 #[test]
201 fn ui_locale_tr_args_substitutes_detail() {
202 let _guard = locale_test_lock();
203 apply_locale("en");
204 let mut args = HashMap::new();
205 args.insert("detail".to_owned(), "timeout".to_owned());
206 assert_eq!(
207 tr_args("notice.generic_detail", &args),
208 "Something went wrong: timeout"
209 );
210 }
211
212 #[test]
213 fn ui_locale_notice_localizes_call_on_hold_in_de() {
214 let _guard = locale_test_lock();
215 apply_locale("de");
216 let localized = localize_notice("calls.notice.on_hold");
217 assert_eq!(localized, "Setzen Sie den Anruf zuerst fort");
218 }
219
220 #[test]
221 fn ui_locale_sidebar_and_status_menu_in_de() {
222 let _guard = locale_test_lock();
223 apply_locale("de");
224 assert_eq!(tr("sidebar.quick_views"), "Schnellansichten");
225 assert_eq!(tr("status_menu.view_account"), "Konto anzeigen");
226 assert_eq!(tr("shell.settings_and_more"), "Einstellungen und mehr");
227 }
228
229 #[test]
230 fn ui_locale_tray_keys_resolve() {
231 let _guard = locale_test_lock();
232 apply_locale("en");
233 assert_eq!(tr("tray.open"), "Open");
234 assert_eq!(tr("tray.quit"), "Quit");
235 assert_eq!(tr("tray.mute_sound"), "Mute sound");
236 apply_locale("de");
237 assert_eq!(tr("tray.do_not_disturb"), "Nicht stören");
238 assert_eq!(tr("tray.notifications"), "Benachrichtigungen");
239 }
240
241 #[test]
242 fn ui_locale_fallback_missing_key_returns_english_or_key() {
243 let _guard = locale_test_lock();
244 apply_locale("de");
245 assert_eq!(tr("common.cancel"), "Abbrechen");
246 let missing = tr("catalog.does_not_exist_yet");
247 assert!(!missing.is_empty());
248 }
249 }
@@ -0,0 +1,249 @@
1use std::collections::HashMap;
2
3use store::Store;
4
5const META_KEY: &str = "ui.locale";
6const PREFERENCE_KEY: &str = "preference";
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
9pub enum LocalePreference {
10 #[default]
11 Auto,
12 English,
13 German,
14}
15
16impl LocalePreference {
17 pub const ALL: [LocalePreference; 3] = [
18 LocalePreference::Auto,
19 LocalePreference::English,
20 LocalePreference::German,
21 ];
22
23 pub fn key(self) -> &'static str {
24 match self {
25 LocalePreference::Auto => "auto",
26 LocalePreference::English => "en",
27 LocalePreference::German => "de",
28 }
29 }
30
31 pub fn from_key(key: &str) -> Option<LocalePreference> {
32 Self::ALL
33 .into_iter()
34 .find(|preference| preference.key() == key)
35 }
36}
37
38pub fn os_language_tag() -> String {
39 sys_locale::get_locale().unwrap_or_else(|| "en".to_owned())
40}
41
42pub fn effective_locale(pref: LocalePreference) -> &'static str {
43 effective_locale_for(pref, &os_language_tag())
44}
45
46pub(crate) fn effective_locale_for(pref: LocalePreference, os_tag: &str) -> &'static str {
47 match pref {
48 LocalePreference::German => "de",
49 LocalePreference::English => "en",
50 LocalePreference::Auto => {
51 if os_tag.to_lowercase().starts_with("de") {
52 "de"
53 } else {
54 "en"
55 }
56 }
57 }
58}
59
60pub fn apply_locale(locale: &str) {
61 rust_i18n::set_locale(locale);
62 gpui_kit::component::set_locale(locale);
63}
64
65pub fn load(store: &Store) -> LocalePreference {
66 store
67 .meta(META_KEY)
68 .ok()
69 .flatten()
70 .map(|text| parse(&text))
71 .unwrap_or_default()
72}
73
74pub fn save(store: &Store, pref: LocalePreference) {
75 let _ = store.set_meta(META_KEY, &serialize(pref));
76}
77
78fn serialize(pref: LocalePreference) -> String {
79 format!("{PREFERENCE_KEY}={}", pref.key())
80}
81
82fn parse(text: &str) -> LocalePreference {
83 for line in text.lines() {
84 if let Some((PREFERENCE_KEY, value)) = line.split_once('=') {
85 if let Some(pref) = LocalePreference::from_key(value.trim()) {
86 return pref;
87 }
88 }
89 }
90 LocalePreference::default()
91}
92
93pub fn tr(key: &str) -> String {
94 rust_i18n::t!(key).to_string()
95}
96
97pub fn tr_args(key: &str, args: &HashMap<String, String>) -> String {
98 if args.is_empty() {
99 return tr(key);
100 }
101 let patterns: Vec<&str> = args.keys().map(String::as_str).collect();
102 let values: Vec<String> = patterns.iter().map(|name| args[*name].clone()).collect();
103 rust_i18n::replace_patterns(&tr(key), &patterns, &values)
104}
105
106/// Separator between an i18n key and a detail payload in `CallUpdate::Notice`.
107pub const NOTICE_DETAIL_SEP: char = '\u{1f}';
108
109/// Resolve a call/UI notice payload: bare key, or `key` + detail after [`NOTICE_DETAIL_SEP`].
110pub fn localize_notice(payload: &str) -> String {
111 if let Some((key, detail)) = payload.split_once(NOTICE_DETAIL_SEP) {
112 let mut args = HashMap::new();
113 args.insert("detail".to_owned(), detail.to_owned());
114 return tr_args(key, &args);
115 }
116 if payload.contains('.') {
117 return tr(payload);
118 }
119 payload.to_owned()
120}
121
122pub fn notice_payload(key: &str, detail: impl std::fmt::Display) -> String {
123 format!("{key}{NOTICE_DETAIL_SEP}{detail}")
124}
125
126#[cfg(test)]
127mod tests {
128 use std::sync::{Mutex, MutexGuard};
129
130 use super::*;
131 use tempfile::tempdir;
132
133 fn locale_test_lock() -> MutexGuard<'static, ()> {
134 static LOCK: Mutex<()> = Mutex::new(());
135 LOCK.lock().unwrap_or_else(|error| error.into_inner())
136 }
137
138 #[test]
139 fn ui_locale_effective_prefers_explicit_english_and_german() {
140 let _guard = locale_test_lock();
141 assert_eq!(
142 effective_locale_for(LocalePreference::English, "de-DE"),
143 "en"
144 );
145 assert_eq!(
146 effective_locale_for(LocalePreference::German, "en-US"),
147 "de"
148 );
149 }
150
151 #[test]
152 fn ui_locale_effective_auto_follows_os_tag() {
153 let _guard = locale_test_lock();
154 assert_eq!(effective_locale_for(LocalePreference::Auto, "de-DE"), "de");
155 assert_eq!(effective_locale_for(LocalePreference::Auto, "de"), "de");
156 assert_eq!(effective_locale_for(LocalePreference::Auto, "en-US"), "en");
157 assert_eq!(effective_locale_for(LocalePreference::Auto, "fr-FR"), "en");
158 }
159
160 #[test]
161 fn ui_locale_load_save_roundtrip_in_store() {
162 let _guard = locale_test_lock();
163 let store = Store::open_in_memory().expect("in-memory store");
164 assert_eq!(load(&store), LocalePreference::Auto);
165 save(&store, LocalePreference::German);
166 assert_eq!(load(&store), LocalePreference::German);
167 save(&store, LocalePreference::English);
168 assert_eq!(load(&store), LocalePreference::English);
169 }
170
171 #[test]
172 fn ui_locale_persists_via_tempfile_store() {
173 let _guard = locale_test_lock();
174 let directory = tempdir().expect("tempdir");
175 let path = directory.path().join("locale.sqlite3");
176 let store = Store::open(&path).expect("store on disk");
177 save(&store, LocalePreference::German);
178 drop(store);
179 let store = Store::open(&path).expect("reopen store");
180 assert_eq!(load(&store), LocalePreference::German);
181 }
182
183 #[test]
184 fn ui_locale_unknown_preference_falls_back_to_auto() {
185 let _guard = locale_test_lock();
186 let store = Store::open_in_memory().expect("in-memory store");
187 let _ = store.set_meta(META_KEY, "preference=fr");
188 assert_eq!(load(&store), LocalePreference::Auto);
189 }
190
191 #[test]
192 fn ui_locale_tr_resolves_catalog_in_en_and_de() {
193 let _guard = locale_test_lock();
194 apply_locale("en");
195 assert_eq!(tr("common.cancel"), "Cancel");
196 apply_locale("de");
197 assert_eq!(tr("common.cancel"), "Abbrechen");
198 }
199
200 #[test]
201 fn ui_locale_tr_args_substitutes_detail() {
202 let _guard = locale_test_lock();
203 apply_locale("en");
204 let mut args = HashMap::new();
205 args.insert("detail".to_owned(), "timeout".to_owned());
206 assert_eq!(
207 tr_args("notice.generic_detail", &args),
208 "Something went wrong: timeout"
209 );
210 }
211
212 #[test]
213 fn ui_locale_notice_localizes_call_on_hold_in_de() {
214 let _guard = locale_test_lock();
215 apply_locale("de");
216 let localized = localize_notice("calls.notice.on_hold");
217 assert_eq!(localized, "Setzen Sie den Anruf zuerst fort");
218 }
219
220 #[test]
221 fn ui_locale_sidebar_and_status_menu_in_de() {
222 let _guard = locale_test_lock();
223 apply_locale("de");
224 assert_eq!(tr("sidebar.quick_views"), "Schnellansichten");
225 assert_eq!(tr("status_menu.view_account"), "Konto anzeigen");
226 assert_eq!(tr("shell.settings_and_more"), "Einstellungen und mehr");
227 }
228
229 #[test]
230 fn ui_locale_tray_keys_resolve() {
231 let _guard = locale_test_lock();
232 apply_locale("en");
233 assert_eq!(tr("tray.open"), "Open");
234 assert_eq!(tr("tray.quit"), "Quit");
235 assert_eq!(tr("tray.mute_sound"), "Mute sound");
236 apply_locale("de");
237 assert_eq!(tr("tray.do_not_disturb"), "Nicht stören");
238 assert_eq!(tr("tray.notifications"), "Benachrichtigungen");
239 }
240
241 #[test]
242 fn ui_locale_fallback_missing_key_returns_english_or_key() {
243 let _guard = locale_test_lock();
244 apply_locale("de");
245 assert_eq!(tr("common.cancel"), "Abbrechen");
246 let missing = tr("catalog.does_not_exist_yet");
247 assert!(!missing.is_empty());
248 }
249}
crates/app-state/src/call/consult.rs +1 −1
@@ -117,7 +117,7 @@ impl AppState {
117 117 };
118 118 match update {
119 119 CallUpdate::Notice(text) => {
120 self.raise_notice(text, None, cx);
120 self.raise_notice(app_base::ui_locale::localize_notice(&text), None, cx);
121 121 return;
122 122 }
123 123 CallUpdate::TransferResult { succeeded } => {
@@ -117,7 +117,7 @@ impl AppState {
117 };
117 };
118 match update {
118 match update {
119 CallUpdate::Notice(text) => {
119 CallUpdate::Notice(text) => {
120 self.raise_notice(text, None, cx);
120 self.raise_notice(app_base::ui_locale::localize_notice(&text), None, cx);
121 return;
121 return;
122 }
122 }
123 CallUpdate::TransferResult { succeeded } => {
123 CallUpdate::TransferResult { succeeded } => {
crates/app-state/src/channel_filter.rs +7 −2
@@ -1,7 +1,12 @@
1 1 use store::SidebarTeam;
2 2
3 pub const CHANNEL_FILTER_PLACEHOLDER: &str = "Filter by channel name";
4 pub const UNREAD_PILL: &str = "Unread";
3 pub fn channel_filter_placeholder() -> String {
4 app_base::ui_locale::tr("sidebar.filter.channel_placeholder")
5 }
6
7 pub fn channel_unread_pill() -> String {
8 app_base::ui_locale::tr("sidebar.filter.unread")
9 }
5 10
6 11 #[derive(Debug, Clone, Default, PartialEq, Eq)]
7 12 pub struct ChannelFilter {
@@ -1,7 +1,12 @@
1use store::SidebarTeam;
1use store::SidebarTeam;
2
2
3pub const CHANNEL_FILTER_PLACEHOLDER: &str = "Filter by channel name";
3pub fn channel_filter_placeholder() -> String {
4pub const UNREAD_PILL: &str = "Unread";
4 app_base::ui_locale::tr("sidebar.filter.channel_placeholder")
5}
6
7pub fn channel_unread_pill() -> String {
8 app_base::ui_locale::tr("sidebar.filter.unread")
9}
5
10
6#[derive(Debug, Clone, Default, PartialEq, Eq)]
11#[derive(Debug, Clone, Default, PartialEq, Eq)]
7pub struct ChannelFilter {
12pub struct ChannelFilter {
crates/app-state/src/chat_filter.rs +30 −12
@@ -6,12 +6,30 @@ use crate::activity::{Entry, Kind};
6 6 use crate::app_state::chat_title;
7 7 use crate::sidebar_model::{MUTED_ID, OTHERS_ID, Section, SectionInput, build_sections};
8 8
9 pub const FILTER_PLACEHOLDER: &str = "Filter by person or chat name";
10 pub const NO_MATCHES: &str = "We didn't find any matches.";
11 pub const CLEAR_FILTERS: &str = "Clear filters";
12 pub const CLEAR_FILTER_TEXT: &str = "Clear filter text";
13 pub const SHOW_FILTER_TEXT: &str = "Show filter text box";
14 pub const CLOSE_FILTER_TEXT: &str = "Close filter text box";
9 pub fn filter_placeholder() -> String {
10 app_base::ui_locale::tr("sidebar.filter.placeholder")
11 }
12
13 pub fn filter_no_matches() -> String {
14 app_base::ui_locale::tr("sidebar.filter.no_matches")
15 }
16
17 pub fn filter_clear_all() -> String {
18 app_base::ui_locale::tr("sidebar.filter.clear")
19 }
20
21 pub fn filter_clear_text() -> String {
22 app_base::ui_locale::tr("sidebar.filter.clear_text")
23 }
24
25 pub fn filter_show_box() -> String {
26 app_base::ui_locale::tr("sidebar.filter.show_box")
27 }
28
29 pub fn filter_close_box() -> String {
30 app_base::ui_locale::tr("sidebar.filter.close_box")
31 }
32
15 33 pub const MORE_FILTERS: &str = "More filters";
16 34 pub const FEWER_FILTERS: &str = "Fewer filters";
17 35 const MEETING_KIND: &str = "meeting";
@@ -33,13 +51,13 @@ impl ChatFilterPill {
33 51 ];
34 52 pub const OVERFLOW: [ChatFilterPill; 2] = [ChatFilterPill::Mentions, ChatFilterPill::Muted];
35 53
36 pub fn label(self) -> &'static str {
54 pub fn label(self) -> String {
37 55 match self {
38 ChatFilterPill::Unread => "Unread",
39 ChatFilterPill::Mentions => "@Mentions",
40 ChatFilterPill::Chats => "Chats",
41 ChatFilterPill::Meetings => "Meeting chats",
42 ChatFilterPill::Muted => "Muted",
56 ChatFilterPill::Unread => app_base::ui_locale::tr("sidebar.pill.unread"),
57 ChatFilterPill::Mentions => app_base::ui_locale::tr("sidebar.pill.mentions"),
58 ChatFilterPill::Chats => app_base::ui_locale::tr("sidebar.pill.chats"),
59 ChatFilterPill::Meetings => app_base::ui_locale::tr("sidebar.pill.meetings"),
60 ChatFilterPill::Muted => app_base::ui_locale::tr("sidebar.pill.muted"),
43 61 }
44 62 }
45 63
@@ -6,12 +6,30 @@ use crate::activity::{Entry, Kind};
6use crate::app_state::chat_title;
6use crate::app_state::chat_title;
7use crate::sidebar_model::{MUTED_ID, OTHERS_ID, Section, SectionInput, build_sections};
7use crate::sidebar_model::{MUTED_ID, OTHERS_ID, Section, SectionInput, build_sections};
8
8
9pub const FILTER_PLACEHOLDER: &str = "Filter by person or chat name";
9pub fn filter_placeholder() -> String {
10pub const NO_MATCHES: &str = "We didn't find any matches.";
10 app_base::ui_locale::tr("sidebar.filter.placeholder")
11pub const CLEAR_FILTERS: &str = "Clear filters";
11}
12pub const CLEAR_FILTER_TEXT: &str = "Clear filter text";
12
13pub const SHOW_FILTER_TEXT: &str = "Show filter text box";
13pub fn filter_no_matches() -> String {
14pub const CLOSE_FILTER_TEXT: &str = "Close filter text box";
14 app_base::ui_locale::tr("sidebar.filter.no_matches")
15}
16
17pub fn filter_clear_all() -> String {
18 app_base::ui_locale::tr("sidebar.filter.clear")
19}
20
21pub fn filter_clear_text() -> String {
22 app_base::ui_locale::tr("sidebar.filter.clear_text")
23}
24
25pub fn filter_show_box() -> String {
26 app_base::ui_locale::tr("sidebar.filter.show_box")
27}
28
29pub fn filter_close_box() -> String {
30 app_base::ui_locale::tr("sidebar.filter.close_box")
31}
32
15pub const MORE_FILTERS: &str = "More filters";
33pub const MORE_FILTERS: &str = "More filters";
16pub const FEWER_FILTERS: &str = "Fewer filters";
34pub const FEWER_FILTERS: &str = "Fewer filters";
17const MEETING_KIND: &str = "meeting";
35const MEETING_KIND: &str = "meeting";
@@ -33,13 +51,13 @@ impl ChatFilterPill {
33 ];
51 ];
34 pub const OVERFLOW: [ChatFilterPill; 2] = [ChatFilterPill::Mentions, ChatFilterPill::Muted];
52 pub const OVERFLOW: [ChatFilterPill; 2] = [ChatFilterPill::Mentions, ChatFilterPill::Muted];
35
53
36 pub fn label(self) -> &'static str {
54 pub fn label(self) -> String {
37 match self {
55 match self {
38 ChatFilterPill::Unread => "Unread",
56 ChatFilterPill::Unread => app_base::ui_locale::tr("sidebar.pill.unread"),
39 ChatFilterPill::Mentions => "@Mentions",
57 ChatFilterPill::Mentions => app_base::ui_locale::tr("sidebar.pill.mentions"),
40 ChatFilterPill::Chats => "Chats",
58 ChatFilterPill::Chats => app_base::ui_locale::tr("sidebar.pill.chats"),
41 ChatFilterPill::Meetings => "Meeting chats",
59 ChatFilterPill::Meetings => app_base::ui_locale::tr("sidebar.pill.meetings"),
42 ChatFilterPill::Muted => "Muted",
60 ChatFilterPill::Muted => app_base::ui_locale::tr("sidebar.pill.muted"),
43 }
61 }
44 }
62 }
45
63
crates/app-ui-kit/src/settings_controls.rs +1 −1
@@ -154,7 +154,7 @@ pub fn link_dropdown(
154 154 })
155 155 }
156 156
157 pub fn section_header(title: &'static str, trailing: Option<AnyElement>) -> Div {
157 pub fn section_header(title: String, trailing: Option<AnyElement>) -> Div {
158 158 h_flex()
159 159 .w_full()
160 160 .items_center()
@@ -154,7 +154,7 @@ pub fn link_dropdown(
154 })
154 })
155}
155}
156
156
157pub fn section_header(title: &'static str, trailing: Option<AnyElement>) -> Div {
157pub fn section_header(title: String, trailing: Option<AnyElement>) -> Div {
158 h_flex()
158 h_flex()
159 .w_full()
159 .w_full()
160 .items_center()
160 .items_center()
crates/app/src/active_locale.rs added +34 −0
@@ -0,0 +1,34 @@
1 use app_base::ui_locale::{self, LocalePreference};
2 use gpui_kit::*;
3 use store::Store;
4
5 #[derive(Default)]
6 pub struct ActiveLocale {
7 preference: LocalePreference,
8 }
9
10 impl Global for ActiveLocale {}
11
12 pub fn install(store: &Store, cx: &mut App) {
13 let preference = ui_locale::load(store);
14 ui_locale::apply_locale(ui_locale::effective_locale(preference));
15 cx.set_global(ActiveLocale { preference });
16 }
17
18 pub fn current_preference(cx: &App) -> LocalePreference {
19 cx.try_global::<ActiveLocale>()
20 .map(|active| active.preference)
21 .unwrap_or_default()
22 }
23
24 #[allow(dead_code)]
25 pub fn effective(cx: &App) -> &'static str {
26 ui_locale::effective_locale(current_preference(cx))
27 }
28
29 pub fn set_preference(pref: LocalePreference, store: &Store, cx: &mut App) {
30 ui_locale::save(store, pref);
31 ui_locale::apply_locale(ui_locale::effective_locale(pref));
32 cx.set_global(ActiveLocale { preference: pref });
33 cx.refresh_windows();
34 }
@@ -0,0 +1,34 @@
1use app_base::ui_locale::{self, LocalePreference};
2use gpui_kit::*;
3use store::Store;
4
5#[derive(Default)]
6pub struct ActiveLocale {
7 preference: LocalePreference,
8}
9
10impl Global for ActiveLocale {}
11
12pub fn install(store: &Store, cx: &mut App) {
13 let preference = ui_locale::load(store);
14 ui_locale::apply_locale(ui_locale::effective_locale(preference));
15 cx.set_global(ActiveLocale { preference });
16}
17
18pub fn current_preference(cx: &App) -> LocalePreference {
19 cx.try_global::<ActiveLocale>()
20 .map(|active| active.preference)
21 .unwrap_or_default()
22}
23
24#[allow(dead_code)]
25pub fn effective(cx: &App) -> &'static str {
26 ui_locale::effective_locale(current_preference(cx))
27}
28
29pub fn set_preference(pref: LocalePreference, store: &Store, cx: &mut App) {
30 ui_locale::save(store, pref);
31 ui_locale::apply_locale(ui_locale::effective_locale(pref));
32 cx.set_global(ActiveLocale { preference: pref });
33 cx.refresh_windows();
34}
crates/app/src/agents/settings_section.rs +329 −26
@@ -1,4 +1,4 @@
1 use agents::{AgentAction, AgentProfile, Environment, OutputFormat};
1 use agents::{AgentAction, AgentBackend, AgentProfile, Environment, OutputFormat};
2 2 use gpui_kit::assets::IconName;
3 3 use gpui_kit::component::{
4 4 button::{Button, ButtonVariants as _},
@@ -11,13 +11,15 @@ use gpui_kit::*;
11 11
12 12 use super::environment_label;
13 13 use super::runs::AgentRuns;
14 use super::settings_controls::{Choice, MenuEntry, PAGE_PADDING, link_dropdown, section_header};
14 use super::settings_controls::{
15 Choice, MenuEntry, PAGE_PADDING, dropdown, link_dropdown, section_header,
16 };
15 17 use super::settings_forms::resume_toggle;
18 use crate::i18n::{tr, tr_args};
16 19 use crate::runtime;
17 20 use crate::theme;
18 21 use crate::views::widgets::icon;
19 22
20 const NOTE: &str = "Agents get the message, its sender and up to 20 earlier messages. Nothing is sent to Teams without you.";
21 23 const DEFAULT_DISTRO: &str = "Ubuntu";
22 24 const PROMPT_MIN_ROWS: usize = 4;
23 25 const PROMPT_MAX_ROWS: usize = 8;
@@ -44,6 +46,9 @@ pub(super) struct AgentForm {
44 46 pub command: Entity<InputState>,
45 47 pub open_session: Entity<InputState>,
46 48 pub mcp_flag: Entity<InputState>,
49 pub base_url: Entity<InputState>,
50 pub model: Entity<InputState>,
51 pub api_key: Entity<InputState>,
47 52 }
48 53
49 54 pub(super) struct ActionForm {
@@ -60,6 +65,10 @@ pub struct AgentsSettings {
60 65 pub(super) agent_form: Option<AgentForm>,
61 66 pub(super) action_form: Option<ActionForm>,
62 67 pub(super) probe: Probe,
68 pub(super) models: Vec<String>,
69 models_request: u64,
70 pub(super) found: Vec<agents::CliHit>,
71 scanned: bool,
63 72 form_subscriptions: Vec<Subscription>,
64 73 _runs_subscription: Subscription,
65 74 }
@@ -98,6 +107,10 @@ impl AgentsSettings {
98 107 agent_form: None,
99 108 action_form: None,
100 109 probe: Probe::Idle,
110 models: Vec::new(),
111 models_request: 0,
112 found: Vec::new(),
113 scanned: false,
101 114 form_subscriptions: Vec::new(),
102 115 _runs_subscription: subscription,
103 116 }
@@ -109,6 +122,8 @@ impl AgentsSettings {
109 122 self.action_form = None;
110 123 self.form_subscriptions.clear();
111 124 self.probe = Probe::Idle;
125 self.models.clear();
126 self.models_request += 1;
112 127 cx.notify();
113 128 }
114 129
@@ -151,6 +166,13 @@ impl AgentsSettings {
151 166 } => distro.clone(),
152 167 _ => String::new(),
153 168 };
169 let (base_url, model) = match &profile.backend {
170 AgentBackend::OpenAi {
171 base_url, model, ..
172 } => (base_url.clone(), model.clone()),
173 AgentBackend::Anthropic { model, .. } => (String::new(), model.clone()),
174 AgentBackend::Command => (String::new(), String::new()),
175 };
154 176 self.agent_form = Some(AgentForm {
155 177 id: profile.id.clone(),
156 178 name: self.line_input(&profile.name, window, cx, Self::commit_agent),
@@ -163,11 +185,35 @@ impl AgentsSettings {
163 185 Self::commit_agent,
164 186 ),
165 187 mcp_flag: self.line_input(&profile.mcp_config_flag, window, cx, Self::commit_agent),
188 base_url: self.line_input(&base_url, window, cx, Self::commit_agent),
189 model: self.line_input(&model, window, cx, Self::commit_agent),
190 api_key: self.line_input("", window, cx, Self::commit_agent),
166 191 });
192 let inputs = self
193 .agent_form
194 .as_ref()
195 .map(|form| (form.base_url.clone(), form.api_key.clone()));
196 if let Some((base_url, api_key)) = inputs {
197 self.watch_model_refresh(&base_url, cx);
198 self.watch_model_refresh(&api_key, cx);
199 }
167 200 self.page = Page::Agent;
201 if profile.is_chat() {
202 self.refresh_models(cx);
203 }
168 204 cx.notify();
169 205 }
170 206
207 fn watch_model_refresh(&mut self, input: &Entity<InputState>, cx: &mut Context<Self>) {
208 self.form_subscriptions
209 .push(cx.subscribe(input, |this, _, event: &InputEvent, cx| {
210 if matches!(event, InputEvent::Blur) {
211 this.commit_agent(cx);
212 this.refresh_models(cx);
213 }
214 }));
215 }
216
171 217 fn open_action(&mut self, action_id: &str, window: &mut Window, cx: &mut Context<Self>) {
172 218 let Some(action) = self
173 219 .runs
@@ -213,6 +259,9 @@ impl AgentsSettings {
213 259 let command = form.command.read(cx).value().to_string();
214 260 let open_session = form.open_session.read(cx).value().to_string();
215 261 let mcp_flag = form.mcp_flag.read(cx).value().trim().to_owned();
262 let base_url = form.base_url.read(cx).value().trim().to_owned();
263 let model = form.model.read(cx).value().trim().to_owned();
264 let typed_key = form.api_key.read(cx).value().trim().to_owned();
216 265 self.runs.update(cx, |runs, cx| {
217 266 runs.update_settings(
218 267 |settings| {
@@ -221,20 +270,96 @@ impl AgentsSettings {
221 270 return;
222 271 };
223 272 agent.name = name;
224 agent.command = command;
225 agent.open_session_command = open_session;
226 agent.mcp_config_flag = mcp_flag;
227 if let Environment::Wsl {
228 distro: Some(current),
229 } = &mut agent.environment
230 {
231 *current = distro;
273 if agent.is_chat() {
274 match &mut agent.backend {
275 AgentBackend::OpenAi {
276 base_url: url,
277 model: current,
278 api_key,
279 } => {
280 *url = base_url;
281 *current = model;
282 if !typed_key.is_empty() {
283 *api_key = typed_key;
284 }
285 }
286 AgentBackend::Anthropic {
287 model: current,
288 api_key,
289 } => {
290 *current = model;
291 if !typed_key.is_empty() {
292 *api_key = typed_key;
293 }
294 }
295 AgentBackend::Command => {}
296 }
297 } else {
298 agent.command = command;
299 agent.open_session_command = open_session;
300 agent.mcp_config_flag = mcp_flag;
301 if let Environment::Wsl {
302 distro: Some(current),
303 } = &mut agent.environment
304 {
305 *current = distro;
306 }
232 307 }
233 308 },
234 309 cx,
235 310 )
236 311 });
237 self.probe = Probe::Idle;
312 }
313
314 pub(super) fn set_model(&mut self, model: String, window: &mut Window, cx: &mut Context<Self>) {
315 let Some(form) = &self.agent_form else {
316 return;
317 };
318 form.model
319 .update(cx, |input, cx| input.set_value(model, window, cx));
320 self.commit_agent(cx);
321 }
322
323 pub(super) fn refresh_models(&mut self, cx: &mut Context<Self>) {
324 let Some(profile) = self.current_agent(cx) else {
325 return;
326 };
327 if !profile.is_chat() {
328 return;
329 }
330 self.models_request += 1;
331 let ticket = self.models_request;
332 self.probe = Probe::Running;
333 cx.notify();
334 let receiver = runtime::spawn(async move { agents::list_models(&profile).await });
335 cx.spawn(async move |this, cx| {
336 let result = receiver
337 .await
338 .unwrap_or_else(|_| Err("cancelled".to_owned()));
339 this.update(cx, |this, cx| {
340 if this.models_request != ticket {
341 return;
342 }
343 match result {
344 Ok(names) => {
345 let count = names.len();
346 this.models = names;
347 this.probe = Probe::Found(if count == 1 {
348 "1 model".to_owned()
349 } else {
350 format!("{count} models")
351 });
352 }
353 Err(error) => {
354 this.models.clear();
355 this.probe = Probe::Missing(error);
356 }
357 }
358 cx.notify();
359 })
360 .ok();
361 })
362 .detach();
238 363 }
239 364
240 365 pub(super) fn commit_action(&mut self, cx: &mut Context<Self>) {
@@ -319,6 +444,18 @@ impl AgentsSettings {
319 444 self.update_action(cx, move |action| action.agent_id = agent_id);
320 445 }
321 446
447 pub(super) fn set_write_with(&mut self, agent_id: String, cx: &mut Context<Self>) {
448 self.runs.update(cx, |runs, cx| {
449 runs.update_settings(|settings| settings.write_with = agent_id, cx)
450 });
451 }
452
453 pub(super) fn rescan(&mut self, cx: &mut Context<Self>) {
454 self.found = agents::scan_clis();
455 self.scanned = true;
456 cx.notify();
457 }
458
322 459 pub(super) fn set_resume_interrupted_runs(&mut self, resume: bool, cx: &mut Context<Self>) {
323 460 self.runs.update(cx, |runs, cx| {
324 461 runs.update_settings(|settings| settings.resume_interrupted_runs = resume, cx)
@@ -393,6 +530,10 @@ impl AgentsSettings {
393 530 let Some(profile) = self.current_agent(cx) else {
394 531 return;
395 532 };
533 if profile.is_chat() {
534 self.refresh_models(cx);
535 return;
536 }
396 537 if profile.command.trim().is_empty() {
397 538 self.probe = Probe::Missing("The command is empty".to_owned());
398 539 cx.notify();
@@ -443,8 +584,30 @@ impl AgentsSettings {
443 584 existing.iter().any(|id| id == candidate)
444 585 });
445 586 let id = profile.id.clone();
587 let chat = profile.is_chat();
588 let mut action = AgentAction::answer_this(&id);
589 action.extra_args.clear();
590 let mut args = std::collections::HashMap::new();
591 args.insert("name".to_owned(), profile.name.clone());
592 action.label = tr_args("agents.settings.answer_with", &args);
593 action.id = unique_id(&format!("answer-{id}"), |candidate| {
594 self.runs
595 .read(cx)
596 .settings()
597 .actions
598 .iter()
599 .any(|action| action.id == candidate)
600 });
446 601 self.runs.update(cx, |runs, cx| {
447 runs.update_settings(|settings| settings.agents.push(profile), cx)
602 runs.update_settings(
603 |settings| {
604 settings.agents.push(profile);
605 if chat {
606 settings.actions.push(action);
607 }
608 },
609 cx,
610 )
448 611 });
449 612 self.open_agent(&id, window, cx);
450 613 }
@@ -457,7 +620,7 @@ impl AgentsSettings {
457 620 .map(|agent| agent.id.clone())
458 621 .unwrap_or_default();
459 622 let mut action = AgentAction::answer_this(&agent_id);
460 action.label = "New action".to_owned();
623 action.label = tr("agents.settings.new_action");
461 624 action.id = unique_id("action", |candidate| {
462 625 settings.actions.iter().any(|action| action.id == candidate)
463 626 });
@@ -482,26 +645,83 @@ impl AgentsSettings {
482 645
483 646 type Preset = (&'static str, fn() -> AgentProfile);
484 647
485 fn agent_presets() -> [Preset; 4] {
648 fn agent_presets() -> [Preset; 9] {
486 649 fn custom() -> AgentProfile {
487 650 AgentProfile {
488 651 id: "custom".to_owned(),
489 name: "Custom agent".to_owned(),
652 name: tr("agents.settings.custom_agent"),
490 653 environment: Environment::Host,
491 command: String::new(),
492 654 output: OutputFormat::Text,
493 open_session_command: String::new(),
494 mcp_config_flag: String::new(),
655 ..AgentProfile::default()
495 656 }
496 657 }
497 658 [
498 ("Claude Code (WSL)", AgentProfile::claude_wsl),
659 (
660 "Claude Code (WSL)",
661 AgentProfile::claude_wsl as fn() -> AgentProfile,
662 ),
499 663 ("Claude Code (Windows)", AgentProfile::claude_host),
500 664 ("Copilot CLI (WSL)", AgentProfile::copilot_wsl),
665 ("Ollama", AgentProfile::ollama),
666 ("OpenAI", AgentProfile::openai),
667 ("OpenRouter", AgentProfile::openrouter),
668 ("Anthropic", AgentProfile::anthropic),
669 ("OpenAI-compatible", AgentProfile::openai_compatible),
501 670 ("Custom", custom),
502 671 ]
503 672 }
504 673
674 fn write_with_label(settings: &agents::AgentSettings) -> String {
675 if settings.write_with.is_empty() {
676 return "Microsoft Copilot".to_owned();
677 }
678 settings
679 .agents
680 .iter()
681 .find(|agent| agent.id == settings.write_with && agent.is_chat())
682 .map(|agent| agent.name.clone())
683 .unwrap_or_else(|| "Microsoft Copilot".to_owned())
684 }
685
686 fn write_with_entries(
687 settings: &agents::AgentSettings,
688 this: &Entity<AgentsSettings>,
689 ) -> Vec<MenuEntry> {
690 let mut entries = vec![write_with_entry(
691 this,
692 "Microsoft Copilot",
693 "",
694 settings.write_with.is_empty(),
695 )];
696 for agent in settings.agents.iter().filter(|agent| agent.is_chat()) {
697 entries.push(write_with_entry(
698 this,
699 &agent.name,
700 &agent.id,
701 settings.write_with == agent.id,
702 ));
703 }
704 entries
705 }
706
707 fn write_with_entry(
708 this: &Entity<AgentsSettings>,
709 label: &str,
710 agent_id: &str,
711 selected: bool,
712 ) -> MenuEntry {
713 let (this, agent_id) = (this.clone(), agent_id.to_owned());
714 let choose: Choice = std::rc::Rc::new(move |_, cx| {
715 let agent_id = agent_id.clone();
716 this.update(cx, |this, cx| this.set_write_with(agent_id, cx))
717 });
718 MenuEntry {
719 label: label.to_owned(),
720 selected,
721 choose,
722 }
723 }
724
505 725 fn list_row(
506 726 id: (&'static str, usize),
507 727 leading: Option<AnyElement>,
@@ -568,7 +788,17 @@ fn small_button(id: (&'static str, usize), name: IconName, enabled: bool) -> Sta
568 788
569 789 impl AgentsSettings {
570 790 fn list_page(&mut self, cx: &mut Context<Self>) -> Div {
791 if !self.scanned {
792 self.found = agents::scan_clis();
793 self.scanned = true;
794 }
571 795 let settings = self.runs.read(cx).settings().clone();
796 let found: Vec<agents::CliHit> = self
797 .found
798 .iter()
799 .filter(|hit| !agents::already_installed(&settings.agents, &hit.profile))
800 .cloned()
801 .collect();
572 802 let this = cx.entity();
573 803 let preset_entries: Vec<MenuEntry> = agent_presets()
574 804 .into_iter()
@@ -611,8 +841,12 @@ impl AgentsSettings {
611 841 .into_any_element(),
612 842 ),
613 843 agent.name.clone(),
614 environment_label(&agent.environment),
615 Some(agent.command.clone()),
844 if agent.is_chat() {
845 agent.backend_label()
846 } else {
847 environment_label(&agent.environment)
848 },
849 agent.is_command().then(|| agent.command.clone()),
616 850 )
617 851 .on_click(move |_, window, cx| {
618 852 open.update(cx, |this, cx| this.open_agent(&id, window, cx))
@@ -625,7 +859,8 @@ impl AgentsSettings {
625 859 .agents
626 860 .iter()
627 861 .find(|agent| agent.id == action.agent_id)
628 .map_or("Unknown agent", |agent| agent.name.as_str());
862 .map(|agent| agent.name.clone())
863 .unwrap_or_else(|| tr("agents.settings.unknown_agent"));
629 864 list_row(
630 865 ("action-row", index),
631 866 None,
@@ -660,18 +895,86 @@ impl AgentsSettings {
660 895 ),
661 896 )
662 897 });
898 let write_entries = write_with_entries(&settings, &this);
899 let write_label = write_with_label(&settings);
900 let rescan = this.clone();
901 let found_rows = found.iter().enumerate().map(|(index, hit)| {
902 let (this, profile) = (this.clone(), hit.profile.clone());
903 list_row(
904 ("found-cli", index),
905 None,
906 hit.profile.name.clone(),
907 hit.binary.display().to_string(),
908 Some(hit.profile.command.clone()),
909 )
910 .child(
911 Button::new(("add-found", index))
912 .link()
913 .label(tr("common.add"))
914 .on_click(move |_, window, cx| {
915 let profile = profile.clone();
916 this.update(cx, |this, cx| this.add_agent(profile, window, cx))
917 }),
918 )
919 });
920 let on_computer = tr("agents.settings.on_this_computer");
921 let agents_header = tr("agents.settings.agents_header");
922 let actions_header = tr("agents.settings.actions_header");
663 923 v_flex()
664 924 .w_full()
665 925 .child(section_header(
666 "AGENTS",
926 on_computer.clone(),
927 Some(
928 Button::new("rescan-clis")
929 .link()
930 .label(tr("agents.settings.scan_again"))
931 .on_click(move |_, _, cx| rescan.update(cx, |this, cx| this.rescan(cx)))
932 .into_any_element(),
933 ),
934 ))
935 .child(v_flex().w_full().px(px(8.)).children(found_rows).when(
936 found.is_empty(),
937 |rows| {
938 rows.child(
939 div()
940 .px(px(12.))
941 .py(px(8.))
942 .text_size(px(12.))
943 .text_color(theme::text_muted())
944 .child(tr("agents.settings.no_cli_found")),
945 )
946 },
947 ))
948 .child(section_header(
949 agents_header.clone(),
667 950 Some(link_dropdown("add-agent", "+ Add agent", preset_entries).into_any_element()),
668 951 ))
669 952 .child(v_flex().w_full().px(px(8.)).children(agent_rows))
670 953 .child(section_header(
671 "ACTIONS - IN THIS ORDER IN THE MENU",
954 actions_header,
672 955 Some(add_action.into_any_element()),
673 956 ))
674 957 .child(v_flex().w_full().px(px(8.)).children(action_rows))
958 .child(
959 v_flex()
960 .w_full()
961 .px(px(PAGE_PADDING))
962 .pt(px(16.))
963 .gap(px(6.))
964 .child(
965 div()
966 .text_size(px(14.))
967 .font_weight(FontWeight::SEMIBOLD)
968 .child(tr("agents.settings.write_with")),
969 )
970 .child(
971 div()
972 .text_size(px(12.))
973 .text_color(theme::text_muted())
974 .child(tr("agents.settings.rewrite_hint")),
975 )
976 .child(dropdown("write-with", write_label, write_entries)),
977 )
675 978 .child(resume_toggle(settings.resume_interrupted_runs, this))
676 979 .child(
677 980 div()
@@ -682,7 +985,7 @@ impl AgentsSettings {
682 985 .text_size(px(12.))
683 986 .line_height(relative(1.5))
684 987 .text_color(theme::text_faint())
685 .child(NOTE),
988 .child(tr("agents.settings.note")),
686 989 )
687 990 }
688 991 }
@@ -1,4 +1,4 @@
1use agents::{AgentAction, AgentProfile, Environment, OutputFormat};
1use agents::{AgentAction, AgentBackend, AgentProfile, Environment, OutputFormat};
2use gpui_kit::assets::IconName;
2use gpui_kit::assets::IconName;
3use gpui_kit::component::{
3use gpui_kit::component::{
4 button::{Button, ButtonVariants as _},
4 button::{Button, ButtonVariants as _},
@@ -11,13 +11,15 @@ use gpui_kit::*;
11
11
12use super::environment_label;
12use super::environment_label;
13use super::runs::AgentRuns;
13use super::runs::AgentRuns;
14use super::settings_controls::{Choice, MenuEntry, PAGE_PADDING, link_dropdown, section_header};
14use super::settings_controls::{
15 Choice, MenuEntry, PAGE_PADDING, dropdown, link_dropdown, section_header,
16};
15use super::settings_forms::resume_toggle;
17use super::settings_forms::resume_toggle;
18use crate::i18n::{tr, tr_args};
16use crate::runtime;
19use crate::runtime;
17use crate::theme;
20use crate::theme;
18use crate::views::widgets::icon;
21use crate::views::widgets::icon;
19
22
20const NOTE: &str = "Agents get the message, its sender and up to 20 earlier messages. Nothing is sent to Teams without you.";
21const DEFAULT_DISTRO: &str = "Ubuntu";
23const DEFAULT_DISTRO: &str = "Ubuntu";
22const PROMPT_MIN_ROWS: usize = 4;
24const PROMPT_MIN_ROWS: usize = 4;
23const PROMPT_MAX_ROWS: usize = 8;
25const PROMPT_MAX_ROWS: usize = 8;
@@ -44,6 +46,9 @@ pub(super) struct AgentForm {
44 pub command: Entity<InputState>,
46 pub command: Entity<InputState>,
45 pub open_session: Entity<InputState>,
47 pub open_session: Entity<InputState>,
46 pub mcp_flag: Entity<InputState>,
48 pub mcp_flag: Entity<InputState>,
49 pub base_url: Entity<InputState>,
50 pub model: Entity<InputState>,
51 pub api_key: Entity<InputState>,
47}
52}
48
53
49pub(super) struct ActionForm {
54pub(super) struct ActionForm {
@@ -60,6 +65,10 @@ pub struct AgentsSettings {
60 pub(super) agent_form: Option<AgentForm>,
65 pub(super) agent_form: Option<AgentForm>,
61 pub(super) action_form: Option<ActionForm>,
66 pub(super) action_form: Option<ActionForm>,
62 pub(super) probe: Probe,
67 pub(super) probe: Probe,
68 pub(super) models: Vec<String>,
69 models_request: u64,
70 pub(super) found: Vec<agents::CliHit>,
71 scanned: bool,
63 form_subscriptions: Vec<Subscription>,
72 form_subscriptions: Vec<Subscription>,
64 _runs_subscription: Subscription,
73 _runs_subscription: Subscription,
65}
74}
@@ -98,6 +107,10 @@ impl AgentsSettings {
98 agent_form: None,
107 agent_form: None,
99 action_form: None,
108 action_form: None,
100 probe: Probe::Idle,
109 probe: Probe::Idle,
110 models: Vec::new(),
111 models_request: 0,
112 found: Vec::new(),
113 scanned: false,
101 form_subscriptions: Vec::new(),
114 form_subscriptions: Vec::new(),
102 _runs_subscription: subscription,
115 _runs_subscription: subscription,
103 }
116 }
@@ -109,6 +122,8 @@ impl AgentsSettings {
109 self.action_form = None;
122 self.action_form = None;
110 self.form_subscriptions.clear();
123 self.form_subscriptions.clear();
111 self.probe = Probe::Idle;
124 self.probe = Probe::Idle;
125 self.models.clear();
126 self.models_request += 1;
112 cx.notify();
127 cx.notify();
113 }
128 }
114
129
@@ -151,6 +166,13 @@ impl AgentsSettings {
151 } => distro.clone(),
166 } => distro.clone(),
152 _ => String::new(),
167 _ => String::new(),
153 };
168 };
169 let (base_url, model) = match &profile.backend {
170 AgentBackend::OpenAi {
171 base_url, model, ..
172 } => (base_url.clone(), model.clone()),
173 AgentBackend::Anthropic { model, .. } => (String::new(), model.clone()),
174 AgentBackend::Command => (String::new(), String::new()),
175 };
154 self.agent_form = Some(AgentForm {
176 self.agent_form = Some(AgentForm {
155 id: profile.id.clone(),
177 id: profile.id.clone(),
156 name: self.line_input(&profile.name, window, cx, Self::commit_agent),
178 name: self.line_input(&profile.name, window, cx, Self::commit_agent),
@@ -163,11 +185,35 @@ impl AgentsSettings {
163 Self::commit_agent,
185 Self::commit_agent,
164 ),
186 ),
165 mcp_flag: self.line_input(&profile.mcp_config_flag, window, cx, Self::commit_agent),
187 mcp_flag: self.line_input(&profile.mcp_config_flag, window, cx, Self::commit_agent),
188 base_url: self.line_input(&base_url, window, cx, Self::commit_agent),
189 model: self.line_input(&model, window, cx, Self::commit_agent),
190 api_key: self.line_input("", window, cx, Self::commit_agent),
166 });
191 });
192 let inputs = self
193 .agent_form
194 .as_ref()
195 .map(|form| (form.base_url.clone(), form.api_key.clone()));
196 if let Some((base_url, api_key)) = inputs {
197 self.watch_model_refresh(&base_url, cx);
198 self.watch_model_refresh(&api_key, cx);
199 }
167 self.page = Page::Agent;
200 self.page = Page::Agent;
201 if profile.is_chat() {
202 self.refresh_models(cx);
203 }
168 cx.notify();
204 cx.notify();
169 }
205 }
170
206
207 fn watch_model_refresh(&mut self, input: &Entity<InputState>, cx: &mut Context<Self>) {
208 self.form_subscriptions
209 .push(cx.subscribe(input, |this, _, event: &InputEvent, cx| {
210 if matches!(event, InputEvent::Blur) {
211 this.commit_agent(cx);
212 this.refresh_models(cx);
213 }
214 }));
215 }
216
171 fn open_action(&mut self, action_id: &str, window: &mut Window, cx: &mut Context<Self>) {
217 fn open_action(&mut self, action_id: &str, window: &mut Window, cx: &mut Context<Self>) {
172 let Some(action) = self
218 let Some(action) = self
173 .runs
219 .runs
@@ -213,6 +259,9 @@ impl AgentsSettings {
213 let command = form.command.read(cx).value().to_string();
259 let command = form.command.read(cx).value().to_string();
214 let open_session = form.open_session.read(cx).value().to_string();
260 let open_session = form.open_session.read(cx).value().to_string();
215 let mcp_flag = form.mcp_flag.read(cx).value().trim().to_owned();
261 let mcp_flag = form.mcp_flag.read(cx).value().trim().to_owned();
262 let base_url = form.base_url.read(cx).value().trim().to_owned();
263 let model = form.model.read(cx).value().trim().to_owned();
264 let typed_key = form.api_key.read(cx).value().trim().to_owned();
216 self.runs.update(cx, |runs, cx| {
265 self.runs.update(cx, |runs, cx| {
217 runs.update_settings(
266 runs.update_settings(
218 |settings| {
267 |settings| {
@@ -221,20 +270,96 @@ impl AgentsSettings {
221 return;
270 return;
222 };
271 };
223 agent.name = name;
272 agent.name = name;
224 agent.command = command;
273 if agent.is_chat() {
225 agent.open_session_command = open_session;
274 match &mut agent.backend {
226 agent.mcp_config_flag = mcp_flag;
275 AgentBackend::OpenAi {
227 if let Environment::Wsl {
276 base_url: url,
228 distro: Some(current),
277 model: current,
229 } = &mut agent.environment
278 api_key,
230 {
279 } => {
231 *current = distro;
280 *url = base_url;
281 *current = model;
282 if !typed_key.is_empty() {
283 *api_key = typed_key;
284 }
285 }
286 AgentBackend::Anthropic {
287 model: current,
288 api_key,
289 } => {
290 *current = model;
291 if !typed_key.is_empty() {
292 *api_key = typed_key;
293 }
294 }
295 AgentBackend::Command => {}
296 }
297 } else {
298 agent.command = command;
299 agent.open_session_command = open_session;
300 agent.mcp_config_flag = mcp_flag;
301 if let Environment::Wsl {
302 distro: Some(current),
303 } = &mut agent.environment
304 {
305 *current = distro;
306 }
232 }
307 }
233 },
308 },
234 cx,
309 cx,
235 )
310 )
236 });
311 });
237 self.probe = Probe::Idle;
312 }
313
314 pub(super) fn set_model(&mut self, model: String, window: &mut Window, cx: &mut Context<Self>) {
315 let Some(form) = &self.agent_form else {
316 return;
317 };
318 form.model
319 .update(cx, |input, cx| input.set_value(model, window, cx));
320 self.commit_agent(cx);
321 }
322
323 pub(super) fn refresh_models(&mut self, cx: &mut Context<Self>) {
324 let Some(profile) = self.current_agent(cx) else {
325 return;
326 };
327 if !profile.is_chat() {
328 return;
329 }
330 self.models_request += 1;
331 let ticket = self.models_request;
332 self.probe = Probe::Running;
333 cx.notify();
334 let receiver = runtime::spawn(async move { agents::list_models(&profile).await });
335 cx.spawn(async move |this, cx| {
336 let result = receiver
337 .await
338 .unwrap_or_else(|_| Err("cancelled".to_owned()));
339 this.update(cx, |this, cx| {
340 if this.models_request != ticket {
341 return;
342 }
343 match result {
344 Ok(names) => {
345 let count = names.len();
346 this.models = names;
347 this.probe = Probe::Found(if count == 1 {
348 "1 model".to_owned()
349 } else {
350 format!("{count} models")
351 });
352 }
353 Err(error) => {
354 this.models.clear();
355 this.probe = Probe::Missing(error);
356 }
357 }
358 cx.notify();
359 })
360 .ok();
361 })
362 .detach();
238 }
363 }
239
364
240 pub(super) fn commit_action(&mut self, cx: &mut Context<Self>) {
365 pub(super) fn commit_action(&mut self, cx: &mut Context<Self>) {
@@ -319,6 +444,18 @@ impl AgentsSettings {
319 self.update_action(cx, move |action| action.agent_id = agent_id);
444 self.update_action(cx, move |action| action.agent_id = agent_id);
320 }
445 }
321
446
447 pub(super) fn set_write_with(&mut self, agent_id: String, cx: &mut Context<Self>) {
448 self.runs.update(cx, |runs, cx| {
449 runs.update_settings(|settings| settings.write_with = agent_id, cx)
450 });
451 }
452
453 pub(super) fn rescan(&mut self, cx: &mut Context<Self>) {
454 self.found = agents::scan_clis();
455 self.scanned = true;
456 cx.notify();
457 }
458
322 pub(super) fn set_resume_interrupted_runs(&mut self, resume: bool, cx: &mut Context<Self>) {
459 pub(super) fn set_resume_interrupted_runs(&mut self, resume: bool, cx: &mut Context<Self>) {
323 self.runs.update(cx, |runs, cx| {
460 self.runs.update(cx, |runs, cx| {
324 runs.update_settings(|settings| settings.resume_interrupted_runs = resume, cx)
461 runs.update_settings(|settings| settings.resume_interrupted_runs = resume, cx)
@@ -393,6 +530,10 @@ impl AgentsSettings {
393 let Some(profile) = self.current_agent(cx) else {
530 let Some(profile) = self.current_agent(cx) else {
394 return;
531 return;
395 };
532 };
533 if profile.is_chat() {
534 self.refresh_models(cx);
535 return;
536 }
396 if profile.command.trim().is_empty() {
537 if profile.command.trim().is_empty() {
397 self.probe = Probe::Missing("The command is empty".to_owned());
538 self.probe = Probe::Missing("The command is empty".to_owned());
398 cx.notify();
539 cx.notify();
@@ -443,8 +584,30 @@ impl AgentsSettings {
443 existing.iter().any(|id| id == candidate)
584 existing.iter().any(|id| id == candidate)
444 });
585 });
445 let id = profile.id.clone();
586 let id = profile.id.clone();
587 let chat = profile.is_chat();
588 let mut action = AgentAction::answer_this(&id);
589 action.extra_args.clear();
590 let mut args = std::collections::HashMap::new();
591 args.insert("name".to_owned(), profile.name.clone());
592 action.label = tr_args("agents.settings.answer_with", &args);
593 action.id = unique_id(&format!("answer-{id}"), |candidate| {
594 self.runs
595 .read(cx)
596 .settings()
597 .actions
598 .iter()
599 .any(|action| action.id == candidate)
600 });
446 self.runs.update(cx, |runs, cx| {
601 self.runs.update(cx, |runs, cx| {
447 runs.update_settings(|settings| settings.agents.push(profile), cx)
602 runs.update_settings(
603 |settings| {
604 settings.agents.push(profile);
605 if chat {
606 settings.actions.push(action);
607 }
608 },
609 cx,
610 )
448 });
611 });
449 self.open_agent(&id, window, cx);
612 self.open_agent(&id, window, cx);
450 }
613 }
@@ -457,7 +620,7 @@ impl AgentsSettings {
457 .map(|agent| agent.id.clone())
620 .map(|agent| agent.id.clone())
458 .unwrap_or_default();
621 .unwrap_or_default();
459 let mut action = AgentAction::answer_this(&agent_id);
622 let mut action = AgentAction::answer_this(&agent_id);
460 action.label = "New action".to_owned();
623 action.label = tr("agents.settings.new_action");
461 action.id = unique_id("action", |candidate| {
624 action.id = unique_id("action", |candidate| {
462 settings.actions.iter().any(|action| action.id == candidate)
625 settings.actions.iter().any(|action| action.id == candidate)
463 });
626 });
@@ -482,26 +645,83 @@ impl AgentsSettings {
482
645
483type Preset = (&'static str, fn() -> AgentProfile);
646type Preset = (&'static str, fn() -> AgentProfile);
484
647
485fn agent_presets() -> [Preset; 4] {
648fn agent_presets() -> [Preset; 9] {
486 fn custom() -> AgentProfile {
649 fn custom() -> AgentProfile {
487 AgentProfile {
650 AgentProfile {
488 id: "custom".to_owned(),
651 id: "custom".to_owned(),
489 name: "Custom agent".to_owned(),
652 name: tr("agents.settings.custom_agent"),
490 environment: Environment::Host,
653 environment: Environment::Host,
491 command: String::new(),
492 output: OutputFormat::Text,
654 output: OutputFormat::Text,
493 open_session_command: String::new(),
655 ..AgentProfile::default()
494 mcp_config_flag: String::new(),
495 }
656 }
496 }
657 }
497 [
658 [
498 ("Claude Code (WSL)", AgentProfile::claude_wsl),
659 (
660 "Claude Code (WSL)",
661 AgentProfile::claude_wsl as fn() -> AgentProfile,
662 ),
499 ("Claude Code (Windows)", AgentProfile::claude_host),
663 ("Claude Code (Windows)", AgentProfile::claude_host),
500 ("Copilot CLI (WSL)", AgentProfile::copilot_wsl),
664 ("Copilot CLI (WSL)", AgentProfile::copilot_wsl),
665 ("Ollama", AgentProfile::ollama),
666 ("OpenAI", AgentProfile::openai),
667 ("OpenRouter", AgentProfile::openrouter),
668 ("Anthropic", AgentProfile::anthropic),
669 ("OpenAI-compatible", AgentProfile::openai_compatible),
501 ("Custom", custom),
670 ("Custom", custom),
502 ]
671 ]
503}
672}
504
673
674fn write_with_label(settings: &agents::AgentSettings) -> String {
675 if settings.write_with.is_empty() {
676 return "Microsoft Copilot".to_owned();
677 }
678 settings
679 .agents
680 .iter()
681 .find(|agent| agent.id == settings.write_with && agent.is_chat())
682 .map(|agent| agent.name.clone())
683 .unwrap_or_else(|| "Microsoft Copilot".to_owned())
684}
685
686fn write_with_entries(
687 settings: &agents::AgentSettings,
688 this: &Entity<AgentsSettings>,
689) -> Vec<MenuEntry> {
690 let mut entries = vec![write_with_entry(
691 this,
692 "Microsoft Copilot",
693 "",
694 settings.write_with.is_empty(),
695 )];
696 for agent in settings.agents.iter().filter(|agent| agent.is_chat()) {
697 entries.push(write_with_entry(
698 this,
699 &agent.name,
700 &agent.id,
701 settings.write_with == agent.id,
702 ));
703 }
704 entries
705}
706
707fn write_with_entry(
708 this: &Entity<AgentsSettings>,
709 label: &str,
710 agent_id: &str,
711 selected: bool,
712) -> MenuEntry {
713 let (this, agent_id) = (this.clone(), agent_id.to_owned());
714 let choose: Choice = std::rc::Rc::new(move |_, cx| {
715 let agent_id = agent_id.clone();
716 this.update(cx, |this, cx| this.set_write_with(agent_id, cx))
717 });
718 MenuEntry {
719 label: label.to_owned(),
720 selected,
721 choose,
722 }
723}
724
505fn list_row(
725fn list_row(
506 id: (&'static str, usize),
726 id: (&'static str, usize),
507 leading: Option<AnyElement>,
727 leading: Option<AnyElement>,
@@ -568,7 +788,17 @@ fn small_button(id: (&'static str, usize), name: IconName, enabled: bool) -> Sta
568
788
569impl AgentsSettings {
789impl AgentsSettings {
570 fn list_page(&mut self, cx: &mut Context<Self>) -> Div {
790 fn list_page(&mut self, cx: &mut Context<Self>) -> Div {
791 if !self.scanned {
792 self.found = agents::scan_clis();
793 self.scanned = true;
794 }
571 let settings = self.runs.read(cx).settings().clone();
795 let settings = self.runs.read(cx).settings().clone();
796 let found: Vec<agents::CliHit> = self
797 .found
798 .iter()
799 .filter(|hit| !agents::already_installed(&settings.agents, &hit.profile))
800 .cloned()
801 .collect();
572 let this = cx.entity();
802 let this = cx.entity();
573 let preset_entries: Vec<MenuEntry> = agent_presets()
803 let preset_entries: Vec<MenuEntry> = agent_presets()
574 .into_iter()
804 .into_iter()
@@ -611,8 +841,12 @@ impl AgentsSettings {
611 .into_any_element(),
841 .into_any_element(),
612 ),
842 ),
613 agent.name.clone(),
843 agent.name.clone(),
614 environment_label(&agent.environment),
844 if agent.is_chat() {
615 Some(agent.command.clone()),
845 agent.backend_label()
846 } else {
847 environment_label(&agent.environment)
848 },
849 agent.is_command().then(|| agent.command.clone()),
616 )
850 )
617 .on_click(move |_, window, cx| {
851 .on_click(move |_, window, cx| {
618 open.update(cx, |this, cx| this.open_agent(&id, window, cx))
852 open.update(cx, |this, cx| this.open_agent(&id, window, cx))
@@ -625,7 +859,8 @@ impl AgentsSettings {
625 .agents
859 .agents
626 .iter()
860 .iter()
627 .find(|agent| agent.id == action.agent_id)
861 .find(|agent| agent.id == action.agent_id)
628 .map_or("Unknown agent", |agent| agent.name.as_str());
862 .map(|agent| agent.name.clone())
863 .unwrap_or_else(|| tr("agents.settings.unknown_agent"));
629 list_row(
864 list_row(
630 ("action-row", index),
865 ("action-row", index),
631 None,
866 None,
@@ -660,18 +895,86 @@ impl AgentsSettings {
660 ),
895 ),
661 )
896 )
662 });
897 });
898 let write_entries = write_with_entries(&settings, &this);
899 let write_label = write_with_label(&settings);
900 let rescan = this.clone();
901 let found_rows = found.iter().enumerate().map(|(index, hit)| {
902 let (this, profile) = (this.clone(), hit.profile.clone());
903 list_row(
904 ("found-cli", index),
905 None,
906 hit.profile.name.clone(),
907 hit.binary.display().to_string(),
908 Some(hit.profile.command.clone()),
909 )
910 .child(
911 Button::new(("add-found", index))
912 .link()
913 .label(tr("common.add"))
914 .on_click(move |_, window, cx| {
915 let profile = profile.clone();
916 this.update(cx, |this, cx| this.add_agent(profile, window, cx))
917 }),
918 )
919 });
920 let on_computer = tr("agents.settings.on_this_computer");
921 let agents_header = tr("agents.settings.agents_header");
922 let actions_header = tr("agents.settings.actions_header");
663 v_flex()
923 v_flex()
664 .w_full()
924 .w_full()
665 .child(section_header(
925 .child(section_header(
666 "AGENTS",
926 on_computer.clone(),
927 Some(
928 Button::new("rescan-clis")
929 .link()
930 .label(tr("agents.settings.scan_again"))
931 .on_click(move |_, _, cx| rescan.update(cx, |this, cx| this.rescan(cx)))
932 .into_any_element(),
933 ),
934 ))
935 .child(v_flex().w_full().px(px(8.)).children(found_rows).when(
936 found.is_empty(),
937 |rows| {
938 rows.child(
939 div()
940 .px(px(12.))
941 .py(px(8.))
942 .text_size(px(12.))
943 .text_color(theme::text_muted())
944 .child(tr("agents.settings.no_cli_found")),
945 )
946 },
947 ))
948 .child(section_header(
949 agents_header.clone(),
667 Some(link_dropdown("add-agent", "+ Add agent", preset_entries).into_any_element()),
950 Some(link_dropdown("add-agent", "+ Add agent", preset_entries).into_any_element()),
668 ))
951 ))
669 .child(v_flex().w_full().px(px(8.)).children(agent_rows))
952 .child(v_flex().w_full().px(px(8.)).children(agent_rows))
670 .child(section_header(
953 .child(section_header(
671 "ACTIONS - IN THIS ORDER IN THE MENU",
954 actions_header,
672 Some(add_action.into_any_element()),
955 Some(add_action.into_any_element()),
673 ))
956 ))
674 .child(v_flex().w_full().px(px(8.)).children(action_rows))
957 .child(v_flex().w_full().px(px(8.)).children(action_rows))
958 .child(
959 v_flex()
960 .w_full()
961 .px(px(PAGE_PADDING))
962 .pt(px(16.))
963 .gap(px(6.))
964 .child(
965 div()
966 .text_size(px(14.))
967 .font_weight(FontWeight::SEMIBOLD)
968 .child(tr("agents.settings.write_with")),
969 )
970 .child(
971 div()
972 .text_size(px(12.))
973 .text_color(theme::text_muted())
974 .child(tr("agents.settings.rewrite_hint")),
975 )
976 .child(dropdown("write-with", write_label, write_entries)),
977 )
675 .child(resume_toggle(settings.resume_interrupted_runs, this))
978 .child(resume_toggle(settings.resume_interrupted_runs, this))
676 .child(
979 .child(
677 div()
980 div()
@@ -682,7 +985,7 @@ impl AgentsSettings {
682 .text_size(px(12.))
985 .text_size(px(12.))
683 .line_height(relative(1.5))
986 .line_height(relative(1.5))
684 .text_color(theme::text_faint())
987 .text_color(theme::text_faint())
685 .child(NOTE),
988 .child(tr("agents.settings.note")),
686 )
989 )
687 }
990 }
688}
991}
crates/app/src/agents/start_dialog.rs +27 −19
@@ -20,6 +20,7 @@ use super::{
20 20 mcp_bridge, message_context, raise_notice, runs_handle, start_run, start_run_when_mcp_ready,
21 21 };
22 22 use crate::app_state::AppState;
23 use crate::i18n::tr;
23 24 use crate::theme::{self, ElevatedSurface as _};
24 25 use crate::views::widgets::{icon, symbol};
25 26
@@ -37,7 +38,6 @@ const FIELD_MAX_ROWS: usize = 6;
37 38 const PROMPT_SIZE: f32 = 12.;
38 39 const DISABLED_OPACITY: f32 = 0.5;
39 40 const DEFAULT_PLACEHOLDER: &str = "e.g. only the backend, open a PR when done";
40 const SESSION_PLACEHOLDER: &str = "Type the message to send";
41 41
42 42 pub enum StartDialogEvent {
43 43 Close,
@@ -58,6 +58,7 @@ pub struct StartDialog {
58 58 working_dir: String,
59 59 recent_working_dirs: Vec<String>,
60 60 offers_sessions: bool,
61 asks_for_directory: bool,
61 62 scans_external: bool,
62 63 run_sessions: Vec<SessionOption>,
63 64 external_sessions: Vec<SessionOption>,
@@ -108,6 +109,7 @@ impl StartDialog {
108 109 })
109 110 .unwrap_or_default();
110 111 let offers_sessions = profile.as_ref().is_some_and(agents::supports_resume);
112 let asks_for_directory = profile.as_ref().is_none_or(|profile| profile.is_command());
111 113 let run_sessions = match runs {
112 114 Some(runs) if offers_sessions => {
113 115 run_options(&runs.for_agent(&action.agent_id), app.read(cx), Utc::now())
@@ -131,6 +133,7 @@ impl StartDialog {
131 133 working_dir: action.working_dir.clone(),
132 134 recent_working_dirs,
133 135 offers_sessions,
136 asks_for_directory,
134 137 scans_external: profile
135 138 .is_some_and(|profile| profile.output == agents::OutputFormat::ClaudeStreamJson)
136 139 && offers_sessions,
@@ -180,9 +183,9 @@ impl StartDialog {
180 183 cx: &mut Context<Self>,
181 184 ) {
182 185 let placeholder = if session.is_some() {
183 SESSION_PLACEHOLDER
186 tr("agents.start.message_placeholder")
184 187 } else {
185 DEFAULT_PLACEHOLDER
188 DEFAULT_PLACEHOLDER.to_owned()
186 189 };
187 190 self.input.update(cx, |input, cx| {
188 191 input.set_placeholder(placeholder, window, cx)
@@ -388,7 +391,7 @@ impl StartDialog {
388 391 };
389 392 let new_dialog = dialog.clone();
390 393 let mut parts = vec![MenuPart::Row(MenuRow {
391 label: "New session".to_owned(),
394 label: tr("agents.start.new_session"),
392 395 meta: None,
393 396 running: false,
394 397 selected: self.selected_session.is_none(),
@@ -398,12 +401,12 @@ impl StartDialog {
398 401 })];
399 402 if !self.run_sessions.is_empty() {
400 403 parts.push(MenuPart::Separator);
401 parts.push(MenuPart::Header("Recent sessions".to_owned()));
404 parts.push(MenuPart::Header(tr("agents.start.recent_sessions")));
402 405 parts.extend(self.run_sessions.iter().map(row));
403 406 }
404 407 if !self.external_sessions.is_empty() {
405 408 parts.push(MenuPart::Separator);
406 parts.push(MenuPart::Header("Other sessions".to_owned()));
409 parts.push(MenuPart::Header(tr("agents.start.other_sessions")));
407 410 parts.extend(self.external_sessions.iter().map(row));
408 411 }
409 412 parts
@@ -426,7 +429,7 @@ impl StartDialog {
426 429 };
427 430 let browse_dialog = dialog.clone();
428 431 let mut parts = vec![
429 MenuPart::Header("Recent".to_owned()),
432 MenuPart::Header(tr("agents.start.recent")),
430 433 row(&self.default_working_dir, Some("action default")),
431 434 ];
432 435 parts.extend(
@@ -437,7 +440,7 @@ impl StartDialog {
437 440 );
438 441 parts.push(MenuPart::Separator);
439 442 parts.push(MenuPart::Row(MenuRow {
440 label: "Browse...".to_owned(),
443 label: tr("agents.start.browse"),
441 444 meta: None,
442 445 running: false,
443 446 selected: false,
@@ -457,10 +460,10 @@ impl StartDialog {
457 460 Some(session.meta.clone()),
458 461 session.running,
459 462 ),
460 None => ("New session".to_owned(), None, false),
463 None => (tr("agents.start.new_session"), None, false),
461 464 };
462 465 picker_row(
463 "Session",
466 tr("agents.start.session"),
464 467 select(
465 468 "agent-dialog-session",
466 469 value,
@@ -487,7 +490,12 @@ impl StartDialog {
487 490 .w_full()
488 491 .gap(px(8.))
489 492 .children(session_row)
490 .child(picker_row("Working dir", working_dir_control))
493 .when(self.asks_for_directory, |rows| {
494 rows.child(picker_row(
495 tr("agents.start.working_dir"),
496 working_dir_control,
497 ))
498 })
491 499 }
492 500
493 501 fn field(&self, window: &Window, cx: &App) -> Div {
@@ -501,9 +509,9 @@ impl StartDialog {
501 509 .font_weight(FontWeight::SEMIBOLD)
502 510 .text_color(theme::text_faint())
503 511 .child(if self.selected_session.is_some() {
504 "Message to the session"
512 tr("agents.start.message_to_session")
505 513 } else {
506 "Extra instructions (optional)"
514 tr("agents.start.extra_instructions")
507 515 }),
508 516 )
509 517 .child(
@@ -541,7 +549,7 @@ impl StartDialog {
541 549 12.,
542 550 theme::text_muted(),
543 551 ))
544 .child("Show prompt")
552 .child(tr("agents.start.show_prompt"))
545 553 .on_click(cx.listener(|this, _, _, cx| {
546 554 this.show_prompt = !this.show_prompt;
547 555 cx.notify();
@@ -581,11 +589,11 @@ impl StartDialog {
581 589 let blocked =
582 590 self.selected_session.is_some() && self.input.read(cx).value().trim().is_empty();
583 591 let start_label = if self.selected_session.is_some() {
584 "Send"
592 tr("agents.start.send")
585 593 } else if self.needs_allow {
586 "Allow and start"
594 tr("agents.start.allow_and_start")
587 595 } else {
588 "Start"
596 tr("agents.start.start")
589 597 };
590 598 h_flex()
591 599 .w_full()
@@ -604,7 +612,7 @@ impl StartDialog {
604 612 .bg(theme::surface_raised())
605 613 .hover(|button| button.bg(theme::popup_hover()))
606 614 .text_size(px(13.))
607 .child("Cancel")
615 .child(tr("common.cancel"))
608 616 .on_click(cx.listener(|_, _, _, cx| cx.emit(StartDialogEvent::Close))),
609 617 )
610 618 .child(
@@ -673,7 +681,7 @@ impl Render for StartDialog {
673 681 div()
674 682 .text_size(px(12.))
675 683 .text_color(theme::text_soft())
676 .child("Agents can't see this chat yet."),
684 .child(tr("agents.start.chat_invisible")),
677 685 )
678 686 })
679 687 .child(self.pickers(cx))
@@ -20,6 +20,7 @@ use super::{
20 mcp_bridge, message_context, raise_notice, runs_handle, start_run, start_run_when_mcp_ready,
20 mcp_bridge, message_context, raise_notice, runs_handle, start_run, start_run_when_mcp_ready,
21};
21};
22use crate::app_state::AppState;
22use crate::app_state::AppState;
23use crate::i18n::tr;
23use crate::theme::{self, ElevatedSurface as _};
24use crate::theme::{self, ElevatedSurface as _};
24use crate::views::widgets::{icon, symbol};
25use crate::views::widgets::{icon, symbol};
25
26
@@ -37,7 +38,6 @@ const FIELD_MAX_ROWS: usize = 6;
37const PROMPT_SIZE: f32 = 12.;
38const PROMPT_SIZE: f32 = 12.;
38const DISABLED_OPACITY: f32 = 0.5;
39const DISABLED_OPACITY: f32 = 0.5;
39const DEFAULT_PLACEHOLDER: &str = "e.g. only the backend, open a PR when done";
40const DEFAULT_PLACEHOLDER: &str = "e.g. only the backend, open a PR when done";
40const SESSION_PLACEHOLDER: &str = "Type the message to send";
41
41
42pub enum StartDialogEvent {
42pub enum StartDialogEvent {
43 Close,
43 Close,
@@ -58,6 +58,7 @@ pub struct StartDialog {
58 working_dir: String,
58 working_dir: String,
59 recent_working_dirs: Vec<String>,
59 recent_working_dirs: Vec<String>,
60 offers_sessions: bool,
60 offers_sessions: bool,
61 asks_for_directory: bool,
61 scans_external: bool,
62 scans_external: bool,
62 run_sessions: Vec<SessionOption>,
63 run_sessions: Vec<SessionOption>,
63 external_sessions: Vec<SessionOption>,
64 external_sessions: Vec<SessionOption>,
@@ -108,6 +109,7 @@ impl StartDialog {
108 })
109 })
109 .unwrap_or_default();
110 .unwrap_or_default();
110 let offers_sessions = profile.as_ref().is_some_and(agents::supports_resume);
111 let offers_sessions = profile.as_ref().is_some_and(agents::supports_resume);
112 let asks_for_directory = profile.as_ref().is_none_or(|profile| profile.is_command());
111 let run_sessions = match runs {
113 let run_sessions = match runs {
112 Some(runs) if offers_sessions => {
114 Some(runs) if offers_sessions => {
113 run_options(&runs.for_agent(&action.agent_id), app.read(cx), Utc::now())
115 run_options(&runs.for_agent(&action.agent_id), app.read(cx), Utc::now())
@@ -131,6 +133,7 @@ impl StartDialog {
131 working_dir: action.working_dir.clone(),
133 working_dir: action.working_dir.clone(),
132 recent_working_dirs,
134 recent_working_dirs,
133 offers_sessions,
135 offers_sessions,
136 asks_for_directory,
134 scans_external: profile
137 scans_external: profile
135 .is_some_and(|profile| profile.output == agents::OutputFormat::ClaudeStreamJson)
138 .is_some_and(|profile| profile.output == agents::OutputFormat::ClaudeStreamJson)
136 && offers_sessions,
139 && offers_sessions,
@@ -180,9 +183,9 @@ impl StartDialog {
180 cx: &mut Context<Self>,
183 cx: &mut Context<Self>,
181 ) {
184 ) {
182 let placeholder = if session.is_some() {
185 let placeholder = if session.is_some() {
183 SESSION_PLACEHOLDER
186 tr("agents.start.message_placeholder")
184 } else {
187 } else {
185 DEFAULT_PLACEHOLDER
188 DEFAULT_PLACEHOLDER.to_owned()
186 };
189 };
187 self.input.update(cx, |input, cx| {
190 self.input.update(cx, |input, cx| {
188 input.set_placeholder(placeholder, window, cx)
191 input.set_placeholder(placeholder, window, cx)
@@ -388,7 +391,7 @@ impl StartDialog {
388 };
391 };
389 let new_dialog = dialog.clone();
392 let new_dialog = dialog.clone();
390 let mut parts = vec![MenuPart::Row(MenuRow {
393 let mut parts = vec![MenuPart::Row(MenuRow {
391 label: "New session".to_owned(),
394 label: tr("agents.start.new_session"),
392 meta: None,
395 meta: None,
393 running: false,
396 running: false,
394 selected: self.selected_session.is_none(),
397 selected: self.selected_session.is_none(),
@@ -398,12 +401,12 @@ impl StartDialog {
398 })];
401 })];
399 if !self.run_sessions.is_empty() {
402 if !self.run_sessions.is_empty() {
400 parts.push(MenuPart::Separator);
403 parts.push(MenuPart::Separator);
401 parts.push(MenuPart::Header("Recent sessions".to_owned()));
404 parts.push(MenuPart::Header(tr("agents.start.recent_sessions")));
402 parts.extend(self.run_sessions.iter().map(row));
405 parts.extend(self.run_sessions.iter().map(row));
403 }
406 }
404 if !self.external_sessions.is_empty() {
407 if !self.external_sessions.is_empty() {
405 parts.push(MenuPart::Separator);
408 parts.push(MenuPart::Separator);
406 parts.push(MenuPart::Header("Other sessions".to_owned()));
409 parts.push(MenuPart::Header(tr("agents.start.other_sessions")));
407 parts.extend(self.external_sessions.iter().map(row));
410 parts.extend(self.external_sessions.iter().map(row));
408 }
411 }
409 parts
412 parts
@@ -426,7 +429,7 @@ impl StartDialog {
426 };
429 };
427 let browse_dialog = dialog.clone();
430 let browse_dialog = dialog.clone();
428 let mut parts = vec![
431 let mut parts = vec![
429 MenuPart::Header("Recent".to_owned()),
432 MenuPart::Header(tr("agents.start.recent")),
430 row(&self.default_working_dir, Some("action default")),
433 row(&self.default_working_dir, Some("action default")),
431 ];
434 ];
432 parts.extend(
435 parts.extend(
@@ -437,7 +440,7 @@ impl StartDialog {
437 );
440 );
438 parts.push(MenuPart::Separator);
441 parts.push(MenuPart::Separator);
439 parts.push(MenuPart::Row(MenuRow {
442 parts.push(MenuPart::Row(MenuRow {
440 label: "Browse...".to_owned(),
443 label: tr("agents.start.browse"),
441 meta: None,
444 meta: None,
442 running: false,
445 running: false,
443 selected: false,
446 selected: false,
@@ -457,10 +460,10 @@ impl StartDialog {
457 Some(session.meta.clone()),
460 Some(session.meta.clone()),
458 session.running,
461 session.running,
459 ),
462 ),
460 None => ("New session".to_owned(), None, false),
463 None => (tr("agents.start.new_session"), None, false),
461 };
464 };
462 picker_row(
465 picker_row(
463 "Session",
466 tr("agents.start.session"),
464 select(
467 select(
465 "agent-dialog-session",
468 "agent-dialog-session",
466 value,
469 value,
@@ -487,7 +490,12 @@ impl StartDialog {
487 .w_full()
490 .w_full()
488 .gap(px(8.))
491 .gap(px(8.))
489 .children(session_row)
492 .children(session_row)
490 .child(picker_row("Working dir", working_dir_control))
493 .when(self.asks_for_directory, |rows| {
494 rows.child(picker_row(
495 tr("agents.start.working_dir"),
496 working_dir_control,
497 ))
498 })
491 }
499 }
492
500
493 fn field(&self, window: &Window, cx: &App) -> Div {
501 fn field(&self, window: &Window, cx: &App) -> Div {
@@ -501,9 +509,9 @@ impl StartDialog {
501 .font_weight(FontWeight::SEMIBOLD)
509 .font_weight(FontWeight::SEMIBOLD)
502 .text_color(theme::text_faint())
510 .text_color(theme::text_faint())
503 .child(if self.selected_session.is_some() {
511 .child(if self.selected_session.is_some() {
504 "Message to the session"
512 tr("agents.start.message_to_session")
505 } else {
513 } else {
506 "Extra instructions (optional)"
514 tr("agents.start.extra_instructions")
507 }),
515 }),
508 )
516 )
509 .child(
517 .child(
@@ -541,7 +549,7 @@ impl StartDialog {
541 12.,
549 12.,
542 theme::text_muted(),
550 theme::text_muted(),
543 ))
551 ))
544 .child("Show prompt")
552 .child(tr("agents.start.show_prompt"))
545 .on_click(cx.listener(|this, _, _, cx| {
553 .on_click(cx.listener(|this, _, _, cx| {
546 this.show_prompt = !this.show_prompt;
554 this.show_prompt = !this.show_prompt;
547 cx.notify();
555 cx.notify();
@@ -581,11 +589,11 @@ impl StartDialog {
581 let blocked =
589 let blocked =
582 self.selected_session.is_some() && self.input.read(cx).value().trim().is_empty();
590 self.selected_session.is_some() && self.input.read(cx).value().trim().is_empty();
583 let start_label = if self.selected_session.is_some() {
591 let start_label = if self.selected_session.is_some() {
584 "Send"
592 tr("agents.start.send")
585 } else if self.needs_allow {
593 } else if self.needs_allow {
586 "Allow and start"
594 tr("agents.start.allow_and_start")
587 } else {
595 } else {
588 "Start"
596 tr("agents.start.start")
589 };
597 };
590 h_flex()
598 h_flex()
591 .w_full()
599 .w_full()
@@ -604,7 +612,7 @@ impl StartDialog {
604 .bg(theme::surface_raised())
612 .bg(theme::surface_raised())
605 .hover(|button| button.bg(theme::popup_hover()))
613 .hover(|button| button.bg(theme::popup_hover()))
606 .text_size(px(13.))
614 .text_size(px(13.))
607 .child("Cancel")
615 .child(tr("common.cancel"))
608 .on_click(cx.listener(|_, _, _, cx| cx.emit(StartDialogEvent::Close))),
616 .on_click(cx.listener(|_, _, _, cx| cx.emit(StartDialogEvent::Close))),
609 )
617 )
610 .child(
618 .child(
@@ -673,7 +681,7 @@ impl Render for StartDialog {
673 div()
681 div()
674 .text_size(px(12.))
682 .text_size(px(12.))
675 .text_color(theme::text_soft())
683 .text_color(theme::text_soft())
676 .child("Agents can't see this chat yet."),
684 .child(tr("agents.start.chat_invisible")),
677 )
685 )
678 })
686 })
679 .child(self.pickers(cx))
687 .child(self.pickers(cx))
crates/app/src/agents/start_dialog_pickers.rs +1 −1
@@ -34,7 +34,7 @@ pub enum MenuPart {
34 34 Row(MenuRow),
35 35 }
36 36
37 pub fn picker_row(label: &'static str, control: impl IntoElement) -> Div {
37 pub fn picker_row(label: String, control: impl IntoElement) -> Div {
38 38 h_flex()
39 39 .w_full()
40 40 .items_center()
@@ -34,7 +34,7 @@ pub enum MenuPart {
34 Row(MenuRow),
34 Row(MenuRow),
35}
35}
36
36
37pub fn picker_row(label: &'static str, control: impl IntoElement) -> Div {
37pub fn picker_row(label: String, control: impl IntoElement) -> Div {
38 h_flex()
38 h_flex()
39 .w_full()
39 .w_full()
40 .items_center()
40 .items_center()
crates/app/src/i18n.rs added +73 −0
@@ -0,0 +1,73 @@
1 pub use app_base::ui_locale::{tr, tr_args};
2
3 #[cfg(test)]
4 mod tests {
5 use std::sync::{Mutex, MutexGuard};
6
7 use app_base::ui_locale::{apply_locale, tr};
8
9 fn locale_test_lock() -> MutexGuard<'static, ()> {
10 static LOCK: Mutex<()> = Mutex::new(());
11 LOCK.lock().unwrap_or_else(|error| error.into_inner())
12 }
13
14 #[test]
15 fn ui_locale_settings_common_actions() {
16 let _guard = locale_test_lock();
17 apply_locale("de");
18 assert_eq!(tr("common.cancel"), "Abbrechen");
19 apply_locale("en");
20 assert_eq!(tr("settings.nav.general"), "General");
21 }
22
23 #[test]
24 fn ui_locale_chrome_rail_and_nav_keys() {
25 let _guard = locale_test_lock();
26 apply_locale("en");
27 assert_eq!(tr("rail.activity"), "Activity");
28 assert_eq!(tr("rail.chat"), "Chat");
29 assert_eq!(
30 tr("settings.nav.notifications"),
31 "Notifications and activity"
32 );
33 apply_locale("de");
34 assert_eq!(tr("rail.calendar"), "Kalender");
35 assert_eq!(tr("common.save"), "Speichern");
36 }
37
38 #[test]
39 fn ui_locale_calls_page_keys_resolve_in_de() {
40 let _guard = locale_test_lock();
41 apply_locale("de");
42 assert_eq!(tr("calls.page.title"), "Anrufe");
43 assert_eq!(tr("auth.sign_in"), "Anmelden");
44 }
45
46 #[test]
47 fn ui_locale_chat_sidebar_and_filters_in_de() {
48 let _guard = locale_test_lock();
49 apply_locale("de");
50 assert_eq!(tr("sidebar.pinned"), "Angepinnt");
51 assert_eq!(tr("sidebar.filter.no_matches"), "Keine Treffer gefunden.");
52 assert_eq!(tr("sidebar.pill.meetings"), "Besprechungschats");
53 }
54
55 #[test]
56 fn ui_locale_call_chrome_in_de() {
57 let _guard = locale_test_lock();
58 apply_locale("de");
59 assert_eq!(tr("calls.chrome.stop_sharing"), "Freigabe beenden");
60 assert_eq!(tr("calls.prejoin.join_now"), "Jetzt beitreten");
61 }
62
63 #[test]
64 fn ui_locale_calendar_meeting_dialog_in_de() {
65 let _guard = locale_test_lock();
66 apply_locale("de");
67 assert_eq!(tr("calls.meeting.new_title"), "Neue Besprechung");
68 assert_eq!(
69 tr("calls.meeting.teams_link_added"),
70 "Teams-Besprechungslink wird hinzugefügt"
71 );
72 }
73 }
@@ -0,0 +1,73 @@
1pub use app_base::ui_locale::{tr, tr_args};
2
3#[cfg(test)]
4mod tests {
5 use std::sync::{Mutex, MutexGuard};
6
7 use app_base::ui_locale::{apply_locale, tr};
8
9 fn locale_test_lock() -> MutexGuard<'static, ()> {
10 static LOCK: Mutex<()> = Mutex::new(());
11 LOCK.lock().unwrap_or_else(|error| error.into_inner())
12 }
13
14 #[test]
15 fn ui_locale_settings_common_actions() {
16 let _guard = locale_test_lock();
17 apply_locale("de");
18 assert_eq!(tr("common.cancel"), "Abbrechen");
19 apply_locale("en");
20 assert_eq!(tr("settings.nav.general"), "General");
21 }
22
23 #[test]
24 fn ui_locale_chrome_rail_and_nav_keys() {
25 let _guard = locale_test_lock();
26 apply_locale("en");
27 assert_eq!(tr("rail.activity"), "Activity");
28 assert_eq!(tr("rail.chat"), "Chat");
29 assert_eq!(
30 tr("settings.nav.notifications"),
31 "Notifications and activity"
32 );
33 apply_locale("de");
34 assert_eq!(tr("rail.calendar"), "Kalender");
35 assert_eq!(tr("common.save"), "Speichern");
36 }
37
38 #[test]
39 fn ui_locale_calls_page_keys_resolve_in_de() {
40 let _guard = locale_test_lock();
41 apply_locale("de");
42 assert_eq!(tr("calls.page.title"), "Anrufe");
43 assert_eq!(tr("auth.sign_in"), "Anmelden");
44 }
45
46 #[test]
47 fn ui_locale_chat_sidebar_and_filters_in_de() {
48 let _guard = locale_test_lock();
49 apply_locale("de");
50 assert_eq!(tr("sidebar.pinned"), "Angepinnt");
51 assert_eq!(tr("sidebar.filter.no_matches"), "Keine Treffer gefunden.");
52 assert_eq!(tr("sidebar.pill.meetings"), "Besprechungschats");
53 }
54
55 #[test]
56 fn ui_locale_call_chrome_in_de() {
57 let _guard = locale_test_lock();
58 apply_locale("de");
59 assert_eq!(tr("calls.chrome.stop_sharing"), "Freigabe beenden");
60 assert_eq!(tr("calls.prejoin.join_now"), "Jetzt beitreten");
61 }
62
63 #[test]
64 fn ui_locale_calendar_meeting_dialog_in_de() {
65 let _guard = locale_test_lock();
66 apply_locale("de");
67 assert_eq!(tr("calls.meeting.new_title"), "Neue Besprechung");
68 assert_eq!(
69 tr("calls.meeting.teams_link_added"),
70 "Teams-Besprechungslink wird hinzugefügt"
71 );
72 }
73}
crates/app/src/layout_guard.rs +10 −10
@@ -322,7 +322,6 @@ mod frames {
322 322 const SETTINGS_TAGS: &[&str] = &[
323 323 "settings",
324 324 "settings/nav",
325 "settings/nav/divider",
326 325 "settings/nav/about",
327 326 "settings/main",
328 327 "settings/main/header",
@@ -364,12 +363,13 @@ mod frames {
364 363 SettingsSection::Agents,
365 364 "Agents pages carry their own PAGE_PADDING side inset, the body narrows its side padding to keep the text edge",
366 365 )];
367 const SETTINGS_SECTIONS: [SettingsSection; 9] = [
366 const SETTINGS_SECTIONS: [SettingsSection; 10] = [
368 367 SettingsSection::General,
369 368 SettingsSection::Notifications,
370 369 SettingsSection::Appearance,
371 370 SettingsSection::Chats,
372 371 SettingsSection::Calls,
372 SettingsSection::Calendar,
373 373 SettingsSection::Devices,
374 374 SettingsSection::Agents,
375 375 SettingsSection::Mcp,
@@ -1535,15 +1535,15 @@ mod frames {
1535 1535 }
1536 1536 }
1537 1537
1538 // Not a platform assertion: on macOS the camera effects worker schedules onto
1539 // the deterministic test scheduler while this dialog is open.
1540 #[cfg_attr(
1541 target_os = "macos",
1542 ignore = "camera effects thread trips the test scheduler"
1543 )]
1538 // Devices opens a camera preview; the effects worker schedules onto the
1539 // deterministic test scheduler and trips "Your test is not deterministic".
1544 1540 #[gpui_kit::test]
1545 1541 fn settings_dialog_keeps_its_inset_at_every_size(cx: &mut TestAppContext) {
1546 check_settings_dialog(cx, &SETTINGS_SECTIONS);
1542 let sections: Vec<_> = SETTINGS_SECTIONS
1543 .into_iter()
1544 .filter(|section| *section != SettingsSection::Devices)
1545 .collect();
1546 check_settings_dialog(cx, &sections);
1547 1547 }
1548 1548
1549 1549 #[gpui_kit::test]
@@ -1640,7 +1640,7 @@ mod frames {
1640 1640 f32::from(
1641 1641 window
1642 1642 .text_system()
1643 .shape_line(text.into(), px(NAV_LABEL_SIZE), &[run], None)
1643 .shape_line(text.clone().into(), px(NAV_LABEL_SIZE), &[run], None)
1644 1644 .width,
1645 1645 )
1646 1646 });
@@ -322,7 +322,6 @@ mod frames {
322 const SETTINGS_TAGS: &[&str] = &[
322 const SETTINGS_TAGS: &[&str] = &[
323 "settings",
323 "settings",
324 "settings/nav",
324 "settings/nav",
325 "settings/nav/divider",
326 "settings/nav/about",
325 "settings/nav/about",
327 "settings/main",
326 "settings/main",
328 "settings/main/header",
327 "settings/main/header",
@@ -364,12 +363,13 @@ mod frames {
364 SettingsSection::Agents,
363 SettingsSection::Agents,
365 "Agents pages carry their own PAGE_PADDING side inset, the body narrows its side padding to keep the text edge",
364 "Agents pages carry their own PAGE_PADDING side inset, the body narrows its side padding to keep the text edge",
366 )];
365 )];
367 const SETTINGS_SECTIONS: [SettingsSection; 9] = [
366 const SETTINGS_SECTIONS: [SettingsSection; 10] = [
368 SettingsSection::General,
367 SettingsSection::General,
369 SettingsSection::Notifications,
368 SettingsSection::Notifications,
370 SettingsSection::Appearance,
369 SettingsSection::Appearance,
371 SettingsSection::Chats,
370 SettingsSection::Chats,
372 SettingsSection::Calls,
371 SettingsSection::Calls,
372 SettingsSection::Calendar,
373 SettingsSection::Devices,
373 SettingsSection::Devices,
374 SettingsSection::Agents,
374 SettingsSection::Agents,
375 SettingsSection::Mcp,
375 SettingsSection::Mcp,
@@ -1535,15 +1535,15 @@ mod frames {
1535 }
1535 }
1536 }
1536 }
1537
1537
1538 // Not a platform assertion: on macOS the camera effects worker schedules onto
1538 // Devices opens a camera preview; the effects worker schedules onto the
1539 // the deterministic test scheduler while this dialog is open.
1539 // deterministic test scheduler and trips "Your test is not deterministic".
1540 #[cfg_attr(
1541 target_os = "macos",
1542 ignore = "camera effects thread trips the test scheduler"
1543 )]
1544 #[gpui_kit::test]
1540 #[gpui_kit::test]
1545 fn settings_dialog_keeps_its_inset_at_every_size(cx: &mut TestAppContext) {
1541 fn settings_dialog_keeps_its_inset_at_every_size(cx: &mut TestAppContext) {
1546 check_settings_dialog(cx, &SETTINGS_SECTIONS);
1542 let sections: Vec<_> = SETTINGS_SECTIONS
1543 .into_iter()
1544 .filter(|section| *section != SettingsSection::Devices)
1545 .collect();
1546 check_settings_dialog(cx, &sections);
1547 }
1547 }
1548
1548
1549 #[gpui_kit::test]
1549 #[gpui_kit::test]
@@ -1640,7 +1640,7 @@ mod frames {
1640 f32::from(
1640 f32::from(
1641 window
1641 window
1642 .text_system()
1642 .text_system()
1643 .shape_line(text.into(), px(NAV_LABEL_SIZE), &[run], None)
1643 .shape_line(text.clone().into(), px(NAV_LABEL_SIZE), &[run], None)
1644 .width,
1644 .width,
1645 )
1645 )
1646 });
1646 });
crates/app/src/notify/center.rs +12 −0
@@ -29,6 +29,7 @@ use super::text::describe;
29 29 use super::toast::{PillView, ToastView};
30 30 use super::urgent_repeat::UrgentRepeats;
31 31 use crate::active_appearance::{self, ActiveAppearance};
32 use crate::active_locale::ActiveLocale;
32 33 use crate::activity::ActivityCenter;
33 34 use crate::agent_api::{self, pending::PendingProposal};
34 35 use crate::agents::{AgentRun, AgentRunsEvent, RunState};
@@ -110,6 +111,7 @@ pub struct NotificationCenter {
110 111 _subscription: Subscription,
111 112 _activity_observation: Subscription,
112 113 _appearance_observation: Subscription,
114 _locale_observation: Subscription,
113 115 _agent_subscription: Option<Subscription>,
114 116 started_at: DateTime<Utc>,
115 117 known_proposals: HashSet<String>,
@@ -139,6 +141,9 @@ impl NotificationCenter {
139 141 let appearance_observation = cx.observe_global::<ActiveAppearance>(|this, cx| {
140 142 this.apply_app_icon(active_appearance::current(cx).app_icon, cx)
141 143 });
144 let locale_observation = cx.observe_global::<ActiveLocale>(|this, _| {
145 this.relocalize_tray();
146 });
142 147 let subscription = cx.subscribe(&app, |this, _, event: &AppEvent, cx| {
143 148 this.on_app_event(event, cx);
144 149 });
@@ -188,6 +193,7 @@ impl NotificationCenter {
188 193 _subscription: subscription,
189 194 _activity_observation: activity_observation,
190 195 _appearance_observation: appearance_observation,
196 _locale_observation: locale_observation,
191 197 _agent_subscription: agent_subscription,
192 198 };
193 199 cx.spawn(async move |this, cx| {
@@ -1187,6 +1193,12 @@ impl NotificationCenter {
1187 1193 });
1188 1194 }
1189 1195
1196 fn relocalize_tray(&self) {
1197 if let Some(tray) = &self.tray {
1198 tray.relocalize();
1199 }
1200 }
1201
1190 1202 fn sync_tray(&self) {
1191 1203 if let Some(tray) = &self.tray {
1192 1204 tray.sync(
@@ -29,6 +29,7 @@ use super::text::describe;
29use super::toast::{PillView, ToastView};
29use super::toast::{PillView, ToastView};
30use super::urgent_repeat::UrgentRepeats;
30use super::urgent_repeat::UrgentRepeats;
31use crate::active_appearance::{self, ActiveAppearance};
31use crate::active_appearance::{self, ActiveAppearance};
32use crate::active_locale::ActiveLocale;
32use crate::activity::ActivityCenter;
33use crate::activity::ActivityCenter;
33use crate::agent_api::{self, pending::PendingProposal};
34use crate::agent_api::{self, pending::PendingProposal};
34use crate::agents::{AgentRun, AgentRunsEvent, RunState};
35use crate::agents::{AgentRun, AgentRunsEvent, RunState};
@@ -110,6 +111,7 @@ pub struct NotificationCenter {
110 _subscription: Subscription,
111 _subscription: Subscription,
111 _activity_observation: Subscription,
112 _activity_observation: Subscription,
112 _appearance_observation: Subscription,
113 _appearance_observation: Subscription,
114 _locale_observation: Subscription,
113 _agent_subscription: Option<Subscription>,
115 _agent_subscription: Option<Subscription>,
114 started_at: DateTime<Utc>,
116 started_at: DateTime<Utc>,
115 known_proposals: HashSet<String>,
117 known_proposals: HashSet<String>,
@@ -139,6 +141,9 @@ impl NotificationCenter {
139 let appearance_observation = cx.observe_global::<ActiveAppearance>(|this, cx| {
141 let appearance_observation = cx.observe_global::<ActiveAppearance>(|this, cx| {
140 this.apply_app_icon(active_appearance::current(cx).app_icon, cx)
142 this.apply_app_icon(active_appearance::current(cx).app_icon, cx)
141 });
143 });
144 let locale_observation = cx.observe_global::<ActiveLocale>(|this, _| {
145 this.relocalize_tray();
146 });
142 let subscription = cx.subscribe(&app, |this, _, event: &AppEvent, cx| {
147 let subscription = cx.subscribe(&app, |this, _, event: &AppEvent, cx| {
143 this.on_app_event(event, cx);
148 this.on_app_event(event, cx);
144 });
149 });
@@ -188,6 +193,7 @@ impl NotificationCenter {
188 _subscription: subscription,
193 _subscription: subscription,
189 _activity_observation: activity_observation,
194 _activity_observation: activity_observation,
190 _appearance_observation: appearance_observation,
195 _appearance_observation: appearance_observation,
196 _locale_observation: locale_observation,
191 _agent_subscription: agent_subscription,
197 _agent_subscription: agent_subscription,
192 };
198 };
193 cx.spawn(async move |this, cx| {
199 cx.spawn(async move |this, cx| {
@@ -1187,6 +1193,12 @@ impl NotificationCenter {
1187 });
1193 });
1188 }
1194 }
1189
1195
1196 fn relocalize_tray(&self) {
1197 if let Some(tray) = &self.tray {
1198 tray.relocalize();
1199 }
1200 }
1201
1190 fn sync_tray(&self) {
1202 fn sync_tray(&self) {
1191 if let Some(tray) = &self.tray {
1203 if let Some(tray) = &self.tray {
1192 tray.sync(
1204 tray.sync(
crates/app/src/settings/account.rs +5 −1
@@ -97,7 +97,11 @@ pub fn label_of<T: PartialEq + Copy>(options: &[Labeled<T>], current: T) -> &'st
97 97
98 98 pub fn account_select<T: PartialEq + Copy + 'static>(
99 99 app: &Entity<AppState>,
100 (id, title, detail): (&'static str, &'static str, &'static str),
100 (id, title, detail): (
101 &'static str,
102 impl Into<SharedString>,
103 impl Into<SharedString>,
104 ),
101 105 options: &'static [Labeled<T>],
102 106 current: T,
103 107 change: fn(T) -> ChatSettingChange,
@@ -97,7 +97,11 @@ pub fn label_of<T: PartialEq + Copy>(options: &[Labeled<T>], current: T) -> &'st
97
97
98pub fn account_select<T: PartialEq + Copy + 'static>(
98pub fn account_select<T: PartialEq + Copy + 'static>(
99 app: &Entity<AppState>,
99 app: &Entity<AppState>,
100 (id, title, detail): (&'static str, &'static str, &'static str),
100 (id, title, detail): (
101 &'static str,
102 impl Into<SharedString>,
103 impl Into<SharedString>,
104 ),
101 options: &'static [Labeled<T>],
105 options: &'static [Labeled<T>],
102 current: T,
106 current: T,
103 change: fn(T) -> ChatSettingChange,
107 change: fn(T) -> ChatSettingChange,
crates/app/src/settings/appearance.rs +58 −17
@@ -4,10 +4,13 @@ use gpui_kit::*;
4 4
5 5 use super::rows::{Choice, ROW_INSET, caption, control_row, select_with_width, titled};
6 6 use crate::active_appearance;
7 use crate::active_locale;
7 8 use crate::app_state::AppState;
8 9 use crate::appearance::{AppIcon, ThemeChoice};
10 use crate::i18n::tr;
9 11 use crate::theme::{self, Palette};
10 12 use crate::views::title_bar::app_icon_image;
13 use app_base::ui_locale::LocalePreference;
11 14
12 15 const TILE_WIDTH: f32 = 168.;
13 16 const TILE_PADDING: f32 = 8.;
@@ -18,18 +21,40 @@ const PREVIEW_RADIUS: f32 = TILE_RADIUS - TILE_PADDING;
18 21 const PREVIEW_ICON_SIZE: f32 = 48.;
19 22 const RADIO_SIZE: f32 = 16.;
20 23 const RADIO_DOT_SIZE: f32 = 8.;
21 const COLOR_SCHEME_DETAIL: &str = "The colors to use for Rusty Teams";
22 const THEME_TITLE: &str = "Theme";
23 const THEME_DETAIL: &str = "The theme to use for Teams";
24 24 const THEME_SELECT_WIDTH: f32 = 240.;
25 #[cfg(windows)]
26 const APP_ICON_DETAIL: &str =
27 "Shown in the title bar, taskbar and tray. Pinned shortcuts keep the icon of the .exe";
28 #[cfg(not(windows))]
29 const APP_ICON_DETAIL: &str = "Shown in the title bar, taskbar and tray";
25 const LANGUAGE_SELECT_WIDTH: f32 = 240.;
26
27 fn language_label(pref: LocalePreference) -> String {
28 match pref {
29 LocalePreference::Auto => tr("settings.appearance.language.follow_system"),
30 LocalePreference::English => tr("settings.appearance.language.english"),
31 LocalePreference::German => tr("settings.appearance.language.german"),
32 }
33 }
34 fn app_icon_detail() -> String {
35 #[cfg(windows)]
36 {
37 tr("settings.appearance.app_icon_detail_windows")
38 }
39 #[cfg(not(windows))]
40 {
41 tr("settings.appearance.app_icon_detail")
42 }
43 }
30 44
31 45 pub fn render(app: &Entity<AppState>, cx: &App) -> Div {
32 46 let current = active_appearance::current(cx);
47 let locale_pref = active_locale::current_preference(cx);
48 let language_choices = LocalePreference::ALL
49 .into_iter()
50 .map(|pref| {
51 let app = app.clone();
52 Choice::new(language_label(pref), pref == locale_pref, move |cx| {
53 let store = app.read(cx).store.clone();
54 active_locale::set_preference(pref, &store, cx);
55 })
56 })
57 .collect();
33 58 let scheme_tiles = theme::SCHEMES.into_iter().map(|scheme| {
34 59 let app = app.clone();
35 60 tile(
@@ -68,10 +93,22 @@ pub fn render(app: &Entity<AppState>, cx: &App) -> Div {
68 93 .collect();
69 94 v_flex()
70 95 .w_full()
71 .child(caption("THEME"))
96 .child(caption(&tr("settings.caption.language")))
97 .child(control_row(
98 &tr("settings.appearance.language.title"),
99 &tr("settings.appearance.language.detail"),
100 select_with_width(
101 "settings-language",
102 language_label(locale_pref),
103 LANGUAGE_SELECT_WIDTH,
104 false,
105 language_choices,
106 ),
107 ))
108 .child(caption(tr("settings.caption.theme")))
72 109 .child(control_row(
73 THEME_TITLE,
74 THEME_DETAIL,
110 tr("settings.appearance.theme"),
111 tr("settings.appearance.theme_detail"),
75 112 select_with_width(
76 113 "settings-theme",
77 114 current.theme.label(),
@@ -81,17 +118,21 @@ pub fn render(app: &Entity<AppState>, cx: &App) -> Div {
81 118 ),
82 119 ))
83 120 .child(choice_group(
84 "Color scheme",
85 COLOR_SCHEME_DETAIL,
121 tr("settings.appearance.color_scheme"),
122 tr("settings.appearance.color_scheme_detail"),
86 123 scheme_tiles,
87 124 ))
88 .child(caption("APP ICON"))
89 .child(choice_group("App icon", APP_ICON_DETAIL, icon_tiles))
125 .child(caption(tr("settings.caption.app_icon")))
126 .child(choice_group(
127 tr("settings.appearance.app_icon"),
128 app_icon_detail(),
129 icon_tiles,
130 ))
90 131 }
91 132
92 133 fn choice_group(
93 title: &'static str,
94 detail: &'static str,
134 title: impl Into<SharedString>,
135 detail: impl Into<SharedString>,
95 136 tiles: impl Iterator<Item = Stateful<Div>>,
96 137 ) -> Div {
97 138 v_flex()
@@ -4,10 +4,13 @@ use gpui_kit::*;
4
4
5use super::rows::{Choice, ROW_INSET, caption, control_row, select_with_width, titled};
5use super::rows::{Choice, ROW_INSET, caption, control_row, select_with_width, titled};
6use crate::active_appearance;
6use crate::active_appearance;
7use crate::active_locale;
7use crate::app_state::AppState;
8use crate::app_state::AppState;
8use crate::appearance::{AppIcon, ThemeChoice};
9use crate::appearance::{AppIcon, ThemeChoice};
10use crate::i18n::tr;
9use crate::theme::{self, Palette};
11use crate::theme::{self, Palette};
10use crate::views::title_bar::app_icon_image;
12use crate::views::title_bar::app_icon_image;
13use app_base::ui_locale::LocalePreference;
11
14
12const TILE_WIDTH: f32 = 168.;
15const TILE_WIDTH: f32 = 168.;
13const TILE_PADDING: f32 = 8.;
16const TILE_PADDING: f32 = 8.;
@@ -18,18 +21,40 @@ const PREVIEW_RADIUS: f32 = TILE_RADIUS - TILE_PADDING;
18const PREVIEW_ICON_SIZE: f32 = 48.;
21const PREVIEW_ICON_SIZE: f32 = 48.;
19const RADIO_SIZE: f32 = 16.;
22const RADIO_SIZE: f32 = 16.;
20const RADIO_DOT_SIZE: f32 = 8.;
23const RADIO_DOT_SIZE: f32 = 8.;
21const COLOR_SCHEME_DETAIL: &str = "The colors to use for Rusty Teams";
22const THEME_TITLE: &str = "Theme";
23const THEME_DETAIL: &str = "The theme to use for Teams";
24const THEME_SELECT_WIDTH: f32 = 240.;
24const THEME_SELECT_WIDTH: f32 = 240.;
25#[cfg(windows)]
25const LANGUAGE_SELECT_WIDTH: f32 = 240.;
26const APP_ICON_DETAIL: &str =
26
27 "Shown in the title bar, taskbar and tray. Pinned shortcuts keep the icon of the .exe";
27fn language_label(pref: LocalePreference) -> String {
28#[cfg(not(windows))]
28 match pref {
29const APP_ICON_DETAIL: &str = "Shown in the title bar, taskbar and tray";
29 LocalePreference::Auto => tr("settings.appearance.language.follow_system"),
30 LocalePreference::English => tr("settings.appearance.language.english"),
31 LocalePreference::German => tr("settings.appearance.language.german"),
32 }
33}
34fn app_icon_detail() -> String {
35 #[cfg(windows)]
36 {
37 tr("settings.appearance.app_icon_detail_windows")
38 }
39 #[cfg(not(windows))]
40 {
41 tr("settings.appearance.app_icon_detail")
42 }
43}
30
44
31pub fn render(app: &Entity<AppState>, cx: &App) -> Div {
45pub fn render(app: &Entity<AppState>, cx: &App) -> Div {
32 let current = active_appearance::current(cx);
46 let current = active_appearance::current(cx);
47 let locale_pref = active_locale::current_preference(cx);
48 let language_choices = LocalePreference::ALL
49 .into_iter()
50 .map(|pref| {
51 let app = app.clone();
52 Choice::new(language_label(pref), pref == locale_pref, move |cx| {
53 let store = app.read(cx).store.clone();
54 active_locale::set_preference(pref, &store, cx);
55 })
56 })
57 .collect();
33 let scheme_tiles = theme::SCHEMES.into_iter().map(|scheme| {
58 let scheme_tiles = theme::SCHEMES.into_iter().map(|scheme| {
34 let app = app.clone();
59 let app = app.clone();
35 tile(
60 tile(
@@ -68,10 +93,22 @@ pub fn render(app: &Entity<AppState>, cx: &App) -> Div {
68 .collect();
93 .collect();
69 v_flex()
94 v_flex()
70 .w_full()
95 .w_full()
71 .child(caption("THEME"))
96 .child(caption(&tr("settings.caption.language")))
97 .child(control_row(
98 &tr("settings.appearance.language.title"),
99 &tr("settings.appearance.language.detail"),
100 select_with_width(
101 "settings-language",
102 language_label(locale_pref),
103 LANGUAGE_SELECT_WIDTH,
104 false,
105 language_choices,
106 ),
107 ))
108 .child(caption(tr("settings.caption.theme")))
72 .child(control_row(
109 .child(control_row(
73 THEME_TITLE,
110 tr("settings.appearance.theme"),
74 THEME_DETAIL,
111 tr("settings.appearance.theme_detail"),
75 select_with_width(
112 select_with_width(
76 "settings-theme",
113 "settings-theme",
77 current.theme.label(),
114 current.theme.label(),
@@ -81,17 +118,21 @@ pub fn render(app: &Entity<AppState>, cx: &App) -> Div {
81 ),
118 ),
82 ))
119 ))
83 .child(choice_group(
120 .child(choice_group(
84 "Color scheme",
121 tr("settings.appearance.color_scheme"),
85 COLOR_SCHEME_DETAIL,
122 tr("settings.appearance.color_scheme_detail"),
86 scheme_tiles,
123 scheme_tiles,
87 ))
124 ))
88 .child(caption("APP ICON"))
125 .child(caption(tr("settings.caption.app_icon")))
89 .child(choice_group("App icon", APP_ICON_DETAIL, icon_tiles))
126 .child(choice_group(
127 tr("settings.appearance.app_icon"),
128 app_icon_detail(),
129 icon_tiles,
130 ))
90}
131}
91
132
92fn choice_group(
133fn choice_group(
93 title: &'static str,
134 title: impl Into<SharedString>,
94 detail: &'static str,
135 detail: impl Into<SharedString>,
95 tiles: impl Iterator<Item = Stateful<Div>>,
136 tiles: impl Iterator<Item = Stateful<Div>>,
96) -> Div {
137) -> Div {
97 v_flex()
138 v_flex()
crates/app/src/settings/general.rs +39 −25
@@ -12,15 +12,11 @@ use teams_core::{ChatSettingChange, TranslationBehavior};
12 12 use super::account::{UP_ARROW, account_select};
13 13 use super::rows::{Choice, caption, control_row, select, toggle_row};
14 14 use crate::app_state::AppState;
15 use crate::i18n::tr;
15 16 use crate::notify::NotificationCenter;
16 17 use crate::theme;
17 18 use crate::views::widgets::icon;
18 19
19 const BEHAVIORS: [(&str, TranslationBehavior); 3] = [
20 ("Ask me before translating", TranslationBehavior::Ask),
21 ("Auto-translate all messages", TranslationBehavior::Auto),
22 ("Never translate", TranslationBehavior::Never),
23 ];
24 20 const CHIP_HEIGHT: f32 = 24.;
25 21 const DISABLED_OPACITY: f32 = 0.4;
26 22 const LANGUAGE_MENU_HEIGHT: f32 = 320.;
@@ -31,7 +27,7 @@ fn startup_rows(center: &Entity<NotificationCenter>, cx: &App) -> [Stateful<Div>
31 27 [
32 28 toggle_row(
33 29 "settings-auto-start",
34 "Auto-start Teams",
30 tr("settings.general.auto_start"),
35 31 "",
36 32 theme::text_muted(),
37 33 startup.auto_start,
@@ -43,7 +39,7 @@ fn startup_rows(center: &Entity<NotificationCenter>, cx: &App) -> [Stateful<Div>
43 39 }),
44 40 toggle_row(
45 41 "settings-open-in-background",
46 "Open application in background",
42 tr("settings.general.open_in_background"),
47 43 "",
48 44 theme::text_muted(),
49 45 startup.open_in_background,
@@ -64,13 +60,13 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
64 60 let toggle_center = center.clone();
65 61 v_flex()
66 62 .w_full()
67 .child(caption("SYSTEM"))
63 .child(caption(tr("settings.caption.system")))
68 64 .children(startup_rows(center, cx))
69 65 .child(
70 66 toggle_row(
71 67 "settings-close-to-tray",
72 "On close, keep the application running",
73 "The title bar X hides the window to the tray",
68 tr("settings.general.close_to_tray"),
69 tr("settings.general.close_to_tray_detail"),
74 70 theme::text_muted(),
75 71 close_to_tray,
76 72 )
@@ -82,19 +78,19 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
82 78 })
83 79 }),
84 80 )
85 .child(caption("COMPOSE BOX"))
81 .child(caption(tr("settings.caption.compose_box")))
86 82 .child(account_select(
87 83 app,
88 84 (
89 85 "settings-up-arrow",
90 "Up arrow key behaviour in compose box",
91 "Choose what happens when you press Up arrow at the beginning of the compose box.",
86 tr("settings.general.up_arrow"),
87 tr("settings.general.up_arrow_detail"),
92 88 ),
93 89 &UP_ARROW,
94 90 app.read(cx).account_chat_settings().up_arrow,
95 91 ChatSettingChange::UpArrow,
96 92 ))
97 .child(caption("TRANSLATION"))
93 .child(caption(tr("settings.caption.translation")))
98 94 .children(translation_rows(app, cx))
99 95 }
100 96
@@ -102,8 +98,12 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
102 98 let state = app.read(cx);
103 99 if state.translation.settings.is_none() {
104 100 return vec![
105 control_row("Translation", "Translation settings not loaded yet", div())
106 .into_any_element(),
101 control_row(
102 tr("settings.general.translation_title"),
103 tr("settings.general.translation_not_loaded"),
104 div(),
105 )
106 .into_any_element(),
107 107 ];
108 108 }
109 109 let translation = &state.translation;
@@ -119,7 +119,25 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
119 119 })
120 120 })
121 121 .collect();
122 let behaviors = BEHAVIORS
122 let behavior_options = [
123 (
124 tr("settings.general.behavior_ask"),
125 TranslationBehavior::Ask,
126 ),
127 (
128 tr("settings.general.behavior_auto"),
129 TranslationBehavior::Auto,
130 ),
131 (
132 tr("settings.general.behavior_never"),
133 TranslationBehavior::Never,
134 ),
135 ];
136 let behavior_label = behavior_options
137 .iter()
138 .find(|(_, choice)| *choice == behavior)
139 .map_or(String::new(), |(label, _)| label.clone());
140 let behaviors = behavior_options
123 141 .into_iter()
124 142 .map(|(label, choice)| {
125 143 let app = app.clone();
@@ -128,13 +146,9 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
128 146 })
129 147 })
130 148 .collect();
131 let behavior_label = BEHAVIORS
132 .iter()
133 .find(|(_, choice)| *choice == behavior)
134 .map_or("", |(label, _)| label);
135 149 vec![
136 150 control_row(
137 "Translate messages into this language",
151 tr("settings.general.translate_into"),
138 152 "Read from your Teams account",
139 153 select(
140 154 "settings-translation-target",
@@ -145,7 +159,7 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
145 159 )
146 160 .into_any_element(),
147 161 control_row(
148 "How to handle messages in other languages",
162 tr("settings.general.behavior_title"),
149 163 "",
150 164 select(
151 165 "settings-translation-behavior",
@@ -156,7 +170,7 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
156 170 )
157 171 .into_any_element(),
158 172 control_row(
159 "Never translate messages in these languages",
173 tr("settings.general.never_translate"),
160 174 "",
161 175 never_chips(app, &target, cx),
162 176 )
@@ -228,7 +242,7 @@ fn add_language_button(choices: Vec<Choice>) -> impl IntoElement {
228 242 .rounded(px(6.))
229 243 .text_size(px(12.))
230 244 .text_color(theme::accent_text())
231 .label("+ Add language")
245 .label(format!("+ {}", tr("common.add")))
232 246 .dropdown_menu(move |menu, _, _| {
233 247 choices.iter().fold(
234 248 menu.max_h(px(LANGUAGE_MENU_HEIGHT)).scrollable(true),
@@ -12,15 +12,11 @@ use teams_core::{ChatSettingChange, TranslationBehavior};
12use super::account::{UP_ARROW, account_select};
12use super::account::{UP_ARROW, account_select};
13use super::rows::{Choice, caption, control_row, select, toggle_row};
13use super::rows::{Choice, caption, control_row, select, toggle_row};
14use crate::app_state::AppState;
14use crate::app_state::AppState;
15use crate::i18n::tr;
15use crate::notify::NotificationCenter;
16use crate::notify::NotificationCenter;
16use crate::theme;
17use crate::theme;
17use crate::views::widgets::icon;
18use crate::views::widgets::icon;
18
19
19const BEHAVIORS: [(&str, TranslationBehavior); 3] = [
20 ("Ask me before translating", TranslationBehavior::Ask),
21 ("Auto-translate all messages", TranslationBehavior::Auto),
22 ("Never translate", TranslationBehavior::Never),
23];
24const CHIP_HEIGHT: f32 = 24.;
20const CHIP_HEIGHT: f32 = 24.;
25const DISABLED_OPACITY: f32 = 0.4;
21const DISABLED_OPACITY: f32 = 0.4;
26const LANGUAGE_MENU_HEIGHT: f32 = 320.;
22const LANGUAGE_MENU_HEIGHT: f32 = 320.;
@@ -31,7 +27,7 @@ fn startup_rows(center: &Entity<NotificationCenter>, cx: &App) -> [Stateful<Div>
31 [
27 [
32 toggle_row(
28 toggle_row(
33 "settings-auto-start",
29 "settings-auto-start",
34 "Auto-start Teams",
30 tr("settings.general.auto_start"),
35 "",
31 "",
36 theme::text_muted(),
32 theme::text_muted(),
37 startup.auto_start,
33 startup.auto_start,
@@ -43,7 +39,7 @@ fn startup_rows(center: &Entity<NotificationCenter>, cx: &App) -> [Stateful<Div>
43 }),
39 }),
44 toggle_row(
40 toggle_row(
45 "settings-open-in-background",
41 "settings-open-in-background",
46 "Open application in background",
42 tr("settings.general.open_in_background"),
47 "",
43 "",
48 theme::text_muted(),
44 theme::text_muted(),
49 startup.open_in_background,
45 startup.open_in_background,
@@ -64,13 +60,13 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
64 let toggle_center = center.clone();
60 let toggle_center = center.clone();
65 v_flex()
61 v_flex()
66 .w_full()
62 .w_full()
67 .child(caption("SYSTEM"))
63 .child(caption(tr("settings.caption.system")))
68 .children(startup_rows(center, cx))
64 .children(startup_rows(center, cx))
69 .child(
65 .child(
70 toggle_row(
66 toggle_row(
71 "settings-close-to-tray",
67 "settings-close-to-tray",
72 "On close, keep the application running",
68 tr("settings.general.close_to_tray"),
73 "The title bar X hides the window to the tray",
69 tr("settings.general.close_to_tray_detail"),
74 theme::text_muted(),
70 theme::text_muted(),
75 close_to_tray,
71 close_to_tray,
76 )
72 )
@@ -82,19 +78,19 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
82 })
78 })
83 }),
79 }),
84 )
80 )
85 .child(caption("COMPOSE BOX"))
81 .child(caption(tr("settings.caption.compose_box")))
86 .child(account_select(
82 .child(account_select(
87 app,
83 app,
88 (
84 (
89 "settings-up-arrow",
85 "settings-up-arrow",
90 "Up arrow key behaviour in compose box",
86 tr("settings.general.up_arrow"),
91 "Choose what happens when you press Up arrow at the beginning of the compose box.",
87 tr("settings.general.up_arrow_detail"),
92 ),
88 ),
93 &UP_ARROW,
89 &UP_ARROW,
94 app.read(cx).account_chat_settings().up_arrow,
90 app.read(cx).account_chat_settings().up_arrow,
95 ChatSettingChange::UpArrow,
91 ChatSettingChange::UpArrow,
96 ))
92 ))
97 .child(caption("TRANSLATION"))
93 .child(caption(tr("settings.caption.translation")))
98 .children(translation_rows(app, cx))
94 .children(translation_rows(app, cx))
99}
95}
100
96
@@ -102,8 +98,12 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
102 let state = app.read(cx);
98 let state = app.read(cx);
103 if state.translation.settings.is_none() {
99 if state.translation.settings.is_none() {
104 return vec![
100 return vec![
105 control_row("Translation", "Translation settings not loaded yet", div())
101 control_row(
106 .into_any_element(),
102 tr("settings.general.translation_title"),
103 tr("settings.general.translation_not_loaded"),
104 div(),
105 )
106 .into_any_element(),
107 ];
107 ];
108 }
108 }
109 let translation = &state.translation;
109 let translation = &state.translation;
@@ -119,7 +119,25 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
119 })
119 })
120 })
120 })
121 .collect();
121 .collect();
122 let behaviors = BEHAVIORS
122 let behavior_options = [
123 (
124 tr("settings.general.behavior_ask"),
125 TranslationBehavior::Ask,
126 ),
127 (
128 tr("settings.general.behavior_auto"),
129 TranslationBehavior::Auto,
130 ),
131 (
132 tr("settings.general.behavior_never"),
133 TranslationBehavior::Never,
134 ),
135 ];
136 let behavior_label = behavior_options
137 .iter()
138 .find(|(_, choice)| *choice == behavior)
139 .map_or(String::new(), |(label, _)| label.clone());
140 let behaviors = behavior_options
123 .into_iter()
141 .into_iter()
124 .map(|(label, choice)| {
142 .map(|(label, choice)| {
125 let app = app.clone();
143 let app = app.clone();
@@ -128,13 +146,9 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
128 })
146 })
129 })
147 })
130 .collect();
148 .collect();
131 let behavior_label = BEHAVIORS
132 .iter()
133 .find(|(_, choice)| *choice == behavior)
134 .map_or("", |(label, _)| label);
135 vec![
149 vec![
136 control_row(
150 control_row(
137 "Translate messages into this language",
151 tr("settings.general.translate_into"),
138 "Read from your Teams account",
152 "Read from your Teams account",
139 select(
153 select(
140 "settings-translation-target",
154 "settings-translation-target",
@@ -145,7 +159,7 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
145 )
159 )
146 .into_any_element(),
160 .into_any_element(),
147 control_row(
161 control_row(
148 "How to handle messages in other languages",
162 tr("settings.general.behavior_title"),
149 "",
163 "",
150 select(
164 select(
151 "settings-translation-behavior",
165 "settings-translation-behavior",
@@ -156,7 +170,7 @@ fn translation_rows(app: &Entity<AppState>, cx: &App) -> Vec<AnyElement> {
156 )
170 )
157 .into_any_element(),
171 .into_any_element(),
158 control_row(
172 control_row(
159 "Never translate messages in these languages",
173 tr("settings.general.never_translate"),
160 "",
174 "",
161 never_chips(app, &target, cx),
175 never_chips(app, &target, cx),
162 )
176 )
@@ -228,7 +242,7 @@ fn add_language_button(choices: Vec<Choice>) -> impl IntoElement {
228 .rounded(px(6.))
242 .rounded(px(6.))
229 .text_size(px(12.))
243 .text_size(px(12.))
230 .text_color(theme::accent_text())
244 .text_color(theme::accent_text())
231 .label("+ Add language")
245 .label(format!("+ {}", tr("common.add")))
232 .dropdown_menu(move |menu, _, _| {
246 .dropdown_menu(move |menu, _, _| {
233 choices.iter().fold(
247 choices.iter().fold(
234 menu.max_h(px(LANGUAGE_MENU_HEIGHT)).scrollable(true),
248 menu.max_h(px(LANGUAGE_MENU_HEIGHT)).scrollable(true),
crates/app/src/settings/notifications.rs +47 −35
@@ -9,6 +9,7 @@ use super::account::{
9 9 };
10 10 use super::rows::{Choice, caption, control_row, select, text_button, toggle_row};
11 11 use crate::app_state::AppState;
12 use crate::i18n::tr;
12 13 use crate::notify::NotificationCenter;
13 14 use crate::notify::rules::{Corner, Settings};
14 15 use crate::notify::sounds::AlertSound;
@@ -22,51 +23,51 @@ type SoundAccessor = fn(&mut Settings) -> &mut AlertSound;
22 23
23 24 struct Toggle {
24 25 id: &'static str,
25 title: &'static str,
26 detail: &'static str,
26 title_key: &'static str,
27 detail_key: Option<&'static str>,
27 28 field: Accessor,
28 29 }
29 30
30 31 const FLASH: Toggle = Toggle {
31 32 id: "settings-flash",
32 title: "Flash taskbar when notifications are received",
33 detail: "On new messages, until you open the window",
33 title_key: "settings.notifications.flash_taskbar",
34 detail_key: Some("settings.notifications.flash_taskbar_detail"),
34 35 field: |settings| &mut settings.flash,
35 36 };
36 37
37 38 const NOTIFICATION_SOUND: Toggle = Toggle {
38 39 id: "settings-notification-sound",
39 title: "Play sounds with notifications",
40 detail: "",
40 title_key: "settings.notifications.play_sounds",
41 detail_key: None,
41 42 field: |settings| &mut settings.sounds.notification_sound,
42 43 };
43 44
44 45 const URGENT_SOUND: Toggle = Toggle {
45 46 id: "settings-urgent-sound",
46 title: "Play sounds with urgent and priority contact notifications",
47 detail: "",
47 title_key: "settings.notifications.urgent_sounds",
48 detail_key: None,
48 49 field: |settings| &mut settings.sounds.urgent_sound,
49 50 };
50 51
51 52 const CALL_SOUNDS: [Toggle; 2] = [
52 53 Toggle {
53 54 id: "settings-call-sound",
54 title: "Play sounds with incoming calls, requests to join, and meeting start notifications",
55 detail: "",
55 title_key: "settings.notifications.call_sounds",
56 detail_key: None,
56 57 field: |settings| &mut settings.sounds.call_and_meeting_sound,
57 58 },
58 59 Toggle {
59 60 id: "settings-busy-sound",
60 title: "Play sounds when I'm busy or in a meeting",
61 detail: "",
61 title_key: "settings.notifications.busy_sounds",
62 detail_key: None,
62 63 field: |settings| &mut settings.sounds.sound_when_busy,
63 64 },
64 65 ];
65 66
66 67 const HIDE_IN_CALLS: Toggle = Toggle {
67 68 id: "settings-hide-in-calls",
68 title: "Hide notifications during calls and meetings",
69 detail: "No message toasts while a call is active",
69 title_key: "settings.notifications.hide_in_calls",
70 detail_key: Some("settings.notifications.hide_in_calls_detail"),
70 71 field: |settings| &mut settings.mute_in_calls,
71 72 };
72 73
@@ -87,12 +88,12 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
87 88 let test_center = center.clone();
88 89 v_flex()
89 90 .w_full()
90 .child(caption("APPEARANCE AND SOUND"))
91 .child(caption(tr("settings.caption.appearance_and_sound")))
91 92 .child(preview_toggle(app, account.show_preview))
92 93 .child(flash)
93 94 .child(control_row(
94 "Position on the screen",
95 "Corner of the main screen",
95 tr("settings.notifications.position"),
96 tr("settings.notifications.position_detail"),
96 97 select(
97 98 "settings-position",
98 99 corner.label(),
@@ -101,15 +102,17 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
101 102 ),
102 103 ))
103 104 .child(control_row(
104 "Test notification",
105 "Shows a toast with the settings above",
106 text_button("settings-test-notification", "Send test notification").on_click(
107 move |_, _, cx| {
108 test_center.update(cx, |center, cx| center.send_test_notification(cx))
109 },
110 ),
105 tr("settings.notifications.test"),
106 tr("settings.notifications.test_detail"),
107 text_button(
108 "settings-test-notification",
109 tr("settings.notifications.send_test"),
110 )
111 .on_click(move |_, _, cx| {
112 test_center.update(cx, |center, cx| center.send_test_notification(cx))
113 }),
111 114 ))
112 .child(caption("SOUND"))
115 .child(caption(tr("settings.caption.sound")))
113 116 .child(notification_sound)
114 117 .child(sound_row(
115 118 center,
@@ -117,7 +120,7 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
117 120 "settings-notification-sound-type",
118 121 "settings-notification-sound-preview",
119 122 ),
120 "Notification sound",
123 tr("settings.notifications.notification_sound"),
121 124 &AlertSound::NORMAL,
122 125 sounds.notification_sound_type,
123 126 sounds.notification_sound,
@@ -130,7 +133,7 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
130 133 "settings-urgent-sound-type",
131 134 "settings-urgent-sound-preview",
132 135 ),
133 "Urgent sound",
136 tr("settings.notifications.urgent_sound"),
134 137 &AlertSound::URGENT,
135 138 sounds.urgent_sound_type,
136 139 sounds.urgent_sound,
@@ -142,7 +145,7 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
142 145 app,
143 146 (
144 147 "settings-notification-preset",
145 "Teams and channels",
148 tr("settings.notifications.teams_channels"),
146 149 preset_detail(account.preset),
147 150 ),
148 151 &PRESETS,
@@ -152,7 +155,11 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
152 155 .child(caption("CHAT"))
153 156 .child(account_select(
154 157 app,
155 ("settings-chat-messages", "Chat message notifications", ""),
158 (
159 "settings-chat-messages",
160 tr("settings.notifications.chat_messages"),
161 "",
162 ),
156 163 &CHAT_MESSAGES,
157 164 account.chat_messages,
158 165 ChatSettingChange::ChatMessages,
@@ -177,7 +184,11 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
177 184 ))
178 185 .child(account_select(
179 186 app,
180 ("settings-likes", "Likes and reactions", ""),
187 (
188 "settings-likes",
189 tr("settings.notifications.likes_reactions"),
190 "",
191 ),
181 192 &ACTIVITY_OR_OFF,
182 193 account.likes,
183 194 ChatSettingChange::Likes,
@@ -187,7 +198,7 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
187 198 app,
188 199 (
189 200 "settings-meeting-chats",
190 "Meeting chat notifications",
201 tr("settings.notifications.meeting_chats"),
191 202 meeting_chats_detail(account.meeting_chats),
192 203 ),
193 204 &MEETING_CHATS,
@@ -230,7 +241,7 @@ fn preview_toggle(app: &Entity<AppState>, on: bool) -> Stateful<Div> {
230 241 let app = app.clone();
231 242 toggle_row(
232 243 "settings-preview",
233 "Show message preview",
244 tr("settings.notifications.show_preview"),
234 245 "Off: only \"New message\"",
235 246 theme::text_muted(),
236 247 on,
@@ -245,10 +256,11 @@ fn preview_toggle(app: &Entity<AppState>, on: bool) -> Stateful<Div> {
245 256 fn toggle_element(center: &Entity<NotificationCenter>, toggle: &Toggle, on: bool) -> Stateful<Div> {
246 257 let center = center.clone();
247 258 let field = toggle.field;
259 let detail = toggle.detail_key.map(tr).unwrap_or_default();
248 260 toggle_row(
249 261 toggle.id,
250 toggle.title,
251 toggle.detail,
262 tr(toggle.title_key),
263 detail,
252 264 theme::text_muted(),
253 265 on,
254 266 )
@@ -279,7 +291,7 @@ fn corner_choices(center: &Entity<NotificationCenter>, current: Corner) -> Vec<C
279 291 fn sound_row(
280 292 center: &Entity<NotificationCenter>,
281 293 (id, preview_id): (&'static str, &'static str),
282 title: &'static str,
294 title: impl Into<SharedString>,
283 295 options: &'static [AlertSound],
284 296 current: AlertSound,
285 297 enabled: bool,
@@ -9,6 +9,7 @@ use super::account::{
9};
9};
10use super::rows::{Choice, caption, control_row, select, text_button, toggle_row};
10use super::rows::{Choice, caption, control_row, select, text_button, toggle_row};
11use crate::app_state::AppState;
11use crate::app_state::AppState;
12use crate::i18n::tr;
12use crate::notify::NotificationCenter;
13use crate::notify::NotificationCenter;
13use crate::notify::rules::{Corner, Settings};
14use crate::notify::rules::{Corner, Settings};
14use crate::notify::sounds::AlertSound;
15use crate::notify::sounds::AlertSound;
@@ -22,51 +23,51 @@ type SoundAccessor = fn(&mut Settings) -> &mut AlertSound;
22
23
23struct Toggle {
24struct Toggle {
24 id: &'static str,
25 id: &'static str,
25 title: &'static str,
26 title_key: &'static str,
26 detail: &'static str,
27 detail_key: Option<&'static str>,
27 field: Accessor,
28 field: Accessor,
28}
29}
29
30
30const FLASH: Toggle = Toggle {
31const FLASH: Toggle = Toggle {
31 id: "settings-flash",
32 id: "settings-flash",
32 title: "Flash taskbar when notifications are received",
33 title_key: "settings.notifications.flash_taskbar",
33 detail: "On new messages, until you open the window",
34 detail_key: Some("settings.notifications.flash_taskbar_detail"),
34 field: |settings| &mut settings.flash,
35 field: |settings| &mut settings.flash,
35};
36};
36
37
37const NOTIFICATION_SOUND: Toggle = Toggle {
38const NOTIFICATION_SOUND: Toggle = Toggle {
38 id: "settings-notification-sound",
39 id: "settings-notification-sound",
39 title: "Play sounds with notifications",
40 title_key: "settings.notifications.play_sounds",
40 detail: "",
41 detail_key: None,
41 field: |settings| &mut settings.sounds.notification_sound,
42 field: |settings| &mut settings.sounds.notification_sound,
42};
43};
43
44
44const URGENT_SOUND: Toggle = Toggle {
45const URGENT_SOUND: Toggle = Toggle {
45 id: "settings-urgent-sound",
46 id: "settings-urgent-sound",
46 title: "Play sounds with urgent and priority contact notifications",
47 title_key: "settings.notifications.urgent_sounds",
47 detail: "",
48 detail_key: None,
48 field: |settings| &mut settings.sounds.urgent_sound,
49 field: |settings| &mut settings.sounds.urgent_sound,
49};
50};
50
51
51const CALL_SOUNDS: [Toggle; 2] = [
52const CALL_SOUNDS: [Toggle; 2] = [
52 Toggle {
53 Toggle {
53 id: "settings-call-sound",
54 id: "settings-call-sound",
54 title: "Play sounds with incoming calls, requests to join, and meeting start notifications",
55 title_key: "settings.notifications.call_sounds",
55 detail: "",
56 detail_key: None,
56 field: |settings| &mut settings.sounds.call_and_meeting_sound,
57 field: |settings| &mut settings.sounds.call_and_meeting_sound,
57 },
58 },
58 Toggle {
59 Toggle {
59 id: "settings-busy-sound",
60 id: "settings-busy-sound",
60 title: "Play sounds when I'm busy or in a meeting",
61 title_key: "settings.notifications.busy_sounds",
61 detail: "",
62 detail_key: None,
62 field: |settings| &mut settings.sounds.sound_when_busy,
63 field: |settings| &mut settings.sounds.sound_when_busy,
63 },
64 },
64];
65];
65
66
66const HIDE_IN_CALLS: Toggle = Toggle {
67const HIDE_IN_CALLS: Toggle = Toggle {
67 id: "settings-hide-in-calls",
68 id: "settings-hide-in-calls",
68 title: "Hide notifications during calls and meetings",
69 title_key: "settings.notifications.hide_in_calls",
69 detail: "No message toasts while a call is active",
70 detail_key: Some("settings.notifications.hide_in_calls_detail"),
70 field: |settings| &mut settings.mute_in_calls,
71 field: |settings| &mut settings.mute_in_calls,
71};
72};
72
73
@@ -87,12 +88,12 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
87 let test_center = center.clone();
88 let test_center = center.clone();
88 v_flex()
89 v_flex()
89 .w_full()
90 .w_full()
90 .child(caption("APPEARANCE AND SOUND"))
91 .child(caption(tr("settings.caption.appearance_and_sound")))
91 .child(preview_toggle(app, account.show_preview))
92 .child(preview_toggle(app, account.show_preview))
92 .child(flash)
93 .child(flash)
93 .child(control_row(
94 .child(control_row(
94 "Position on the screen",
95 tr("settings.notifications.position"),
95 "Corner of the main screen",
96 tr("settings.notifications.position_detail"),
96 select(
97 select(
97 "settings-position",
98 "settings-position",
98 corner.label(),
99 corner.label(),
@@ -101,15 +102,17 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
101 ),
102 ),
102 ))
103 ))
103 .child(control_row(
104 .child(control_row(
104 "Test notification",
105 tr("settings.notifications.test"),
105 "Shows a toast with the settings above",
106 tr("settings.notifications.test_detail"),
106 text_button("settings-test-notification", "Send test notification").on_click(
107 text_button(
107 move |_, _, cx| {
108 "settings-test-notification",
108 test_center.update(cx, |center, cx| center.send_test_notification(cx))
109 tr("settings.notifications.send_test"),
109 },
110 )
110 ),
111 .on_click(move |_, _, cx| {
112 test_center.update(cx, |center, cx| center.send_test_notification(cx))
113 }),
111 ))
114 ))
112 .child(caption("SOUND"))
115 .child(caption(tr("settings.caption.sound")))
113 .child(notification_sound)
116 .child(notification_sound)
114 .child(sound_row(
117 .child(sound_row(
115 center,
118 center,
@@ -117,7 +120,7 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
117 "settings-notification-sound-type",
120 "settings-notification-sound-type",
118 "settings-notification-sound-preview",
121 "settings-notification-sound-preview",
119 ),
122 ),
120 "Notification sound",
123 tr("settings.notifications.notification_sound"),
121 &AlertSound::NORMAL,
124 &AlertSound::NORMAL,
122 sounds.notification_sound_type,
125 sounds.notification_sound_type,
123 sounds.notification_sound,
126 sounds.notification_sound,
@@ -130,7 +133,7 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
130 "settings-urgent-sound-type",
133 "settings-urgent-sound-type",
131 "settings-urgent-sound-preview",
134 "settings-urgent-sound-preview",
132 ),
135 ),
133 "Urgent sound",
136 tr("settings.notifications.urgent_sound"),
134 &AlertSound::URGENT,
137 &AlertSound::URGENT,
135 sounds.urgent_sound_type,
138 sounds.urgent_sound_type,
136 sounds.urgent_sound,
139 sounds.urgent_sound,
@@ -142,7 +145,7 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
142 app,
145 app,
143 (
146 (
144 "settings-notification-preset",
147 "settings-notification-preset",
145 "Teams and channels",
148 tr("settings.notifications.teams_channels"),
146 preset_detail(account.preset),
149 preset_detail(account.preset),
147 ),
150 ),
148 &PRESETS,
151 &PRESETS,
@@ -152,7 +155,11 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
152 .child(caption("CHAT"))
155 .child(caption("CHAT"))
153 .child(account_select(
156 .child(account_select(
154 app,
157 app,
155 ("settings-chat-messages", "Chat message notifications", ""),
158 (
159 "settings-chat-messages",
160 tr("settings.notifications.chat_messages"),
161 "",
162 ),
156 &CHAT_MESSAGES,
163 &CHAT_MESSAGES,
157 account.chat_messages,
164 account.chat_messages,
158 ChatSettingChange::ChatMessages,
165 ChatSettingChange::ChatMessages,
@@ -177,7 +184,11 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
177 ))
184 ))
178 .child(account_select(
185 .child(account_select(
179 app,
186 app,
180 ("settings-likes", "Likes and reactions", ""),
187 (
188 "settings-likes",
189 tr("settings.notifications.likes_reactions"),
190 "",
191 ),
181 &ACTIVITY_OR_OFF,
192 &ACTIVITY_OR_OFF,
182 account.likes,
193 account.likes,
183 ChatSettingChange::Likes,
194 ChatSettingChange::Likes,
@@ -187,7 +198,7 @@ pub fn render(center: &Entity<NotificationCenter>, app: &Entity<AppState>, cx: &
187 app,
198 app,
188 (
199 (
189 "settings-meeting-chats",
200 "settings-meeting-chats",
190 "Meeting chat notifications",
201 tr("settings.notifications.meeting_chats"),
191 meeting_chats_detail(account.meeting_chats),
202 meeting_chats_detail(account.meeting_chats),
192 ),
203 ),
193 &MEETING_CHATS,
204 &MEETING_CHATS,
@@ -230,7 +241,7 @@ fn preview_toggle(app: &Entity<AppState>, on: bool) -> Stateful<Div> {
230 let app = app.clone();
241 let app = app.clone();
231 toggle_row(
242 toggle_row(
232 "settings-preview",
243 "settings-preview",
233 "Show message preview",
244 tr("settings.notifications.show_preview"),
234 "Off: only \"New message\"",
245 "Off: only \"New message\"",
235 theme::text_muted(),
246 theme::text_muted(),
236 on,
247 on,
@@ -245,10 +256,11 @@ fn preview_toggle(app: &Entity<AppState>, on: bool) -> Stateful<Div> {
245fn toggle_element(center: &Entity<NotificationCenter>, toggle: &Toggle, on: bool) -> Stateful<Div> {
256fn toggle_element(center: &Entity<NotificationCenter>, toggle: &Toggle, on: bool) -> Stateful<Div> {
246 let center = center.clone();
257 let center = center.clone();
247 let field = toggle.field;
258 let field = toggle.field;
259 let detail = toggle.detail_key.map(tr).unwrap_or_default();
248 toggle_row(
260 toggle_row(
249 toggle.id,
261 toggle.id,
250 toggle.title,
262 tr(toggle.title_key),
251 toggle.detail,
263 detail,
252 theme::text_muted(),
264 theme::text_muted(),
253 on,
265 on,
254 )
266 )
@@ -279,7 +291,7 @@ fn corner_choices(center: &Entity<NotificationCenter>, current: Corner) -> Vec<C
279fn sound_row(
291fn sound_row(
280 center: &Entity<NotificationCenter>,
292 center: &Entity<NotificationCenter>,
281 (id, preview_id): (&'static str, &'static str),
293 (id, preview_id): (&'static str, &'static str),
282 title: &'static str,
294 title: impl Into<SharedString>,
283 options: &'static [AlertSound],
295 options: &'static [AlertSound],
284 current: AlertSound,
296 current: AlertSound,
285 enabled: bool,
297 enabled: bool,
crates/app/src/views/add_people_dialog.rs +3 −2
@@ -10,6 +10,7 @@ use store::MemberRecord;
10 10
11 11 use super::new_chat::{NewChatDraft, Pick};
12 12 use crate::app_state::AppState;
13 use crate::i18n::tr;
13 14 use crate::theme;
14 15
15 16 const DIALOG_WIDTH: f32 = 480.;
@@ -242,13 +243,13 @@ pub fn open_add_people(
242 243 let footer = DialogFooter::new()
243 244 .child(
244 245 Button::new("add-people-cancel")
245 .label("Cancel")
246 .label(tr("common.cancel"))
246 247 .on_click(|_, window, cx| window.close_dialog(cx)),
247 248 )
248 249 .child(
249 250 Button::new("add-people-confirm")
250 251 .primary()
251 .label("Add")
252 .label(tr("common.add"))
252 253 .disabled(!can_add)
253 254 .on_click(move |_, window, cx| {
254 255 submit_form.update(cx, |form, cx| form.submit(window, cx));
@@ -10,6 +10,7 @@ use store::MemberRecord;
10
10
11use super::new_chat::{NewChatDraft, Pick};
11use super::new_chat::{NewChatDraft, Pick};
12use crate::app_state::AppState;
12use crate::app_state::AppState;
13use crate::i18n::tr;
13use crate::theme;
14use crate::theme;
14
15
15const DIALOG_WIDTH: f32 = 480.;
16const DIALOG_WIDTH: f32 = 480.;
@@ -242,13 +243,13 @@ pub fn open_add_people(
242 let footer = DialogFooter::new()
243 let footer = DialogFooter::new()
243 .child(
244 .child(
244 Button::new("add-people-cancel")
245 Button::new("add-people-cancel")
245 .label("Cancel")
246 .label(tr("common.cancel"))
246 .on_click(|_, window, cx| window.close_dialog(cx)),
247 .on_click(|_, window, cx| window.close_dialog(cx)),
247 )
248 )
248 .child(
249 .child(
249 Button::new("add-people-confirm")
250 Button::new("add-people-confirm")
250 .primary()
251 .primary()
251 .label("Add")
252 .label(tr("common.add"))
252 .disabled(!can_add)
253 .disabled(!can_add)
253 .on_click(move |_, window, cx| {
254 .on_click(move |_, window, cx| {
254 submit_form.update(cx, |form, cx| form.submit(window, cx));
255 submit_form.update(cx, |form, cx| form.submit(window, cx));
crates/app/src/views/call_controls.rs +8 −11
@@ -11,6 +11,7 @@ use super::shortcuts::{StartAudioCall, StartVideoCall};
11 11 use super::widgets::{icon, menu_icon};
12 12 use crate::app_state::{AppState, Selection};
13 13 use crate::call::{is_echo_chat, plan_for_chat};
14 use crate::i18n::tr;
14 15 use crate::theme;
15 16
16 17 const BUTTON_SIZE: f32 = 30.;
@@ -20,10 +21,6 @@ const CHEVRON_WIDTH: f32 = 18.;
20 21 const CHEVRON_GLYPH: f32 = 12.;
21 22 pub const HEADER_VIDEO_CALL_TAG: &str = "header-video-call";
22 23 pub const HEADER_CALL_OPTIONS_TAG: &str = "header-call-options";
23 const VIDEO_CALL_LABEL: &str = "Video call";
24 const AUDIO_CALL_LABEL: &str = "Audio call";
25 const CALL_OPTIONS_LABEL: &str = "Call options";
26 const MEET_NOW_LABEL: &str = "Meet now";
27 24 const GROUP_KIND: &str = "group";
28 25 const MEETING_KIND: &str = "meeting";
29 26
@@ -67,7 +64,7 @@ pub fn header_call_controls(
67 64 .when(running, |button| {
68 65 button.child(icon(IconName::Phone, 14., foreground))
69 66 })
70 .child("Join")
67 .child(tr("common.join"))
71 68 .on_click(move |_, _, cx| {
72 69 join_app.update(cx, |state, cx| state.join_chat_meeting(&join_id, cx));
73 70 })
@@ -115,9 +112,9 @@ fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) ->
115 112 }
116 113 })
117 114 .tooltip(if meet_now {
118 MEET_NOW_LABEL
115 tr("calls.chrome.meet_now")
119 116 } else {
120 VIDEO_CALL_LABEL
117 tr("calls.chrome.video_call")
121 118 })
122 119 .debug_selector(|| HEADER_VIDEO_CALL_TAG.into())
123 120 .child(
@@ -131,7 +128,7 @@ fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) ->
131 128 .text_size(px(14.))
132 129 .font_weight(FontWeight::SEMIBOLD)
133 130 .text_color(theme::text())
134 .child(MEET_NOW_LABEL),
131 .child(tr("calls.chrome.meet_now")),
135 132 )
136 133 }),
137 134 )
@@ -143,7 +140,7 @@ fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) ->
143 140 .p_0()
144 141 .w(px(CHEVRON_WIDTH))
145 142 .h(px(BUTTON_SIZE))
146 .tooltip(CALL_OPTIONS_LABEL)
143 .tooltip(tr("calls.chrome.call_options"))
147 144 .debug_selector(|| HEADER_CALL_OPTIONS_TAG.into())
148 145 .child(icon(
149 146 IconName::ChevronDown,
@@ -156,14 +153,14 @@ fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) ->
156 153 popup
157 154 } else {
158 155 popup.item(
159 PopupMenuItem::new(VIDEO_CALL_LABEL)
156 PopupMenuItem::new(tr("calls.chrome.video_call"))
160 157 .icon(menu_icon(IconName::Video))
161 158 .action(Box::new(StartVideoCall))
162 159 .on_click(move |_, _, cx| start_call(&video, true, cx)),
163 160 )
164 161 };
165 162 popup.item(
166 PopupMenuItem::new(AUDIO_CALL_LABEL)
163 PopupMenuItem::new(tr("calls.chrome.audio_call"))
167 164 .icon(menu_icon(IconName::Phone))
168 165 .action(Box::new(StartAudioCall))
169 166 .on_click(move |_, _, cx| start_call(&audio, false, cx)),
@@ -11,6 +11,7 @@ use super::shortcuts::{StartAudioCall, StartVideoCall};
11use super::widgets::{icon, menu_icon};
11use super::widgets::{icon, menu_icon};
12use crate::app_state::{AppState, Selection};
12use crate::app_state::{AppState, Selection};
13use crate::call::{is_echo_chat, plan_for_chat};
13use crate::call::{is_echo_chat, plan_for_chat};
14use crate::i18n::tr;
14use crate::theme;
15use crate::theme;
15
16
16const BUTTON_SIZE: f32 = 30.;
17const BUTTON_SIZE: f32 = 30.;
@@ -20,10 +21,6 @@ const CHEVRON_WIDTH: f32 = 18.;
20const CHEVRON_GLYPH: f32 = 12.;
21const CHEVRON_GLYPH: f32 = 12.;
21pub const HEADER_VIDEO_CALL_TAG: &str = "header-video-call";
22pub const HEADER_VIDEO_CALL_TAG: &str = "header-video-call";
22pub const HEADER_CALL_OPTIONS_TAG: &str = "header-call-options";
23pub const HEADER_CALL_OPTIONS_TAG: &str = "header-call-options";
23const VIDEO_CALL_LABEL: &str = "Video call";
24const AUDIO_CALL_LABEL: &str = "Audio call";
25const CALL_OPTIONS_LABEL: &str = "Call options";
26const MEET_NOW_LABEL: &str = "Meet now";
27const GROUP_KIND: &str = "group";
24const GROUP_KIND: &str = "group";
28const MEETING_KIND: &str = "meeting";
25const MEETING_KIND: &str = "meeting";
29
26
@@ -67,7 +64,7 @@ pub fn header_call_controls(
67 .when(running, |button| {
64 .when(running, |button| {
68 button.child(icon(IconName::Phone, 14., foreground))
65 button.child(icon(IconName::Phone, 14., foreground))
69 })
66 })
70 .child("Join")
67 .child(tr("common.join"))
71 .on_click(move |_, _, cx| {
68 .on_click(move |_, _, cx| {
72 join_app.update(cx, |state, cx| state.join_chat_meeting(&join_id, cx));
69 join_app.update(cx, |state, cx| state.join_chat_meeting(&join_id, cx));
73 })
70 })
@@ -115,9 +112,9 @@ fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) ->
115 }
112 }
116 })
113 })
117 .tooltip(if meet_now {
114 .tooltip(if meet_now {
118 MEET_NOW_LABEL
115 tr("calls.chrome.meet_now")
119 } else {
116 } else {
120 VIDEO_CALL_LABEL
117 tr("calls.chrome.video_call")
121 })
118 })
122 .debug_selector(|| HEADER_VIDEO_CALL_TAG.into())
119 .debug_selector(|| HEADER_VIDEO_CALL_TAG.into())
123 .child(
120 .child(
@@ -131,7 +128,7 @@ fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) ->
131 .text_size(px(14.))
128 .text_size(px(14.))
132 .font_weight(FontWeight::SEMIBOLD)
129 .font_weight(FontWeight::SEMIBOLD)
133 .text_color(theme::text())
130 .text_color(theme::text())
134 .child(MEET_NOW_LABEL),
131 .child(tr("calls.chrome.meet_now")),
135 )
132 )
136 }),
133 }),
137 )
134 )
@@ -143,7 +140,7 @@ fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) ->
143 .p_0()
140 .p_0()
144 .w(px(CHEVRON_WIDTH))
141 .w(px(CHEVRON_WIDTH))
145 .h(px(BUTTON_SIZE))
142 .h(px(BUTTON_SIZE))
146 .tooltip(CALL_OPTIONS_LABEL)
143 .tooltip(tr("calls.chrome.call_options"))
147 .debug_selector(|| HEADER_CALL_OPTIONS_TAG.into())
144 .debug_selector(|| HEADER_CALL_OPTIONS_TAG.into())
148 .child(icon(
145 .child(icon(
149 IconName::ChevronDown,
146 IconName::ChevronDown,
@@ -156,14 +153,14 @@ fn video_split_button(app: &Entity<AppState>, meet_now: bool, compact: bool) ->
156 popup
153 popup
157 } else {
154 } else {
158 popup.item(
155 popup.item(
159 PopupMenuItem::new(VIDEO_CALL_LABEL)
156 PopupMenuItem::new(tr("calls.chrome.video_call"))
160 .icon(menu_icon(IconName::Video))
157 .icon(menu_icon(IconName::Video))
161 .action(Box::new(StartVideoCall))
158 .action(Box::new(StartVideoCall))
162 .on_click(move |_, _, cx| start_call(&video, true, cx)),
159 .on_click(move |_, _, cx| start_call(&video, true, cx)),
163 )
160 )
164 };
161 };
165 popup.item(
162 popup.item(
166 PopupMenuItem::new(AUDIO_CALL_LABEL)
163 PopupMenuItem::new(tr("calls.chrome.audio_call"))
167 .icon(menu_icon(IconName::Phone))
164 .icon(menu_icon(IconName::Phone))
168 .action(Box::new(StartAudioCall))
165 .action(Box::new(StartAudioCall))
169 .on_click(move |_, _, cx| start_call(&audio, false, cx)),
166 .on_click(move |_, _, cx| start_call(&audio, false, cx)),
crates/app/src/views/call_record.rs +2 −1
@@ -14,6 +14,7 @@ use crate::app_state::AppState;
14 14 use crate::call::{
15 15 CallModel, CaptionPosition, CaptionSize, RecordBlock, RecordFeature, record_actions,
16 16 };
17 use crate::i18n::tr;
17 18 use crate::theme;
18 19
19 20 const SETTINGS_WIDTH: f32 = 460.;
@@ -247,7 +248,7 @@ pub fn open_captions_settings(app: &Entity<AppState>, window: &mut Window, cx: &
247 248 DialogFooter::new().child(
248 249 Button::new("captions-settings-done")
249 250 .primary()
250 .label("Done")
251 .label(tr("common.done"))
251 252 .on_click(|_, window, cx| window.close_dialog(cx)),
252 253 ),
253 254 )
@@ -14,6 +14,7 @@ use crate::app_state::AppState;
14use crate::call::{
14use crate::call::{
15 CallModel, CaptionPosition, CaptionSize, RecordBlock, RecordFeature, record_actions,
15 CallModel, CaptionPosition, CaptionSize, RecordBlock, RecordFeature, record_actions,
16};
16};
17use crate::i18n::tr;
17use crate::theme;
18use crate::theme;
18
19
19const SETTINGS_WIDTH: f32 = 460.;
20const SETTINGS_WIDTH: f32 = 460.;
@@ -247,7 +248,7 @@ pub fn open_captions_settings(app: &Entity<AppState>, window: &mut Window, cx: &
247 DialogFooter::new().child(
248 DialogFooter::new().child(
248 Button::new("captions-settings-done")
249 Button::new("captions-settings-done")
249 .primary()
250 .primary()
250 .label("Done")
251 .label(tr("common.done"))
251 .on_click(|_, window, cx| window.close_dialog(cx)),
252 .on_click(|_, window, cx| window.close_dialog(cx)),
252 ),
253 ),
253 )
254 )
crates/app/src/views/calls_page.rs +17 −21
@@ -17,23 +17,15 @@ use crate::app_state::AppState;
17 17 use crate::call::{
18 18 CALL_ROW_HEIGHT, CallRow, EMPTY_HEIGHT, HistoryFilter, ListEntry, SpeedDialEntry,
19 19 };
20 use crate::i18n::tr;
20 21 use crate::theme;
21 22
22 23 pub const CALLS_DIAL_TAG: &str = "shell/islands/main/calls-dial";
23 24 pub const CALLS_HISTORY_TAG: &str = "shell/islands/main/calls-history";
24 25 pub const CALLS_SPEED_DIAL_TAG: &str = "shell/islands/main/calls-speed-dial";
25 26 const CALLS_SCROLL_DIVIDER: &str = "shell/islands/main/calls-history/divider-scroll";
26 const CALLS_TITLE: &str = "Calls";
27 const HISTORY_TITLE: &str = "History";
28 const SPEED_DIAL_TITLE: &str = "Speed dial";
29 const SPEED_DIAL_EMPTY: &str = "Add people to speed dial for quick access.";
30 const SPEED_DIAL_ADD_TITLE: &str = "Add to speed dial";
31 const ADD_LABEL: &str = "Add";
32 const CANCEL_LABEL: &str = "Cancel";
33 27 const SPEED_DIAL_WIDTH: f32 = 340.;
34 28 const SPEED_DIAL_MIN_WINDOW_WIDTH: f32 = 1100.;
35 const CALL_LABEL: &str = "Call";
36 const CALL_ONE_PERSON_HINT: &str = "Pick one person to call";
37 29 const HEADER_HEIGHT: f32 = 60.;
38 30 const PAGE_PADDING: f32 = 20.;
39 31 const DIAL_WIDTH: f32 = 340.;
@@ -163,7 +155,7 @@ fn call_row(
163 155 })
164 156 .when(can_add_to_speed_dial, |popup| {
165 157 popup.item(
166 PopupMenuItem::new(SPEED_DIAL_ADD_TITLE)
158 PopupMenuItem::new(tr("calls.page.speed_dial_add"))
167 159 .icon(menu_icon(IconName::Star))
168 160 .on_click(move |_, _, cx| {
169 161 let Some(user_id) = dial_row.user_id.as_deref() else {
@@ -384,14 +376,14 @@ impl CallsPage {
384 376 .justify_end()
385 377 .child(
386 378 Button::new("speed-dial-cancel")
387 .label(CANCEL_LABEL)
379 .label(tr("common.cancel"))
388 380 .on_click(cx.listener(|this, _, window, cx| {
389 381 this.close_speed_dial_add(window, cx)
390 382 })),
391 383 )
392 384 .child(
393 385 Button::new("speed-dial-confirm")
394 .label(ADD_LABEL)
386 .label(tr("common.add"))
395 387 .when(picked, |button| button.primary())
396 388 .disabled(!picked)
397 389 .on_click(cx.listener(|this, _, window, cx| {
@@ -411,11 +403,11 @@ impl CallsPage {
411 403 div()
412 404 .text_size(px(13.))
413 405 .text_color(theme::text_muted())
414 .child(SPEED_DIAL_EMPTY),
406 .child(tr("calls.page.speed_dial_empty")),
415 407 )
416 408 .child(
417 409 Button::new("speed-dial-empty-add")
418 .label(ADD_LABEL)
410 .label(tr("common.add"))
419 411 .on_click(
420 412 cx.listener(|this, _, window, cx| this.open_speed_dial_add(window, cx)),
421 413 ),
@@ -465,7 +457,7 @@ impl CallsPage {
465 457 .text_size(px(14.))
466 458 .font_weight(FontWeight::SEMIBOLD)
467 459 .text_color(theme::text())
468 .child(SPEED_DIAL_TITLE),
460 .child(tr("calls.page.speed_dial")),
469 461 )
470 462 .child(
471 463 div()
@@ -478,8 +470,10 @@ impl CallsPage {
478 470 .cursor_pointer()
479 471 .hover(|button| button.bg(theme::row_hover()))
480 472 .tooltip(|window, cx| {
481 gpui_kit::component::tooltip::Tooltip::new(SPEED_DIAL_ADD_TITLE)
482 .build(window, cx)
473 gpui_kit::component::tooltip::Tooltip::new(tr(
474 "calls.page.speed_dial_add",
475 ))
476 .build(window, cx)
483 477 })
484 478 .child(symbol("person_add", 18., theme::text_soft()))
485 479 .on_click(cx.listener(|this, _, window, cx| {
@@ -506,10 +500,12 @@ impl CallsPage {
506 500 .w_full()
507 501 .h(px(CALL_BUTTON_HEIGHT))
508 502 .icon(IconName::Phone)
509 .label(CALL_LABEL)
503 .label(tr("common.call"))
510 504 .when(callable, |button| button.primary())
511 505 .disabled(!callable)
512 .when(picked > 1, |button| button.tooltip(CALL_ONE_PERSON_HINT))
506 .when(picked > 1, |button| {
507 button.tooltip(tr("calls.page.pick_one"))
508 })
513 509 .on_click(cx.listener(|this, _, window, cx| this.call_picked(window, cx))),
514 510 )
515 511 }
@@ -575,7 +571,7 @@ impl CallsPage {
575 571 .text_size(px(14.))
576 572 .font_weight(FontWeight::SEMIBOLD)
577 573 .text_color(theme::text())
578 .child(HISTORY_TITLE),
574 .child(tr("calls.page.history")),
579 575 )
580 576 .child(history_filters(&self.app, filter)),
581 577 )
@@ -617,7 +613,7 @@ impl Render for CallsPage {
617 613 .text_size(px(16.))
618 614 .font_weight(FontWeight::BOLD)
619 615 .text_color(theme::text())
620 .child(CALLS_TITLE),
616 .child(tr("calls.page.title")),
621 617 ),
622 618 )
623 619 .child(div().w_full().h(px(1.)).flex_none().bg(theme::border()))
@@ -17,23 +17,15 @@ use crate::app_state::AppState;
17use crate::call::{
17use crate::call::{
18 CALL_ROW_HEIGHT, CallRow, EMPTY_HEIGHT, HistoryFilter, ListEntry, SpeedDialEntry,
18 CALL_ROW_HEIGHT, CallRow, EMPTY_HEIGHT, HistoryFilter, ListEntry, SpeedDialEntry,
19};
19};
20use crate::i18n::tr;
20use crate::theme;
21use crate::theme;
21
22
22pub const CALLS_DIAL_TAG: &str = "shell/islands/main/calls-dial";
23pub const CALLS_DIAL_TAG: &str = "shell/islands/main/calls-dial";
23pub const CALLS_HISTORY_TAG: &str = "shell/islands/main/calls-history";
24pub const CALLS_HISTORY_TAG: &str = "shell/islands/main/calls-history";
24pub const CALLS_SPEED_DIAL_TAG: &str = "shell/islands/main/calls-speed-dial";
25pub const CALLS_SPEED_DIAL_TAG: &str = "shell/islands/main/calls-speed-dial";
25const CALLS_SCROLL_DIVIDER: &str = "shell/islands/main/calls-history/divider-scroll";
26const CALLS_SCROLL_DIVIDER: &str = "shell/islands/main/calls-history/divider-scroll";
26const CALLS_TITLE: &str = "Calls";
27const HISTORY_TITLE: &str = "History";
28const SPEED_DIAL_TITLE: &str = "Speed dial";
29const SPEED_DIAL_EMPTY: &str = "Add people to speed dial for quick access.";
30const SPEED_DIAL_ADD_TITLE: &str = "Add to speed dial";
31const ADD_LABEL: &str = "Add";
32const CANCEL_LABEL: &str = "Cancel";
33const SPEED_DIAL_WIDTH: f32 = 340.;
27const SPEED_DIAL_WIDTH: f32 = 340.;
34const SPEED_DIAL_MIN_WINDOW_WIDTH: f32 = 1100.;
28const SPEED_DIAL_MIN_WINDOW_WIDTH: f32 = 1100.;
35const CALL_LABEL: &str = "Call";
36const CALL_ONE_PERSON_HINT: &str = "Pick one person to call";
37const HEADER_HEIGHT: f32 = 60.;
29const HEADER_HEIGHT: f32 = 60.;
38const PAGE_PADDING: f32 = 20.;
30const PAGE_PADDING: f32 = 20.;
39const DIAL_WIDTH: f32 = 340.;
31const DIAL_WIDTH: f32 = 340.;
@@ -163,7 +155,7 @@ fn call_row(
163 })
155 })
164 .when(can_add_to_speed_dial, |popup| {
156 .when(can_add_to_speed_dial, |popup| {
165 popup.item(
157 popup.item(
166 PopupMenuItem::new(SPEED_DIAL_ADD_TITLE)
158 PopupMenuItem::new(tr("calls.page.speed_dial_add"))
167 .icon(menu_icon(IconName::Star))
159 .icon(menu_icon(IconName::Star))
168 .on_click(move |_, _, cx| {
160 .on_click(move |_, _, cx| {
169 let Some(user_id) = dial_row.user_id.as_deref() else {
161 let Some(user_id) = dial_row.user_id.as_deref() else {
@@ -384,14 +376,14 @@ impl CallsPage {
384 .justify_end()
376 .justify_end()
385 .child(
377 .child(
386 Button::new("speed-dial-cancel")
378 Button::new("speed-dial-cancel")
387 .label(CANCEL_LABEL)
379 .label(tr("common.cancel"))
388 .on_click(cx.listener(|this, _, window, cx| {
380 .on_click(cx.listener(|this, _, window, cx| {
389 this.close_speed_dial_add(window, cx)
381 this.close_speed_dial_add(window, cx)
390 })),
382 })),
391 )
383 )
392 .child(
384 .child(
393 Button::new("speed-dial-confirm")
385 Button::new("speed-dial-confirm")
394 .label(ADD_LABEL)
386 .label(tr("common.add"))
395 .when(picked, |button| button.primary())
387 .when(picked, |button| button.primary())
396 .disabled(!picked)
388 .disabled(!picked)
397 .on_click(cx.listener(|this, _, window, cx| {
389 .on_click(cx.listener(|this, _, window, cx| {
@@ -411,11 +403,11 @@ impl CallsPage {
411 div()
403 div()
412 .text_size(px(13.))
404 .text_size(px(13.))
413 .text_color(theme::text_muted())
405 .text_color(theme::text_muted())
414 .child(SPEED_DIAL_EMPTY),
406 .child(tr("calls.page.speed_dial_empty")),
415 )
407 )
416 .child(
408 .child(
417 Button::new("speed-dial-empty-add")
409 Button::new("speed-dial-empty-add")
418 .label(ADD_LABEL)
410 .label(tr("common.add"))
419 .on_click(
411 .on_click(
420 cx.listener(|this, _, window, cx| this.open_speed_dial_add(window, cx)),
412 cx.listener(|this, _, window, cx| this.open_speed_dial_add(window, cx)),
421 ),
413 ),
@@ -465,7 +457,7 @@ impl CallsPage {
465 .text_size(px(14.))
457 .text_size(px(14.))
466 .font_weight(FontWeight::SEMIBOLD)
458 .font_weight(FontWeight::SEMIBOLD)
467 .text_color(theme::text())
459 .text_color(theme::text())
468 .child(SPEED_DIAL_TITLE),
460 .child(tr("calls.page.speed_dial")),
469 )
461 )
470 .child(
462 .child(
471 div()
463 div()
@@ -478,8 +470,10 @@ impl CallsPage {
478 .cursor_pointer()
470 .cursor_pointer()
479 .hover(|button| button.bg(theme::row_hover()))
471 .hover(|button| button.bg(theme::row_hover()))
480 .tooltip(|window, cx| {
472 .tooltip(|window, cx| {
481 gpui_kit::component::tooltip::Tooltip::new(SPEED_DIAL_ADD_TITLE)
473 gpui_kit::component::tooltip::Tooltip::new(tr(
482 .build(window, cx)
474 "calls.page.speed_dial_add",
475 ))
476 .build(window, cx)
483 })
477 })
484 .child(symbol("person_add", 18., theme::text_soft()))
478 .child(symbol("person_add", 18., theme::text_soft()))
485 .on_click(cx.listener(|this, _, window, cx| {
479 .on_click(cx.listener(|this, _, window, cx| {
@@ -506,10 +500,12 @@ impl CallsPage {
506 .w_full()
500 .w_full()
507 .h(px(CALL_BUTTON_HEIGHT))
501 .h(px(CALL_BUTTON_HEIGHT))
508 .icon(IconName::Phone)
502 .icon(IconName::Phone)
509 .label(CALL_LABEL)
503 .label(tr("common.call"))
510 .when(callable, |button| button.primary())
504 .when(callable, |button| button.primary())
511 .disabled(!callable)
505 .disabled(!callable)
512 .when(picked > 1, |button| button.tooltip(CALL_ONE_PERSON_HINT))
506 .when(picked > 1, |button| {
507 button.tooltip(tr("calls.page.pick_one"))
508 })
513 .on_click(cx.listener(|this, _, window, cx| this.call_picked(window, cx))),
509 .on_click(cx.listener(|this, _, window, cx| this.call_picked(window, cx))),
514 )
510 )
515 }
511 }
@@ -575,7 +571,7 @@ impl CallsPage {
575 .text_size(px(14.))
571 .text_size(px(14.))
576 .font_weight(FontWeight::SEMIBOLD)
572 .font_weight(FontWeight::SEMIBOLD)
577 .text_color(theme::text())
573 .text_color(theme::text())
578 .child(HISTORY_TITLE),
574 .child(tr("calls.page.history")),
579 )
575 )
580 .child(history_filters(&self.app, filter)),
576 .child(history_filters(&self.app, filter)),
581 )
577 )
@@ -617,7 +613,7 @@ impl Render for CallsPage {
617 .text_size(px(16.))
613 .text_size(px(16.))
618 .font_weight(FontWeight::BOLD)
614 .font_weight(FontWeight::BOLD)
619 .text_color(theme::text())
615 .text_color(theme::text())
620 .child(CALLS_TITLE),
616 .child(tr("calls.page.title")),
621 ),
617 ),
622 )
618 )
623 .child(div().w_full().h(px(1.)).flex_none().bg(theme::border()))
619 .child(div().w_full().h(px(1.)).flex_none().bg(theme::border()))
crates/app/src/views/channel_admin_dialogs.rs +5 −4
@@ -7,6 +7,7 @@ use gpui_kit::*;
7 7
8 8 use super::new_meeting_dialog::labeled;
9 9 use crate::app_state::AppState;
10 use crate::i18n::tr;
10 11 use crate::team_admin::{can_create_channel, channel_name_problem};
11 12 use crate::theme;
12 13
@@ -156,13 +157,13 @@ pub fn open_edit_channel_dialog(
156 157 let footer = DialogFooter::new()
157 158 .child(
158 159 Button::new("edit-channel-cancel")
159 .label("Cancel")
160 .label(tr("common.cancel"))
160 161 .on_click(|_, window, cx| window.close_dialog(cx)),
161 162 )
162 163 .child(
163 164 Button::new("edit-channel-save")
164 165 .primary()
165 .label("Save")
166 .label(tr("common.save"))
166 167 .disabled(!can_save)
167 168 .on_click(move |_, window, cx| {
168 169 if submit_form.update(cx, |form, cx| form.submit(cx)) {
@@ -207,10 +208,10 @@ pub fn confirm_delete_channel(
207 208 window.open_alert_dialog(cx, move |alert, _, _| {
208 209 let (state, channel_id) = (state.clone(), channel_id.clone());
209 210 let cancel = Button::new("delete-channel-cancel")
210 .label("Cancel")
211 .label(tr("common.cancel"))
211 212 .on_click(|_, window, cx| window.close_dialog(cx));
212 213 let delete = Button::new("delete-channel-confirm")
213 .label("Delete")
214 .label(tr("common.delete"))
214 215 .danger()
215 216 .on_click(move |_, window, cx| {
216 217 state.update(cx, |state, cx| state.delete_channel(&channel_id, cx));
@@ -7,6 +7,7 @@ use gpui_kit::*;
7
7
8use super::new_meeting_dialog::labeled;
8use super::new_meeting_dialog::labeled;
9use crate::app_state::AppState;
9use crate::app_state::AppState;
10use crate::i18n::tr;
10use crate::team_admin::{can_create_channel, channel_name_problem};
11use crate::team_admin::{can_create_channel, channel_name_problem};
11use crate::theme;
12use crate::theme;
12
13
@@ -156,13 +157,13 @@ pub fn open_edit_channel_dialog(
156 let footer = DialogFooter::new()
157 let footer = DialogFooter::new()
157 .child(
158 .child(
158 Button::new("edit-channel-cancel")
159 Button::new("edit-channel-cancel")
159 .label("Cancel")
160 .label(tr("common.cancel"))
160 .on_click(|_, window, cx| window.close_dialog(cx)),
161 .on_click(|_, window, cx| window.close_dialog(cx)),
161 )
162 )
162 .child(
163 .child(
163 Button::new("edit-channel-save")
164 Button::new("edit-channel-save")
164 .primary()
165 .primary()
165 .label("Save")
166 .label(tr("common.save"))
166 .disabled(!can_save)
167 .disabled(!can_save)
167 .on_click(move |_, window, cx| {
168 .on_click(move |_, window, cx| {
168 if submit_form.update(cx, |form, cx| form.submit(cx)) {
169 if submit_form.update(cx, |form, cx| form.submit(cx)) {
@@ -207,10 +208,10 @@ pub fn confirm_delete_channel(
207 window.open_alert_dialog(cx, move |alert, _, _| {
208 window.open_alert_dialog(cx, move |alert, _, _| {
208 let (state, channel_id) = (state.clone(), channel_id.clone());
209 let (state, channel_id) = (state.clone(), channel_id.clone());
209 let cancel = Button::new("delete-channel-cancel")
210 let cancel = Button::new("delete-channel-cancel")
210 .label("Cancel")
211 .label(tr("common.cancel"))
211 .on_click(|_, window, cx| window.close_dialog(cx));
212 .on_click(|_, window, cx| window.close_dialog(cx));
212 let delete = Button::new("delete-channel-confirm")
213 let delete = Button::new("delete-channel-confirm")
213 .label("Delete")
214 .label(tr("common.delete"))
214 .danger()
215 .danger()
215 .on_click(move |_, window, cx| {
216 .on_click(move |_, window, cx| {
216 state.update(cx, |state, cx| state.delete_channel(&channel_id, cx));
217 state.update(cx, |state, cx| state.delete_channel(&channel_id, cx));
crates/app/src/views/chat_members.rs +3 −2
@@ -20,6 +20,7 @@ use crate::app_state::AppState;
20 20 use crate::chat_actions::TITLE_LIMIT;
21 21 use crate::chat_members::{MemberRow, can_leave, member_rows};
22 22 use crate::data::Directory;
23 use crate::i18n::tr;
23 24 use crate::notice::truncated;
24 25 use crate::theme;
25 26
@@ -293,10 +294,10 @@ fn confirm_remove(
293 294 window.open_alert_dialog(cx, move |alert, _, _| {
294 295 let (app, chat_id, user_id) = (app.clone(), chat_id.clone(), user_id.clone());
295 296 let cancel = Button::new("remove-member-cancel")
296 .label("Cancel")
297 .label(tr("common.cancel"))
297 298 .on_click(|_, window, cx| window.close_dialog(cx));
298 299 let remove = Button::new("remove-member-confirm")
299 .label("Remove")
300 .label(tr("common.remove"))
300 301 .danger()
301 302 .on_click(move |_, window, cx| {
302 303 app.update(cx, |state, cx| {
@@ -20,6 +20,7 @@ use crate::app_state::AppState;
20use crate::chat_actions::TITLE_LIMIT;
20use crate::chat_actions::TITLE_LIMIT;
21use crate::chat_members::{MemberRow, can_leave, member_rows};
21use crate::chat_members::{MemberRow, can_leave, member_rows};
22use crate::data::Directory;
22use crate::data::Directory;
23use crate::i18n::tr;
23use crate::notice::truncated;
24use crate::notice::truncated;
24use crate::theme;
25use crate::theme;
25
26
@@ -293,10 +294,10 @@ fn confirm_remove(
293 window.open_alert_dialog(cx, move |alert, _, _| {
294 window.open_alert_dialog(cx, move |alert, _, _| {
294 let (app, chat_id, user_id) = (app.clone(), chat_id.clone(), user_id.clone());
295 let (app, chat_id, user_id) = (app.clone(), chat_id.clone(), user_id.clone());
295 let cancel = Button::new("remove-member-cancel")
296 let cancel = Button::new("remove-member-cancel")
296 .label("Cancel")
297 .label(tr("common.cancel"))
297 .on_click(|_, window, cx| window.close_dialog(cx));
298 .on_click(|_, window, cx| window.close_dialog(cx));
298 let remove = Button::new("remove-member-confirm")
299 let remove = Button::new("remove-member-confirm")
299 .label("Remove")
300 .label(tr("common.remove"))
300 .danger()
301 .danger()
301 .on_click(move |_, window, cx| {
302 .on_click(move |_, window, cx| {
302 app.update(cx, |state, cx| {
303 app.update(cx, |state, cx| {
crates/app/src/views/chat_menu.rs +5 −4
@@ -10,6 +10,7 @@ use super::chat_pop_out;
10 10 use super::widgets::menu_icon;
11 11 use crate::app_state::{AppState, chat_title};
12 12 use crate::chat_actions::TITLE_LIMIT;
13 use crate::i18n::tr;
13 14 use crate::notice::truncated;
14 15 use crate::presence_follow::{NOTIFY_WHEN_AVAILABLE, TURN_OFF_NOTIFICATIONS};
15 16 use crate::theme;
@@ -335,10 +336,10 @@ fn confirm_remove_history(
335 336 let state = state.clone();
336 337 let chat_id = chat_id.clone();
337 338 let cancel = Button::new("remove-history-cancel")
338 .label("Cancel")
339 .label(tr("common.cancel"))
339 340 .on_click(|_, window, cx| window.close_dialog(cx));
340 341 let remove = Button::new("remove-history-confirm")
341 .label("Remove")
342 .label(tr("common.remove"))
342 343 .primary()
343 344 .on_click(move |_, window, cx| {
344 345 state.update(cx, |state, cx| state.remove_chat_history(&chat_id, cx));
@@ -368,10 +369,10 @@ pub(crate) fn confirm_leave(
368 369 let state = state.clone();
369 370 let chat_id = chat_id.clone();
370 371 let cancel = Button::new("leave-cancel")
371 .label("Cancel")
372 .label(tr("common.cancel"))
372 373 .on_click(|_, window, cx| window.close_dialog(cx));
373 374 let leave = Button::new("leave-confirm")
374 .label("Leave")
375 .label(tr("common.leave"))
375 376 .danger()
376 377 .on_click(move |_, window, cx| {
377 378 state.update(cx, |state, cx| state.leave_chat(&chat_id, cx));
@@ -10,6 +10,7 @@ use super::chat_pop_out;
10use super::widgets::menu_icon;
10use super::widgets::menu_icon;
11use crate::app_state::{AppState, chat_title};
11use crate::app_state::{AppState, chat_title};
12use crate::chat_actions::TITLE_LIMIT;
12use crate::chat_actions::TITLE_LIMIT;
13use crate::i18n::tr;
13use crate::notice::truncated;
14use crate::notice::truncated;
14use crate::presence_follow::{NOTIFY_WHEN_AVAILABLE, TURN_OFF_NOTIFICATIONS};
15use crate::presence_follow::{NOTIFY_WHEN_AVAILABLE, TURN_OFF_NOTIFICATIONS};
15use crate::theme;
16use crate::theme;
@@ -335,10 +336,10 @@ fn confirm_remove_history(
335 let state = state.clone();
336 let state = state.clone();
336 let chat_id = chat_id.clone();
337 let chat_id = chat_id.clone();
337 let cancel = Button::new("remove-history-cancel")
338 let cancel = Button::new("remove-history-cancel")
338 .label("Cancel")
339 .label(tr("common.cancel"))
339 .on_click(|_, window, cx| window.close_dialog(cx));
340 .on_click(|_, window, cx| window.close_dialog(cx));
340 let remove = Button::new("remove-history-confirm")
341 let remove = Button::new("remove-history-confirm")
341 .label("Remove")
342 .label(tr("common.remove"))
342 .primary()
343 .primary()
343 .on_click(move |_, window, cx| {
344 .on_click(move |_, window, cx| {
344 state.update(cx, |state, cx| state.remove_chat_history(&chat_id, cx));
345 state.update(cx, |state, cx| state.remove_chat_history(&chat_id, cx));
@@ -368,10 +369,10 @@ pub(crate) fn confirm_leave(
368 let state = state.clone();
369 let state = state.clone();
369 let chat_id = chat_id.clone();
370 let chat_id = chat_id.clone();
370 let cancel = Button::new("leave-cancel")
371 let cancel = Button::new("leave-cancel")
371 .label("Cancel")
372 .label(tr("common.cancel"))
372 .on_click(|_, window, cx| window.close_dialog(cx));
373 .on_click(|_, window, cx| window.close_dialog(cx));
373 let leave = Button::new("leave-confirm")
374 let leave = Button::new("leave-confirm")
374 .label("Leave")
375 .label(tr("common.leave"))
375 .danger()
376 .danger()
376 .on_click(move |_, window, cx| {
377 .on_click(move |_, window, cx| {
377 state.update(cx, |state, cx| state.leave_chat(&chat_id, cx));
378 state.update(cx, |state, cx| state.leave_chat(&chat_id, cx));
crates/app/src/views/composer/cloud_picker.rs +9 −4
@@ -8,6 +8,7 @@ use gpui_kit::*;
8 8 use teams_core::{CloudFile, DriveEntry, DriveFolder, QuickSite};
9 9
10 10 use crate::app_state::AppState;
11 use crate::i18n::tr;
11 12 use crate::runtime;
12 13 use crate::theme::{self, ElevatedSurface as _};
13 14 use crate::views::shared_tab::{entry_badge, modified_text};
@@ -638,13 +639,17 @@ impl Render for CloudPicker {
638 639 .child(
639 640 Button::new("cloud-picker-attach")
640 641 .primary()
641 .label("Attach")
642 .label(tr("common.attach"))
642 643 .disabled(!can_attach)
643 644 .on_click(cx.listener(|this, _, _, cx| this.attach(cx))),
644 645 )
645 .child(Button::new("cloud-picker-cancel").label("Cancel").on_click(
646 cx.listener(|_, _, _, cx| cx.emit(CloudPickerEvent::Close)),
647 )),
646 .child(
647 Button::new("cloud-picker-cancel")
648 .label(tr("common.cancel"))
649 .on_click(
650 cx.listener(|_, _, _, cx| cx.emit(CloudPickerEvent::Close)),
651 ),
652 ),
648 653 ),
649 654 );
650 655 deferred(
@@ -8,6 +8,7 @@ use gpui_kit::*;
8use teams_core::{CloudFile, DriveEntry, DriveFolder, QuickSite};
8use teams_core::{CloudFile, DriveEntry, DriveFolder, QuickSite};
9
9
10use crate::app_state::AppState;
10use crate::app_state::AppState;
11use crate::i18n::tr;
11use crate::runtime;
12use crate::runtime;
12use crate::theme::{self, ElevatedSurface as _};
13use crate::theme::{self, ElevatedSurface as _};
13use crate::views::shared_tab::{entry_badge, modified_text};
14use crate::views::shared_tab::{entry_badge, modified_text};
@@ -638,13 +639,17 @@ impl Render for CloudPicker {
638 .child(
639 .child(
639 Button::new("cloud-picker-attach")
640 Button::new("cloud-picker-attach")
640 .primary()
641 .primary()
641 .label("Attach")
642 .label(tr("common.attach"))
642 .disabled(!can_attach)
643 .disabled(!can_attach)
643 .on_click(cx.listener(|this, _, _, cx| this.attach(cx))),
644 .on_click(cx.listener(|this, _, _, cx| this.attach(cx))),
644 )
645 )
645 .child(Button::new("cloud-picker-cancel").label("Cancel").on_click(
646 .child(
646 cx.listener(|_, _, _, cx| cx.emit(CloudPickerEvent::Close)),
647 Button::new("cloud-picker-cancel")
647 )),
648 .label(tr("common.cancel"))
649 .on_click(
650 cx.listener(|_, _, _, cx| cx.emit(CloudPickerEvent::Close)),
651 ),
652 ),
648 ),
653 ),
649 );
654 );
650 deferred(
655 deferred(
crates/app/src/views/conversation.rs +9 −2
@@ -85,6 +85,7 @@ use crate::demo_library::DemoLibrary;
85 85 use crate::downloads::{self, ClickAction, DownloadKey, Downloads, PartFile, RevealTarget};
86 86 use crate::emoji;
87 87 use crate::emoticons;
88 use crate::i18n::tr;
88 89 use crate::image_view_gallery::{ViewerRequest, collect_gallery, position_of};
89 90 use crate::notice::short_error;
90 91 use crate::outbox::{Delivered, deliver, new_outbox_id, outbox_record, outgoing_of};
@@ -2894,6 +2895,12 @@ impl ConversationView {
2894 2895 } else if target.as_deref() == Some(key) {
2895 2896 *target = None;
2896 2897 }
2898 if !hovered
2899 && matches!(slot, HoverSlot::Row)
2900 && self.toolbar_hovered.as_deref() == Some(key)
2901 {
2902 self.toolbar_hovered = None;
2903 }
2897 2904 if hovered
2898 2905 && matches!(slot, HoverSlot::Row)
2899 2906 && self
@@ -3713,7 +3720,7 @@ impl ConversationView {
3713 3720 Button::new("retry-new-chat")
3714 3721 .ghost()
3715 3722 .compact()
3716 .label("Retry")
3723 .label(tr("common.retry"))
3717 3724 .on_click(cx.listener(move |this, _, window, cx| {
3718 3725 this.retry(&failed_key, window, cx)
3719 3726 })),
@@ -4271,7 +4278,7 @@ impl Render for ConversationView {
4271 4278 Button::new("retry-fetch")
4272 4279 .ghost()
4273 4280 .compact()
4274 .label("Retry")
4281 .label(tr("common.retry"))
4275 4282 .on_click(cx.listener(|this, _, _, cx| this.retry_fetch(cx))),
4276 4283 )
4277 4284 }),
@@ -85,6 +85,7 @@ use crate::demo_library::DemoLibrary;
85use crate::downloads::{self, ClickAction, DownloadKey, Downloads, PartFile, RevealTarget};
85use crate::downloads::{self, ClickAction, DownloadKey, Downloads, PartFile, RevealTarget};
86use crate::emoji;
86use crate::emoji;
87use crate::emoticons;
87use crate::emoticons;
88use crate::i18n::tr;
88use crate::image_view_gallery::{ViewerRequest, collect_gallery, position_of};
89use crate::image_view_gallery::{ViewerRequest, collect_gallery, position_of};
89use crate::notice::short_error;
90use crate::notice::short_error;
90use crate::outbox::{Delivered, deliver, new_outbox_id, outbox_record, outgoing_of};
91use crate::outbox::{Delivered, deliver, new_outbox_id, outbox_record, outgoing_of};
@@ -2894,6 +2895,12 @@ impl ConversationView {
2894 } else if target.as_deref() == Some(key) {
2895 } else if target.as_deref() == Some(key) {
2895 *target = None;
2896 *target = None;
2896 }
2897 }
2898 if !hovered
2899 && matches!(slot, HoverSlot::Row)
2900 && self.toolbar_hovered.as_deref() == Some(key)
2901 {
2902 self.toolbar_hovered = None;
2903 }
2897 if hovered
2904 if hovered
2898 && matches!(slot, HoverSlot::Row)
2905 && matches!(slot, HoverSlot::Row)
2899 && self
2906 && self
@@ -3713,7 +3720,7 @@ impl ConversationView {
3713 Button::new("retry-new-chat")
3720 Button::new("retry-new-chat")
3714 .ghost()
3721 .ghost()
3715 .compact()
3722 .compact()
3716 .label("Retry")
3723 .label(tr("common.retry"))
3717 .on_click(cx.listener(move |this, _, window, cx| {
3724 .on_click(cx.listener(move |this, _, window, cx| {
3718 this.retry(&failed_key, window, cx)
3725 this.retry(&failed_key, window, cx)
3719 })),
3726 })),
@@ -4271,7 +4278,7 @@ impl Render for ConversationView {
4271 Button::new("retry-fetch")
4278 Button::new("retry-fetch")
4272 .ghost()
4279 .ghost()
4273 .compact()
4280 .compact()
4274 .label("Retry")
4281 .label(tr("common.retry"))
4275 .on_click(cx.listener(|this, _, _, cx| this.retry_fetch(cx))),
4282 .on_click(cx.listener(|this, _, _, cx| this.retry_fetch(cx))),
4276 )
4283 )
4277 }),
4284 }),
crates/app/src/views/conversation/feed.rs +2 −1
@@ -11,6 +11,7 @@ use gpui_kit::component::{
11 11 use gpui_kit::*;
12 12
13 13 use super::{ConversationView, ViewMode};
14 use crate::i18n::tr;
14 15 use crate::notice::short_error;
15 16 use crate::rows::Row;
16 17 use crate::runtime;
@@ -323,7 +324,7 @@ impl ConversationView {
323 324 Button::new("cancel-new-post")
324 325 .ghost()
325 326 .compact()
326 .label("Cancel")
327 .label(tr("common.cancel"))
327 328 .on_click(
328 329 cx.listener(|this, _, window, cx| this.cancel_new_post(window, cx)),
329 330 ),
@@ -11,6 +11,7 @@ use gpui_kit::component::{
11use gpui_kit::*;
11use gpui_kit::*;
12
12
13use super::{ConversationView, ViewMode};
13use super::{ConversationView, ViewMode};
14use crate::i18n::tr;
14use crate::notice::short_error;
15use crate::notice::short_error;
15use crate::rows::Row;
16use crate::rows::Row;
16use crate::runtime;
17use crate::runtime;
@@ -323,7 +324,7 @@ impl ConversationView {
323 Button::new("cancel-new-post")
324 Button::new("cancel-new-post")
324 .ghost()
325 .ghost()
325 .compact()
326 .compact()
326 .label("Cancel")
327 .label(tr("common.cancel"))
327 .on_click(
328 .on_click(
328 cx.listener(|this, _, window, cx| this.cancel_new_post(window, cx)),
329 cx.listener(|this, _, window, cx| this.cancel_new_post(window, cx)),
329 ),
330 ),
crates/app/src/views/conversation/pins.rs +2 −1
@@ -11,6 +11,7 @@ use gpui_kit::component::dialog::DialogFooter;
11 11
12 12 use crate::app_state::{AppState, Selection, selection_title};
13 13 use crate::channel_menu::post_pin_dialog;
14 use crate::i18n::tr;
14 15 use crate::post_follow::post_followed;
15 16 use crate::rows::{Row, reply_excerpt};
16 17 use crate::runtime;
@@ -46,7 +47,7 @@ fn confirm_post_pin(
46 47 let (state, channel_id, message_id) =
47 48 (state.clone(), channel_id.clone(), message_id.clone());
48 49 let cancel = Button::new("post-pin-cancel")
49 .label("Cancel")
50 .label(tr("common.cancel"))
50 51 .on_click(|_, window, cx| window.close_dialog(cx));
51 52 let confirm = Button::new("post-pin-confirm")
52 53 .label(dialog.confirm)
@@ -11,6 +11,7 @@ use gpui_kit::component::dialog::DialogFooter;
11
11
12use crate::app_state::{AppState, Selection, selection_title};
12use crate::app_state::{AppState, Selection, selection_title};
13use crate::channel_menu::post_pin_dialog;
13use crate::channel_menu::post_pin_dialog;
14use crate::i18n::tr;
14use crate::post_follow::post_followed;
15use crate::post_follow::post_followed;
15use crate::rows::{Row, reply_excerpt};
16use crate::rows::{Row, reply_excerpt};
16use crate::runtime;
17use crate::runtime;
@@ -46,7 +47,7 @@ fn confirm_post_pin(
46 let (state, channel_id, message_id) =
47 let (state, channel_id, message_id) =
47 (state.clone(), channel_id.clone(), message_id.clone());
48 (state.clone(), channel_id.clone(), message_id.clone());
48 let cancel = Button::new("post-pin-cancel")
49 let cancel = Button::new("post-pin-cancel")
49 .label("Cancel")
50 .label(tr("common.cancel"))
50 .on_click(|_, window, cx| window.close_dialog(cx));
51 .on_click(|_, window, cx| window.close_dialog(cx));
51 let confirm = Button::new("post-pin-confirm")
52 let confirm = Button::new("post-pin-confirm")
52 .label(dialog.confirm)
53 .label(dialog.confirm)
crates/app/src/views/conversation/recap.rs +3 −2
@@ -19,6 +19,7 @@ use crate::app_state::{AppState, Selection};
19 19 use crate::channel_files::SharedContent;
20 20 use crate::demo_recap;
21 21 use crate::downloads::{self, DownloadState};
22 use crate::i18n::tr;
22 23 use crate::notice::short_error;
23 24 use crate::recap::{DELETE_QUESTION, Load, save_name};
24 25 use crate::rows::{MeetingInfo, MeetingSlot};
@@ -480,10 +481,10 @@ impl ConversationView {
480 481 window.open_alert_dialog(cx, move |alert, _, _| {
481 482 let view = view.clone();
482 483 let cancel = Button::new("recap-delete-cancel")
483 .label("Cancel")
484 .label(tr("common.cancel"))
484 485 .on_click(|_, window, cx| window.close_dialog(cx));
485 486 let delete = Button::new("recap-delete-confirm")
486 .label("Delete")
487 .label(tr("common.delete"))
487 488 .danger()
488 489 .on_click(move |_, window, cx| {
489 490 view.update(cx, |this, cx| this.delete_recording(cx)).ok();
@@ -19,6 +19,7 @@ use crate::app_state::{AppState, Selection};
19use crate::channel_files::SharedContent;
19use crate::channel_files::SharedContent;
20use crate::demo_recap;
20use crate::demo_recap;
21use crate::downloads::{self, DownloadState};
21use crate::downloads::{self, DownloadState};
22use crate::i18n::tr;
22use crate::notice::short_error;
23use crate::notice::short_error;
23use crate::recap::{DELETE_QUESTION, Load, save_name};
24use crate::recap::{DELETE_QUESTION, Load, save_name};
24use crate::rows::{MeetingInfo, MeetingSlot};
25use crate::rows::{MeetingInfo, MeetingSlot};
@@ -480,10 +481,10 @@ impl ConversationView {
480 window.open_alert_dialog(cx, move |alert, _, _| {
481 window.open_alert_dialog(cx, move |alert, _, _| {
481 let view = view.clone();
482 let view = view.clone();
482 let cancel = Button::new("recap-delete-cancel")
483 let cancel = Button::new("recap-delete-cancel")
483 .label("Cancel")
484 .label(tr("common.cancel"))
484 .on_click(|_, window, cx| window.close_dialog(cx));
485 .on_click(|_, window, cx| window.close_dialog(cx));
485 let delete = Button::new("recap-delete-confirm")
486 let delete = Button::new("recap-delete-confirm")
486 .label("Delete")
487 .label(tr("common.delete"))
487 .danger()
488 .danger()
488 .on_click(move |_, window, cx| {
489 .on_click(move |_, window, cx| {
489 view.update(cx, |this, cx| this.delete_recording(cx)).ok();
490 view.update(cx, |this, cx| this.delete_recording(cx)).ok();
crates/app/src/views/create_channel_dialog.rs +3 −2
@@ -9,6 +9,7 @@ use teams_core::ChannelPrivacy;
9 9
10 10 use super::new_meeting_dialog::labeled;
11 11 use crate::app_state::AppState;
12 use crate::i18n::tr;
12 13 use crate::team_admin::{can_create_channel, channel_name_problem};
13 14 use crate::theme;
14 15
@@ -166,13 +167,13 @@ pub fn open_create_channel_dialog(
166 167 let footer = DialogFooter::new()
167 168 .child(
168 169 Button::new("create-channel-cancel")
169 .label("Cancel")
170 .label(tr("common.cancel"))
170 171 .on_click(|_, window, cx| window.close_dialog(cx)),
171 172 )
172 173 .child(
173 174 Button::new("create-channel-confirm")
174 175 .primary()
175 .label("Create")
176 .label(tr("common.create"))
176 177 .disabled(!can_create)
177 178 .on_click(move |_, window, cx| {
178 179 if submit_form.update(cx, |form, cx| form.submit(cx)) {
@@ -9,6 +9,7 @@ use teams_core::ChannelPrivacy;
9
9
10use super::new_meeting_dialog::labeled;
10use super::new_meeting_dialog::labeled;
11use crate::app_state::AppState;
11use crate::app_state::AppState;
12use crate::i18n::tr;
12use crate::team_admin::{can_create_channel, channel_name_problem};
13use crate::team_admin::{can_create_channel, channel_name_problem};
13use crate::theme;
14use crate::theme;
14
15
@@ -166,13 +167,13 @@ pub fn open_create_channel_dialog(
166 let footer = DialogFooter::new()
167 let footer = DialogFooter::new()
167 .child(
168 .child(
168 Button::new("create-channel-cancel")
169 Button::new("create-channel-cancel")
169 .label("Cancel")
170 .label(tr("common.cancel"))
170 .on_click(|_, window, cx| window.close_dialog(cx)),
171 .on_click(|_, window, cx| window.close_dialog(cx)),
171 )
172 )
172 .child(
173 .child(
173 Button::new("create-channel-confirm")
174 Button::new("create-channel-confirm")
174 .primary()
175 .primary()
175 .label("Create")
176 .label(tr("common.create"))
176 .disabled(!can_create)
177 .disabled(!can_create)
177 .on_click(move |_, window, cx| {
178 .on_click(move |_, window, cx| {
178 if submit_form.update(cx, |form, cx| form.submit(cx)) {
179 if submit_form.update(cx, |form, cx| form.submit(cx)) {
crates/app/src/views/customize_reactions.rs +3 −2
@@ -18,6 +18,7 @@ use crate::default_reactions::{
18 18 };
19 19 use crate::emoji;
20 20 use crate::emoticons::{SKIN_TONE_COUNT, with_tone};
21 use crate::i18n::tr;
21 22 use crate::theme;
22 23
23 24 pub const CUSTOMIZE_TOOLTIP: &str = "Customise default reactions";
@@ -252,13 +253,13 @@ pub fn open_customize_reactions(state: Entity<AppState>, window: &mut Window, cx
252 253 let footer = DialogFooter::new()
253 254 .child(
254 255 Button::new("customize-reactions-cancel")
255 .label("Cancel")
256 .label(tr("common.cancel"))
256 257 .on_click(|_, window, cx| window.close_dialog(cx)),
257 258 )
258 259 .child(
259 260 Button::new("customize-reactions-save")
260 261 .primary()
261 .label("Save")
262 .label(tr("common.save"))
262 263 .disabled(unchanged)
263 264 .on_click(move |_, window, cx| {
264 265 submit_form.update(cx, |form, cx| form.save(window, cx));
@@ -18,6 +18,7 @@ use crate::default_reactions::{
18};
18};
19use crate::emoji;
19use crate::emoji;
20use crate::emoticons::{SKIN_TONE_COUNT, with_tone};
20use crate::emoticons::{SKIN_TONE_COUNT, with_tone};
21use crate::i18n::tr;
21use crate::theme;
22use crate::theme;
22
23
23pub const CUSTOMIZE_TOOLTIP: &str = "Customise default reactions";
24pub const CUSTOMIZE_TOOLTIP: &str = "Customise default reactions";
@@ -252,13 +253,13 @@ pub fn open_customize_reactions(state: Entity<AppState>, window: &mut Window, cx
252 let footer = DialogFooter::new()
253 let footer = DialogFooter::new()
253 .child(
254 .child(
254 Button::new("customize-reactions-cancel")
255 Button::new("customize-reactions-cancel")
255 .label("Cancel")
256 .label(tr("common.cancel"))
256 .on_click(|_, window, cx| window.close_dialog(cx)),
257 .on_click(|_, window, cx| window.close_dialog(cx)),
257 )
258 )
258 .child(
259 .child(
259 Button::new("customize-reactions-save")
260 Button::new("customize-reactions-save")
260 .primary()
261 .primary()
261 .label("Save")
262 .label(tr("common.save"))
262 .disabled(unchanged)
263 .disabled(unchanged)
263 .on_click(move |_, window, cx| {
264 .on_click(move |_, window, cx| {
264 submit_form.update(cx, |form, cx| form.save(window, cx));
265 submit_form.update(cx, |form, cx| form.save(window, cx));
crates/app/src/views/forward_dialog.rs +2 −1
@@ -13,6 +13,7 @@ use super::switcher::{Candidate, candidate_avatar, clamp_highlight};
13 13 use super::widgets::{icon, symbol};
14 14 use crate::app_state::{AppState, Selection};
15 15 use crate::fuzzy;
16 use crate::i18n::tr;
16 17 use crate::message_actions::{ForwardItem, ForwardSource};
17 18 use crate::notice::short_error;
18 19 use crate::runtime;
@@ -527,7 +528,7 @@ impl Render for ForwardDialog {
527 528 .child(
528 529 Button::new("forward-cancel")
529 530 .ghost()
530 .label("Cancel")
531 .label(tr("common.cancel"))
531 532 .on_click(cx.listener(|_, _, _, cx| {
532 533 cx.emit(ForwardDialogEvent::Close)
533 534 })),
@@ -13,6 +13,7 @@ use super::switcher::{Candidate, candidate_avatar, clamp_highlight};
13use super::widgets::{icon, symbol};
13use super::widgets::{icon, symbol};
14use crate::app_state::{AppState, Selection};
14use crate::app_state::{AppState, Selection};
15use crate::fuzzy;
15use crate::fuzzy;
16use crate::i18n::tr;
16use crate::message_actions::{ForwardItem, ForwardSource};
17use crate::message_actions::{ForwardItem, ForwardSource};
17use crate::notice::short_error;
18use crate::notice::short_error;
18use crate::runtime;
19use crate::runtime;
@@ -527,7 +528,7 @@ impl Render for ForwardDialog {
527 .child(
528 .child(
528 Button::new("forward-cancel")
529 Button::new("forward-cancel")
529 .ghost()
530 .ghost()
530 .label("Cancel")
531 .label(tr("common.cancel"))
531 .on_click(cx.listener(|_, _, _, cx| {
532 .on_click(cx.listener(|_, _, _, cx| {
532 cx.emit(ForwardDialogEvent::Close)
533 cx.emit(ForwardDialogEvent::Close)
533 })),
534 })),
crates/app/src/views/group_name.rs +3 −2
@@ -13,6 +13,7 @@ use gpui_kit::*;
13 13
14 14 use super::widgets::icon;
15 15 use crate::app_state::AppState;
16 use crate::i18n::tr;
16 17 use crate::theme;
17 18
18 19 pub const GROUP_NAME_FORM: &str = "shell/islands/main/group-name-form";
@@ -135,13 +136,13 @@ impl Render for GroupNameForm {
135 136 .gap(px(FORM_GAP))
136 137 .child(
137 138 Button::new("group-name-cancel")
138 .label("Cancel")
139 .label(tr("common.cancel"))
139 140 .on_click(cx.listener(|form, _, window, cx| form.close(window, cx))),
140 141 )
141 142 .child(
142 143 Button::new("group-name-save")
143 144 .primary()
144 .label("Save")
145 .label(tr("common.save"))
145 146 .disabled(problem.is_some())
146 147 .on_click(cx.listener(|form, _, window, cx| form.save(window, cx))),
147 148 ),
@@ -13,6 +13,7 @@ use gpui_kit::*;
13
13
14use super::widgets::icon;
14use super::widgets::icon;
15use crate::app_state::AppState;
15use crate::app_state::AppState;
16use crate::i18n::tr;
16use crate::theme;
17use crate::theme;
17
18
18pub const GROUP_NAME_FORM: &str = "shell/islands/main/group-name-form";
19pub const GROUP_NAME_FORM: &str = "shell/islands/main/group-name-form";
@@ -135,13 +136,13 @@ impl Render for GroupNameForm {
135 .gap(px(FORM_GAP))
136 .gap(px(FORM_GAP))
136 .child(
137 .child(
137 Button::new("group-name-cancel")
138 Button::new("group-name-cancel")
138 .label("Cancel")
139 .label(tr("common.cancel"))
139 .on_click(cx.listener(|form, _, window, cx| form.close(window, cx))),
140 .on_click(cx.listener(|form, _, window, cx| form.close(window, cx))),
140 )
141 )
141 .child(
142 .child(
142 Button::new("group-name-save")
143 Button::new("group-name-save")
143 .primary()
144 .primary()
144 .label("Save")
145 .label(tr("common.save"))
145 .disabled(problem.is_some())
146 .disabled(problem.is_some())
146 .on_click(cx.listener(|form, _, window, cx| form.save(window, cx))),
147 .on_click(cx.listener(|form, _, window, cx| form.save(window, cx))),
147 ),
148 ),
crates/app/src/views/join_dialog.rs +13 −7
@@ -6,12 +6,12 @@ use gpui_kit::prelude::FluentBuilder as _;
6 6 use gpui_kit::*;
7 7
8 8 use crate::app_state::AppState;
9 use crate::i18n::tr;
9 10 use crate::theme;
10 11
11 12 const DIALOG_WIDTH: f32 = 380.;
12 13 const FIELD_GAP: f32 = 12.;
13 14 const LABEL_SIZE: f32 = 12.;
14 const TITLE: &str = "Join with a meeting ID";
15 15
16 16 struct JoinForm {
17 17 state: Entity<AppState>,
@@ -25,7 +25,7 @@ impl JoinForm {
25 25 fn new(state: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
26 26 let meeting_id = cx.new(|cx| InputState::new(window, cx).placeholder("123 456 789 012"));
27 27 let passcode = cx.new(|cx| {
28 InputState::new(window, cx).placeholder("Passcode (if the invitation has one)")
28 InputState::new(window, cx).placeholder(tr("calls.join_dialog.passcode_placeholder"))
29 29 });
30 30 let subscriptions = [
31 31 cx.subscribe_in(&meeting_id, window, Self::on_enter),
@@ -80,8 +80,14 @@ impl Render for JoinForm {
80 80 fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
81 81 v_flex()
82 82 .gap(px(FIELD_GAP))
83 .child(labeled("Meeting ID", Input::new(&self.meeting_id)))
84 .child(labeled("Passcode", Input::new(&self.passcode)))
83 .child(labeled(
84 &tr("calls.join_dialog.meeting_id"),
85 Input::new(&self.meeting_id),
86 ))
87 .child(labeled(
88 &tr("calls.join_dialog.passcode"),
89 Input::new(&self.passcode),
90 ))
85 91 .when_some(self.error.clone(), |form, error| {
86 92 form.child(
87 93 div()
@@ -101,13 +107,13 @@ pub fn open_join_with_id(state: Entity<AppState>, window: &mut Window, cx: &mut
101 107 let footer = DialogFooter::new()
102 108 .child(
103 109 Button::new("join-cancel")
104 .label("Cancel")
110 .label(tr("common.cancel"))
105 111 .on_click(|_, window, cx| window.close_dialog(cx)),
106 112 )
107 113 .child(
108 114 Button::new("join-confirm")
109 115 .primary()
110 .label("Join")
116 .label(tr("common.join"))
111 117 .on_click(move |_, window, cx| {
112 118 if submit_form.update(cx, |form, cx| form.submit(cx)) {
113 119 window.close_dialog(cx);
@@ -115,7 +121,7 @@ pub fn open_join_with_id(state: Entity<AppState>, window: &mut Window, cx: &mut
115 121 }),
116 122 );
117 123 dialog
118 .title(TITLE)
124 .title(tr("calls.join_dialog.title"))
119 125 .w(px(DIALOG_WIDTH))
120 126 .child(form.clone())
121 127 .footer(footer)
@@ -6,12 +6,12 @@ use gpui_kit::prelude::FluentBuilder as _;
6use gpui_kit::*;
6use gpui_kit::*;
7
7
8use crate::app_state::AppState;
8use crate::app_state::AppState;
9use crate::i18n::tr;
9use crate::theme;
10use crate::theme;
10
11
11const DIALOG_WIDTH: f32 = 380.;
12const DIALOG_WIDTH: f32 = 380.;
12const FIELD_GAP: f32 = 12.;
13const FIELD_GAP: f32 = 12.;
13const LABEL_SIZE: f32 = 12.;
14const LABEL_SIZE: f32 = 12.;
14const TITLE: &str = "Join with a meeting ID";
15
15
16struct JoinForm {
16struct JoinForm {
17 state: Entity<AppState>,
17 state: Entity<AppState>,
@@ -25,7 +25,7 @@ impl JoinForm {
25 fn new(state: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
25 fn new(state: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
26 let meeting_id = cx.new(|cx| InputState::new(window, cx).placeholder("123 456 789 012"));
26 let meeting_id = cx.new(|cx| InputState::new(window, cx).placeholder("123 456 789 012"));
27 let passcode = cx.new(|cx| {
27 let passcode = cx.new(|cx| {
28 InputState::new(window, cx).placeholder("Passcode (if the invitation has one)")
28 InputState::new(window, cx).placeholder(tr("calls.join_dialog.passcode_placeholder"))
29 });
29 });
30 let subscriptions = [
30 let subscriptions = [
31 cx.subscribe_in(&meeting_id, window, Self::on_enter),
31 cx.subscribe_in(&meeting_id, window, Self::on_enter),
@@ -80,8 +80,14 @@ impl Render for JoinForm {
80 fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
80 fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
81 v_flex()
81 v_flex()
82 .gap(px(FIELD_GAP))
82 .gap(px(FIELD_GAP))
83 .child(labeled("Meeting ID", Input::new(&self.meeting_id)))
83 .child(labeled(
84 .child(labeled("Passcode", Input::new(&self.passcode)))
84 &tr("calls.join_dialog.meeting_id"),
85 Input::new(&self.meeting_id),
86 ))
87 .child(labeled(
88 &tr("calls.join_dialog.passcode"),
89 Input::new(&self.passcode),
90 ))
85 .when_some(self.error.clone(), |form, error| {
91 .when_some(self.error.clone(), |form, error| {
86 form.child(
92 form.child(
87 div()
93 div()
@@ -101,13 +107,13 @@ pub fn open_join_with_id(state: Entity<AppState>, window: &mut Window, cx: &mut
101 let footer = DialogFooter::new()
107 let footer = DialogFooter::new()
102 .child(
108 .child(
103 Button::new("join-cancel")
109 Button::new("join-cancel")
104 .label("Cancel")
110 .label(tr("common.cancel"))
105 .on_click(|_, window, cx| window.close_dialog(cx)),
111 .on_click(|_, window, cx| window.close_dialog(cx)),
106 )
112 )
107 .child(
113 .child(
108 Button::new("join-confirm")
114 Button::new("join-confirm")
109 .primary()
115 .primary()
110 .label("Join")
116 .label(tr("common.join"))
111 .on_click(move |_, window, cx| {
117 .on_click(move |_, window, cx| {
112 if submit_form.update(cx, |form, cx| form.submit(cx)) {
118 if submit_form.update(cx, |form, cx| form.submit(cx)) {
113 window.close_dialog(cx);
119 window.close_dialog(cx);
@@ -115,7 +121,7 @@ pub fn open_join_with_id(state: Entity<AppState>, window: &mut Window, cx: &mut
115 }),
121 }),
116 );
122 );
117 dialog
123 dialog
118 .title(TITLE)
124 .title(tr("calls.join_dialog.title"))
119 .w(px(DIALOG_WIDTH))
125 .w(px(DIALOG_WIDTH))
120 .child(form.clone())
126 .child(form.clone())
121 .footer(footer)
127 .footer(footer)
crates/app/src/views/new_meeting_dialog.rs +29 −18
@@ -16,12 +16,12 @@ use super::new_chat::{NewChatDraft, Pick};
16 16 use super::widgets::icon;
17 17 use crate::app_state::AppState;
18 18 use crate::call::{FormValues, Invitee, default_window, draft_from_form};
19 use crate::i18n::tr;
19 20 use crate::theme;
20 21
21 22 const DIALOG_WIDTH: f32 = 520.;
22 23 const FIELD_GAP: f32 = 12.;
23 24 const LABEL_SIZE: f32 = 12.;
24 const TITLE: &str = "New meeting";
25 25 const DATE_FORMAT: &str = "%a, %b %-d, %Y";
26 26 const DETAILS_MIN_ROWS: usize = 3;
27 27 const DETAILS_MAX_ROWS: usize = 6;
@@ -45,7 +45,9 @@ struct MeetingForm {
45 45 impl MeetingForm {
46 46 fn new(state: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
47 47 let (start_moment, end_moment) = default_window(Utc::now(), &Local);
48 let title = cx.new(|cx| InputState::new(window, cx).placeholder("Add a title"));
48 let title = cx.new(|cx| {
49 InputState::new(window, cx).placeholder(tr("calls.meeting.title_placeholder"))
50 });
49 51 let people_state = state.clone();
50 52 let people = cx.new(|cx| NewChatDraft::new(people_state, window, cx).compact());
51 53 let date = cx.new(|cx| {
@@ -66,7 +68,7 @@ impl MeetingForm {
66 68 let details = cx.new(|cx| {
67 69 TextareaState::new(window, cx)
68 70 .auto_grow(DETAILS_MIN_ROWS, DETAILS_MAX_ROWS)
69 .placeholder("Add details")
71 .placeholder(tr("calls.meeting.details_placeholder"))
70 72 });
71 73 MeetingForm {
72 74 state,
@@ -181,9 +183,12 @@ impl Render for MeetingForm {
181 183 v_flex()
182 184 .debug_selector(|| "new-meeting".into())
183 185 .gap(px(FIELD_GAP))
184 .child(labeled("Title", Input::new(&self.title)))
185 186 .child(labeled(
186 "People",
187 &tr("calls.meeting.title_label"),
188 Input::new(&self.title),
189 ))
190 .child(labeled(
191 &tr("calls.meeting.people"),
187 192 div()
188 193 .debug_selector(|| "new-meeting/people".into())
189 194 .rounded(px(6.))
@@ -197,22 +202,24 @@ impl Render for MeetingForm {
197 202 .gap(px(8.))
198 203 .items_end()
199 204 .child(div().w(px(DATE_FIELD_WIDTH)).child(labeled(
200 "Date",
205 &tr("calls.meeting.date"),
201 206 DatePicker::new(&self.date).cleanable(false),
202 207 )))
208 .child(div().w(px(TIME_FIELD_WIDTH)).child(labeled(
209 &tr("calls.meeting.start"),
210 TimeField::new(&self.start),
211 )))
203 212 .child(
204 213 div()
205 214 .w(px(TIME_FIELD_WIDTH))
206 .child(labeled("Start", TimeField::new(&self.start))),
207 )
208 .child(
209 div()
210 .w(px(TIME_FIELD_WIDTH))
211 .child(labeled("End", TimeField::new(&self.end))),
215 .child(labeled(&tr("calls.meeting.end"), TimeField::new(&self.end))),
212 216 ),
213 217 )
214 .child(labeled("Repeat", repeat_button))
215 .child(labeled("Details", Textarea::new(&self.details)))
218 .child(labeled(&tr("calls.meeting.repeat"), repeat_button))
219 .child(labeled(
220 &tr("calls.meeting.details"),
221 Textarea::new(&self.details),
222 ))
216 223 .child(
217 224 h_flex()
218 225 .gap(px(6.))
@@ -220,7 +227,7 @@ impl Render for MeetingForm {
220 227 .text_size(px(LABEL_SIZE))
221 228 .text_color(theme::text_muted())
222 229 .child(icon(IconName::Video, 14., theme::text_muted()))
223 .child("Teams meeting link is added"),
230 .child(tr("calls.meeting.teams_link_added")),
224 231 )
225 232 .when_some(self.error.clone(), |form, error| {
226 233 form.child(
@@ -255,19 +262,23 @@ pub fn open_new_meeting_with(
255 262 let footer = DialogFooter::new()
256 263 .child(
257 264 Button::new("meeting-cancel")
258 .label("Cancel")
265 .label(tr("common.cancel"))
259 266 .on_click(|_, window, cx| window.close_dialog(cx)),
260 267 )
261 268 .child(
262 269 Button::new("meeting-send")
263 270 .primary()
264 .label(if sending { "Sending..." } else { "Send" })
271 .label(if sending {
272 tr("common.sending")
273 } else {
274 tr("common.send")
275 })
265 276 .on_click(move |_, window, cx| {
266 277 submit_form.update(cx, |form, cx| form.submit(window, cx));
267 278 }),
268 279 );
269 280 dialog
270 .title(TITLE)
281 .title(tr("calls.meeting.new_title"))
271 282 .w(px(DIALOG_WIDTH))
272 283 .child(form.clone())
273 284 .footer(footer)
@@ -16,12 +16,12 @@ use super::new_chat::{NewChatDraft, Pick};
16use super::widgets::icon;
16use super::widgets::icon;
17use crate::app_state::AppState;
17use crate::app_state::AppState;
18use crate::call::{FormValues, Invitee, default_window, draft_from_form};
18use crate::call::{FormValues, Invitee, default_window, draft_from_form};
19use crate::i18n::tr;
19use crate::theme;
20use crate::theme;
20
21
21const DIALOG_WIDTH: f32 = 520.;
22const DIALOG_WIDTH: f32 = 520.;
22const FIELD_GAP: f32 = 12.;
23const FIELD_GAP: f32 = 12.;
23const LABEL_SIZE: f32 = 12.;
24const LABEL_SIZE: f32 = 12.;
24const TITLE: &str = "New meeting";
25const DATE_FORMAT: &str = "%a, %b %-d, %Y";
25const DATE_FORMAT: &str = "%a, %b %-d, %Y";
26const DETAILS_MIN_ROWS: usize = 3;
26const DETAILS_MIN_ROWS: usize = 3;
27const DETAILS_MAX_ROWS: usize = 6;
27const DETAILS_MAX_ROWS: usize = 6;
@@ -45,7 +45,9 @@ struct MeetingForm {
45impl MeetingForm {
45impl MeetingForm {
46 fn new(state: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
46 fn new(state: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
47 let (start_moment, end_moment) = default_window(Utc::now(), &Local);
47 let (start_moment, end_moment) = default_window(Utc::now(), &Local);
48 let title = cx.new(|cx| InputState::new(window, cx).placeholder("Add a title"));
48 let title = cx.new(|cx| {
49 InputState::new(window, cx).placeholder(tr("calls.meeting.title_placeholder"))
50 });
49 let people_state = state.clone();
51 let people_state = state.clone();
50 let people = cx.new(|cx| NewChatDraft::new(people_state, window, cx).compact());
52 let people = cx.new(|cx| NewChatDraft::new(people_state, window, cx).compact());
51 let date = cx.new(|cx| {
53 let date = cx.new(|cx| {
@@ -66,7 +68,7 @@ impl MeetingForm {
66 let details = cx.new(|cx| {
68 let details = cx.new(|cx| {
67 TextareaState::new(window, cx)
69 TextareaState::new(window, cx)
68 .auto_grow(DETAILS_MIN_ROWS, DETAILS_MAX_ROWS)
70 .auto_grow(DETAILS_MIN_ROWS, DETAILS_MAX_ROWS)
69 .placeholder("Add details")
71 .placeholder(tr("calls.meeting.details_placeholder"))
70 });
72 });
71 MeetingForm {
73 MeetingForm {
72 state,
74 state,
@@ -181,9 +183,12 @@ impl Render for MeetingForm {
181 v_flex()
183 v_flex()
182 .debug_selector(|| "new-meeting".into())
184 .debug_selector(|| "new-meeting".into())
183 .gap(px(FIELD_GAP))
185 .gap(px(FIELD_GAP))
184 .child(labeled("Title", Input::new(&self.title)))
185 .child(labeled(
186 .child(labeled(
186 "People",
187 &tr("calls.meeting.title_label"),
188 Input::new(&self.title),
189 ))
190 .child(labeled(
191 &tr("calls.meeting.people"),
187 div()
192 div()
188 .debug_selector(|| "new-meeting/people".into())
193 .debug_selector(|| "new-meeting/people".into())
189 .rounded(px(6.))
194 .rounded(px(6.))
@@ -197,22 +202,24 @@ impl Render for MeetingForm {
197 .gap(px(8.))
202 .gap(px(8.))
198 .items_end()
203 .items_end()
199 .child(div().w(px(DATE_FIELD_WIDTH)).child(labeled(
204 .child(div().w(px(DATE_FIELD_WIDTH)).child(labeled(
200 "Date",
205 &tr("calls.meeting.date"),
201 DatePicker::new(&self.date).cleanable(false),
206 DatePicker::new(&self.date).cleanable(false),
202 )))
207 )))
208 .child(div().w(px(TIME_FIELD_WIDTH)).child(labeled(
209 &tr("calls.meeting.start"),
210 TimeField::new(&self.start),
211 )))
203 .child(
212 .child(
204 div()
213 div()
205 .w(px(TIME_FIELD_WIDTH))
214 .w(px(TIME_FIELD_WIDTH))
206 .child(labeled("Start", TimeField::new(&self.start))),
215 .child(labeled(&tr("calls.meeting.end"), TimeField::new(&self.end))),
207 )
208 .child(
209 div()
210 .w(px(TIME_FIELD_WIDTH))
211 .child(labeled("End", TimeField::new(&self.end))),
212 ),
216 ),
213 )
217 )
214 .child(labeled("Repeat", repeat_button))
218 .child(labeled(&tr("calls.meeting.repeat"), repeat_button))
215 .child(labeled("Details", Textarea::new(&self.details)))
219 .child(labeled(
220 &tr("calls.meeting.details"),
221 Textarea::new(&self.details),
222 ))
216 .child(
223 .child(
217 h_flex()
224 h_flex()
218 .gap(px(6.))
225 .gap(px(6.))
@@ -220,7 +227,7 @@ impl Render for MeetingForm {
220 .text_size(px(LABEL_SIZE))
227 .text_size(px(LABEL_SIZE))
221 .text_color(theme::text_muted())
228 .text_color(theme::text_muted())
222 .child(icon(IconName::Video, 14., theme::text_muted()))
229 .child(icon(IconName::Video, 14., theme::text_muted()))
223 .child("Teams meeting link is added"),
230 .child(tr("calls.meeting.teams_link_added")),
224 )
231 )
225 .when_some(self.error.clone(), |form, error| {
232 .when_some(self.error.clone(), |form, error| {
226 form.child(
233 form.child(
@@ -255,19 +262,23 @@ pub fn open_new_meeting_with(
255 let footer = DialogFooter::new()
262 let footer = DialogFooter::new()
256 .child(
263 .child(
257 Button::new("meeting-cancel")
264 Button::new("meeting-cancel")
258 .label("Cancel")
265 .label(tr("common.cancel"))
259 .on_click(|_, window, cx| window.close_dialog(cx)),
266 .on_click(|_, window, cx| window.close_dialog(cx)),
260 )
267 )
261 .child(
268 .child(
262 Button::new("meeting-send")
269 Button::new("meeting-send")
263 .primary()
270 .primary()
264 .label(if sending { "Sending..." } else { "Send" })
271 .label(if sending {
272 tr("common.sending")
273 } else {
274 tr("common.send")
275 })
265 .on_click(move |_, window, cx| {
276 .on_click(move |_, window, cx| {
266 submit_form.update(cx, |form, cx| form.submit(window, cx));
277 submit_form.update(cx, |form, cx| form.submit(window, cx));
267 }),
278 }),
268 );
279 );
269 dialog
280 dialog
270 .title(TITLE)
281 .title(tr("calls.meeting.new_title"))
271 .w(px(DIALOG_WIDTH))
282 .w(px(DIALOG_WIDTH))
272 .child(form.clone())
283 .child(form.clone())
273 .footer(footer)
284 .footer(footer)
crates/app/src/views/rail.rs +19 −11
@@ -9,6 +9,7 @@ use super::widgets::{RAIL_BADGE, badge_pill, filled_icon, icon};
9 9 use crate::activity::ActivityCenter;
10 10 use crate::agents::{AgentRuns, runs_handle};
11 11 use crate::app_state::AppState;
12 use crate::i18n::tr;
12 13 use crate::sidebar_model::{any_unread_channel, unread_chat_count};
13 14 use crate::theme;
14 15 use app_ui_kit::layout::{RAIL_ITEM_WIDTH, RAIL_WIDTH};
@@ -25,10 +26,10 @@ enum RailBadge {
25 26 Dot,
26 27 }
27 28
28 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
29 #[derive(Debug, Clone, PartialEq, Eq)]
29 30 struct RailItem {
30 31 tab: SidebarTab,
31 label: &'static str,
32 label: String,
32 33 shortcut_label: &'static str,
33 34 icon: IconName,
34 35 badge: RailBadge,
@@ -50,21 +51,21 @@ fn rail_items(
50 51 let mut items = vec![
51 52 RailItem {
52 53 tab: SidebarTab::Activity,
53 label: "Activity",
54 label: tr("rail.activity"),
54 55 shortcut_label: "Open Activity",
55 56 icon: IconName::Bell,
56 57 badge: count_badge_for(activity_unread),
57 58 },
58 59 RailItem {
59 60 tab: SidebarTab::Chats,
60 label: "Chat",
61 label: tr("rail.chat"),
61 62 shortcut_label: "Show Chats",
62 63 icon: IconName::MessageSquare,
63 64 badge: count_badge_for(unread_chats),
64 65 },
65 66 RailItem {
66 67 tab: SidebarTab::Channels,
67 label: "Teams",
68 label: tr("rail.teams"),
68 69 shortcut_label: "Show Channels",
69 70 icon: IconName::Users,
70 71 badge: if channel_dot {
@@ -75,14 +76,14 @@ fn rail_items(
75 76 },
76 77 RailItem {
77 78 tab: SidebarTab::Calendar,
78 label: "Calendar",
79 label: tr("rail.calendar"),
79 80 shortcut_label: "Open Calendar",
80 81 icon: IconName::Calendar,
81 82 badge: RailBadge::None,
82 83 },
83 84 RailItem {
84 85 tab: SidebarTab::Calls,
85 label: "Calls",
86 label: tr("rail.calls"),
86 87 shortcut_label: "Show Calls",
87 88 icon: IconName::Phone,
88 89 badge: RailBadge::None,
@@ -91,7 +92,7 @@ fn rail_items(
91 92 if let Some(running) = agents_running {
92 93 items.push(RailItem {
93 94 tab: SidebarTab::Agents,
94 label: "Agents",
95 label: tr("rail.agents"),
95 96 shortcut_label: "Open Agents",
96 97 icon: IconName::Bot,
97 98 badge: count_badge_for(running),
@@ -103,7 +104,7 @@ fn rail_items(
103 104 fn tooltip_text(item: &RailItem) -> SharedString {
104 105 match keys_for_label(item.shortcut_label) {
105 106 Some(keys) => format!("{} ({keys})", item.label).into(),
106 None => item.label.into(),
107 None => item.label.clone().into(),
107 108 }
108 109 }
109 110
@@ -154,7 +155,7 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {
154 155 .line_height(px(LABEL_HEIGHT))
155 156 .font_weight(FontWeight::SEMIBOLD)
156 157 .text_color(color)
157 .child(item.label),
158 .child(item.label.clone()),
158 159 )
159 160 .children(badge(item.badge))
160 161 .tooltip(move |window, cx| Tooltip::new(tooltip.clone()).build(window, cx))
@@ -252,11 +253,15 @@ impl Render for RailView {
252 253
253 254 #[cfg(test)]
254 255 mod tests {
256 use app_base::ui_locale::apply_locale;
257
255 258 use super::{RailBadge, count_badge_for, rail_items, tooltip_text};
259 use crate::i18n::tr;
256 260 use crate::views::sidebar::SidebarTab;
257 261
258 262 #[test]
259 263 fn items_follow_the_spec_order() {
264 apply_locale("en");
260 265 let tabs: Vec<SidebarTab> = rail_items(0, 0, false, None)
261 266 .iter()
262 267 .map(|item| item.tab)
@@ -275,17 +280,19 @@ mod tests {
275 280
276 281 #[test]
277 282 fn agents_comes_last_and_only_when_actions_exist() {
283 apply_locale("en");
278 284 assert_eq!(rail_items(0, 0, false, None).len(), 5);
279 285 let with_agents = rail_items(0, 0, false, Some(2));
280 286 assert_eq!(with_agents.len(), 6);
281 287 assert_eq!(with_agents[5].tab, SidebarTab::Agents);
282 assert_eq!(with_agents[5].label, "Agents");
288 assert_eq!(with_agents[5].label, tr("rail.agents"));
283 289 assert_eq!(with_agents[5].badge, RailBadge::Count(2));
284 290 assert_eq!(rail_items(0, 0, false, Some(0))[5].badge, RailBadge::None);
285 291 }
286 292
287 293 #[test]
288 294 fn badges_follow_the_unread_inputs() {
295 apply_locale("en");
289 296 let items = rail_items(3, 5, true, None);
290 297 assert_eq!(items[0].badge, RailBadge::Count(3));
291 298 assert_eq!(items[1].badge, RailBadge::Count(5));
@@ -300,6 +307,7 @@ mod tests {
300 307 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
301 308 #[test]
302 309 fn every_item_shows_its_shortcut_in_the_tooltip() {
310 apply_locale("en");
303 311 let items = rail_items(0, 0, false, None);
304 312 assert_eq!(tooltip_text(&items[0]), "Activity (Ctrl+1)");
305 313 assert!(items.iter().all(|item| tooltip_text(item).ends_with(')')));
@@ -9,6 +9,7 @@ use super::widgets::{RAIL_BADGE, badge_pill, filled_icon, icon};
9use crate::activity::ActivityCenter;
9use crate::activity::ActivityCenter;
10use crate::agents::{AgentRuns, runs_handle};
10use crate::agents::{AgentRuns, runs_handle};
11use crate::app_state::AppState;
11use crate::app_state::AppState;
12use crate::i18n::tr;
12use crate::sidebar_model::{any_unread_channel, unread_chat_count};
13use crate::sidebar_model::{any_unread_channel, unread_chat_count};
13use crate::theme;
14use crate::theme;
14use app_ui_kit::layout::{RAIL_ITEM_WIDTH, RAIL_WIDTH};
15use app_ui_kit::layout::{RAIL_ITEM_WIDTH, RAIL_WIDTH};
@@ -25,10 +26,10 @@ enum RailBadge {
25 Dot,
26 Dot,
26}
27}
27
28
28#[derive(Debug, Clone, Copy, PartialEq, Eq)]
29#[derive(Debug, Clone, PartialEq, Eq)]
29struct RailItem {
30struct RailItem {
30 tab: SidebarTab,
31 tab: SidebarTab,
31 label: &'static str,
32 label: String,
32 shortcut_label: &'static str,
33 shortcut_label: &'static str,
33 icon: IconName,
34 icon: IconName,
34 badge: RailBadge,
35 badge: RailBadge,
@@ -50,21 +51,21 @@ fn rail_items(
50 let mut items = vec![
51 let mut items = vec![
51 RailItem {
52 RailItem {
52 tab: SidebarTab::Activity,
53 tab: SidebarTab::Activity,
53 label: "Activity",
54 label: tr("rail.activity"),
54 shortcut_label: "Open Activity",
55 shortcut_label: "Open Activity",
55 icon: IconName::Bell,
56 icon: IconName::Bell,
56 badge: count_badge_for(activity_unread),
57 badge: count_badge_for(activity_unread),
57 },
58 },
58 RailItem {
59 RailItem {
59 tab: SidebarTab::Chats,
60 tab: SidebarTab::Chats,
60 label: "Chat",
61 label: tr("rail.chat"),
61 shortcut_label: "Show Chats",
62 shortcut_label: "Show Chats",
62 icon: IconName::MessageSquare,
63 icon: IconName::MessageSquare,
63 badge: count_badge_for(unread_chats),
64 badge: count_badge_for(unread_chats),
64 },
65 },
65 RailItem {
66 RailItem {
66 tab: SidebarTab::Channels,
67 tab: SidebarTab::Channels,
67 label: "Teams",
68 label: tr("rail.teams"),
68 shortcut_label: "Show Channels",
69 shortcut_label: "Show Channels",
69 icon: IconName::Users,
70 icon: IconName::Users,
70 badge: if channel_dot {
71 badge: if channel_dot {
@@ -75,14 +76,14 @@ fn rail_items(
75 },
76 },
76 RailItem {
77 RailItem {
77 tab: SidebarTab::Calendar,
78 tab: SidebarTab::Calendar,
78 label: "Calendar",
79 label: tr("rail.calendar"),
79 shortcut_label: "Open Calendar",
80 shortcut_label: "Open Calendar",
80 icon: IconName::Calendar,
81 icon: IconName::Calendar,
81 badge: RailBadge::None,
82 badge: RailBadge::None,
82 },
83 },
83 RailItem {
84 RailItem {
84 tab: SidebarTab::Calls,
85 tab: SidebarTab::Calls,
85 label: "Calls",
86 label: tr("rail.calls"),
86 shortcut_label: "Show Calls",
87 shortcut_label: "Show Calls",
87 icon: IconName::Phone,
88 icon: IconName::Phone,
88 badge: RailBadge::None,
89 badge: RailBadge::None,
@@ -91,7 +92,7 @@ fn rail_items(
91 if let Some(running) = agents_running {
92 if let Some(running) = agents_running {
92 items.push(RailItem {
93 items.push(RailItem {
93 tab: SidebarTab::Agents,
94 tab: SidebarTab::Agents,
94 label: "Agents",
95 label: tr("rail.agents"),
95 shortcut_label: "Open Agents",
96 shortcut_label: "Open Agents",
96 icon: IconName::Bot,
97 icon: IconName::Bot,
97 badge: count_badge_for(running),
98 badge: count_badge_for(running),
@@ -103,7 +104,7 @@ fn rail_items(
103fn tooltip_text(item: &RailItem) -> SharedString {
104fn tooltip_text(item: &RailItem) -> SharedString {
104 match keys_for_label(item.shortcut_label) {
105 match keys_for_label(item.shortcut_label) {
105 Some(keys) => format!("{} ({keys})", item.label).into(),
106 Some(keys) => format!("{} ({keys})", item.label).into(),
106 None => item.label.into(),
107 None => item.label.clone().into(),
107 }
108 }
108}
109}
109
110
@@ -154,7 +155,7 @@ fn item_element(item: &RailItem, active: bool) -> Stateful<Div> {
154 .line_height(px(LABEL_HEIGHT))
155 .line_height(px(LABEL_HEIGHT))
155 .font_weight(FontWeight::SEMIBOLD)
156 .font_weight(FontWeight::SEMIBOLD)
156 .text_color(color)
157 .text_color(color)
157 .child(item.label),
158 .child(item.label.clone()),
158 )
159 )
159 .children(badge(item.badge))
160 .children(badge(item.badge))
160 .tooltip(move |window, cx| Tooltip::new(tooltip.clone()).build(window, cx))
161 .tooltip(move |window, cx| Tooltip::new(tooltip.clone()).build(window, cx))
@@ -252,11 +253,15 @@ impl Render for RailView {
252
253
253#[cfg(test)]
254#[cfg(test)]
254mod tests {
255mod tests {
256 use app_base::ui_locale::apply_locale;
257
255 use super::{RailBadge, count_badge_for, rail_items, tooltip_text};
258 use super::{RailBadge, count_badge_for, rail_items, tooltip_text};
259 use crate::i18n::tr;
256 use crate::views::sidebar::SidebarTab;
260 use crate::views::sidebar::SidebarTab;
257
261
258 #[test]
262 #[test]
259 fn items_follow_the_spec_order() {
263 fn items_follow_the_spec_order() {
264 apply_locale("en");
260 let tabs: Vec<SidebarTab> = rail_items(0, 0, false, None)
265 let tabs: Vec<SidebarTab> = rail_items(0, 0, false, None)
261 .iter()
266 .iter()
262 .map(|item| item.tab)
267 .map(|item| item.tab)
@@ -275,17 +280,19 @@ mod tests {
275
280
276 #[test]
281 #[test]
277 fn agents_comes_last_and_only_when_actions_exist() {
282 fn agents_comes_last_and_only_when_actions_exist() {
283 apply_locale("en");
278 assert_eq!(rail_items(0, 0, false, None).len(), 5);
284 assert_eq!(rail_items(0, 0, false, None).len(), 5);
279 let with_agents = rail_items(0, 0, false, Some(2));
285 let with_agents = rail_items(0, 0, false, Some(2));
280 assert_eq!(with_agents.len(), 6);
286 assert_eq!(with_agents.len(), 6);
281 assert_eq!(with_agents[5].tab, SidebarTab::Agents);
287 assert_eq!(with_agents[5].tab, SidebarTab::Agents);
282 assert_eq!(with_agents[5].label, "Agents");
288 assert_eq!(with_agents[5].label, tr("rail.agents"));
283 assert_eq!(with_agents[5].badge, RailBadge::Count(2));
289 assert_eq!(with_agents[5].badge, RailBadge::Count(2));
284 assert_eq!(rail_items(0, 0, false, Some(0))[5].badge, RailBadge::None);
290 assert_eq!(rail_items(0, 0, false, Some(0))[5].badge, RailBadge::None);
285 }
291 }
286
292
287 #[test]
293 #[test]
288 fn badges_follow_the_unread_inputs() {
294 fn badges_follow_the_unread_inputs() {
295 apply_locale("en");
289 let items = rail_items(3, 5, true, None);
296 let items = rail_items(3, 5, true, None);
290 assert_eq!(items[0].badge, RailBadge::Count(3));
297 assert_eq!(items[0].badge, RailBadge::Count(3));
291 assert_eq!(items[1].badge, RailBadge::Count(5));
298 assert_eq!(items[1].badge, RailBadge::Count(5));
@@ -300,6 +307,7 @@ mod tests {
300 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
307 #[cfg_attr(target_os = "macos", ignore = "needs Ctrl bindings")]
301 #[test]
308 #[test]
302 fn every_item_shows_its_shortcut_in_the_tooltip() {
309 fn every_item_shows_its_shortcut_in_the_tooltip() {
310 apply_locale("en");
303 let items = rail_items(0, 0, false, None);
311 let items = rail_items(0, 0, false, None);
304 assert_eq!(tooltip_text(&items[0]), "Activity (Ctrl+1)");
312 assert_eq!(tooltip_text(&items[0]), "Activity (Ctrl+1)");
305 assert!(items.iter().all(|item| tooltip_text(item).ends_with(')')));
313 assert!(items.iter().all(|item| tooltip_text(item).ends_with(')')));
crates/app/src/views/recap_tab.rs +2 −1
@@ -20,6 +20,7 @@ use super::shared_tab::{SharedRun, download_label, item_row};
20 20 use super::widgets::icon;
21 21 use crate::channel_files::SharedItem;
22 22 use crate::downloads::DownloadState;
23 use crate::i18n::tr;
23 24 use crate::recap::{
24 25 ATTENDANCE_FAILED, ATTENDANCE_OFF, EMPTY_RECAP, Load, NO_TRANSCRIPT, clock_label,
25 26 expiry_is_urgent, expiry_label, highlight_segments, matching_turns, occurrence_label,
@@ -283,7 +284,7 @@ fn failure(reason: String, run: &RecapRun) -> AnyElement {
283 284 Button::new("recap-retry")
284 285 .ghost()
285 286 .compact()
286 .label("Retry")
287 .label(tr("common.retry"))
287 288 .on_click(move |_, window, cx| run(RecapCommand::Retry, window, cx)),
288 289 )
289 290 .into_any_element()
@@ -20,6 +20,7 @@ use super::shared_tab::{SharedRun, download_label, item_row};
20use super::widgets::icon;
20use super::widgets::icon;
21use crate::channel_files::SharedItem;
21use crate::channel_files::SharedItem;
22use crate::downloads::DownloadState;
22use crate::downloads::DownloadState;
23use crate::i18n::tr;
23use crate::recap::{
24use crate::recap::{
24 ATTENDANCE_FAILED, ATTENDANCE_OFF, EMPTY_RECAP, Load, NO_TRANSCRIPT, clock_label,
25 ATTENDANCE_FAILED, ATTENDANCE_OFF, EMPTY_RECAP, Load, NO_TRANSCRIPT, clock_label,
25 expiry_is_urgent, expiry_label, highlight_segments, matching_turns, occurrence_label,
26 expiry_is_urgent, expiry_label, highlight_segments, matching_turns, occurrence_label,
@@ -283,7 +284,7 @@ fn failure(reason: String, run: &RecapRun) -> AnyElement {
283 Button::new("recap-retry")
284 Button::new("recap-retry")
284 .ghost()
285 .ghost()
285 .compact()
286 .compact()
286 .label("Retry")
287 .label(tr("common.retry"))
287 .on_click(move |_, window, cx| run(RecapCommand::Retry, window, cx)),
288 .on_click(move |_, window, cx| run(RecapCommand::Retry, window, cx)),
288 )
289 )
289 .into_any_element()
290 .into_any_element()
crates/app/src/views/section_dialog.rs +2 −1
@@ -5,6 +5,7 @@ use gpui_kit::component::{WindowExt as _, v_flex};
5 5 use gpui_kit::*;
6 6
7 7 use crate::app_state::AppState;
8 use crate::i18n::tr;
8 9
9 10 const DIALOG_WIDTH: f32 = 380.;
10 11
@@ -114,7 +115,7 @@ pub fn open_section_name_dialog(
114 115 let footer = DialogFooter::new()
115 116 .child(
116 117 Button::new("section-name-cancel")
117 .label("Cancel")
118 .label(tr("common.cancel"))
118 119 .on_click(|_, window, cx| window.close_dialog(cx)),
119 120 )
120 121 .child(
@@ -5,6 +5,7 @@ use gpui_kit::component::{WindowExt as _, v_flex};
5use gpui_kit::*;
5use gpui_kit::*;
6
6
7use crate::app_state::AppState;
7use crate::app_state::AppState;
8use crate::i18n::tr;
8
9
9const DIALOG_WIDTH: f32 = 380.;
10const DIALOG_WIDTH: f32 = 380.;
10
11
@@ -114,7 +115,7 @@ pub fn open_section_name_dialog(
114 let footer = DialogFooter::new()
115 let footer = DialogFooter::new()
115 .child(
116 .child(
116 Button::new("section-name-cancel")
117 Button::new("section-name-cancel")
117 .label("Cancel")
118 .label(tr("common.cancel"))
118 .on_click(|_, window, cx| window.close_dialog(cx)),
119 .on_click(|_, window, cx| window.close_dialog(cx)),
119 )
120 )
120 .child(
121 .child(
crates/app/src/views/shared_tab.rs +2 −1
@@ -21,6 +21,7 @@ use crate::channel_files::{
21 21 };
22 22 use crate::downloads::{DownloadState, percent_label};
23 23 use crate::format;
24 use crate::i18n::tr;
24 25 use crate::theme;
25 26
26 27 const SIDE_PADDING: f32 = 20.;
@@ -465,7 +466,7 @@ pub fn render_library(view: LibraryView, run: &SharedRun) -> AnyElement {
465 466 Button::new("library-retry")
466 467 .ghost()
467 468 .compact()
468 .label("Retry")
469 .label(tr("common.retry"))
469 470 .on_click(move |_, window, cx| retry(SharedCommand::Retry, window, cx)),
470 471 )
471 472 .into_any_element()
@@ -21,6 +21,7 @@ use crate::channel_files::{
21};
21};
22use crate::downloads::{DownloadState, percent_label};
22use crate::downloads::{DownloadState, percent_label};
23use crate::format;
23use crate::format;
24use crate::i18n::tr;
24use crate::theme;
25use crate::theme;
25
26
26const SIDE_PADDING: f32 = 20.;
27const SIDE_PADDING: f32 = 20.;
@@ -465,7 +466,7 @@ pub fn render_library(view: LibraryView, run: &SharedRun) -> AnyElement {
465 Button::new("library-retry")
466 Button::new("library-retry")
466 .ghost()
467 .ghost()
467 .compact()
468 .compact()
468 .label("Retry")
469 .label(tr("common.retry"))
469 .on_click(move |_, window, cx| retry(SharedCommand::Retry, window, cx)),
470 .on_click(move |_, window, cx| retry(SharedCommand::Retry, window, cx)),
470 )
471 )
471 .into_any_element()
472 .into_any_element()
crates/app/src/views/shortcuts.rs +7 −5
@@ -1,6 +1,8 @@
1 1 use gpui_kit::component::input::Enter;
2 2 use gpui_kit::*;
3 3
4 use crate::i18n::tr;
5
4 6 use super::actions::{
5 7 COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLastMessage, EditLink, InsertTableLine, NewChat,
6 8 OpenSwitcher, PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, SetHeading1,
@@ -94,12 +96,12 @@ impl Group {
94 96 Group::Calls,
95 97 ];
96 98
97 pub fn title(self) -> &'static str {
99 pub fn title(self) -> String {
98 100 match self {
99 Group::General => "General",
100 Group::Navigation => "Navigation",
101 Group::Composer => "Messages and composer",
102 Group::Calls => "Calls",
101 Group::General => tr("shortcuts.group.general"),
102 Group::Navigation => tr("shortcuts.group.navigation"),
103 Group::Composer => tr("shortcuts.group.composer"),
104 Group::Calls => tr("shortcuts.group.calls"),
103 105 }
104 106 }
105 107 }
@@ -1,6 +1,8 @@
1use gpui_kit::component::input::Enter;
1use gpui_kit::component::input::Enter;
2use gpui_kit::*;
2use gpui_kit::*;
3
3
4use crate::i18n::tr;
5
4use super::actions::{
6use super::actions::{
5 COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLastMessage, EditLink, InsertTableLine, NewChat,
7 COMPOSER_KEY_CONTEXT as COMPOSER_CONTEXT, EditLastMessage, EditLink, InsertTableLine, NewChat,
6 OpenSwitcher, PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, SetHeading1,
8 OpenSwitcher, PastePlainText, RemoveTableLine, ReplyToHovered, ScheduleSend, SetHeading1,
@@ -94,12 +96,12 @@ impl Group {
94 Group::Calls,
96 Group::Calls,
95 ];
97 ];
96
98
97 pub fn title(self) -> &'static str {
99 pub fn title(self) -> String {
98 match self {
100 match self {
99 Group::General => "General",
101 Group::General => tr("shortcuts.group.general"),
100 Group::Navigation => "Navigation",
102 Group::Navigation => tr("shortcuts.group.navigation"),
101 Group::Composer => "Messages and composer",
103 Group::Composer => tr("shortcuts.group.composer"),
102 Group::Calls => "Calls",
104 Group::Calls => tr("shortcuts.group.calls"),
103 }
105 }
104 }
106 }
105}
107}
crates/app/src/views/shortcuts_dialog.rs +2 −1
@@ -4,6 +4,7 @@ use gpui_kit::*;
4 4
5 5 use super::shortcuts::{Group, shortcuts_in};
6 6 use super::widgets::symbol;
7 use crate::i18n::tr;
7 8 use crate::theme::{self, ElevatedSurface as _};
8 9
9 10 const CARD_WIDTH: f32 = 520.;
@@ -50,7 +51,7 @@ impl ShortcutsDialog {
50 51 .flex_1()
51 52 .text_size(px(15.))
52 53 .font_weight(FontWeight::SEMIBOLD)
53 .child("Keyboard shortcuts"),
54 .child(tr("shortcuts.title")),
54 55 )
55 56 .child(
56 57 div()
@@ -4,6 +4,7 @@ use gpui_kit::*;
4
4
5use super::shortcuts::{Group, shortcuts_in};
5use super::shortcuts::{Group, shortcuts_in};
6use super::widgets::symbol;
6use super::widgets::symbol;
7use crate::i18n::tr;
7use crate::theme::{self, ElevatedSurface as _};
8use crate::theme::{self, ElevatedSurface as _};
8
9
9const CARD_WIDTH: f32 = 520.;
10const CARD_WIDTH: f32 = 520.;
@@ -50,7 +51,7 @@ impl ShortcutsDialog {
50 .flex_1()
51 .flex_1()
51 .text_size(px(15.))
52 .text_size(px(15.))
52 .font_weight(FontWeight::SEMIBOLD)
53 .font_weight(FontWeight::SEMIBOLD)
53 .child("Keyboard shortcuts"),
54 .child(tr("shortcuts.title")),
54 )
55 )
55 .child(
56 .child(
56 div()
57 div()
crates/app/src/views/sidebar.rs +62 −58
@@ -35,6 +35,7 @@ use crate::chat_actions::TITLE_LIMIT;
35 35 use crate::chat_filter::{ChatFilter, filtered_sections, has_no_matches};
36 36 use crate::data::{AvatarState, Directory, is_pending_folder};
37 37 use crate::format;
38 use crate::i18n::{tr, tr_args};
38 39 use crate::local_previews::LocalPreview;
39 40 use crate::notice::truncated;
40 41 use crate::sidebar_model::{
@@ -61,7 +62,6 @@ const PINNED_CHANNEL_HEIGHT: f32 = 48.;
61 62 const SECTION_HEIGHT: f32 = 30.;
62 63 const SECTION_GAP: f32 = 4.;
63 64 const QUICK_VIEWS_SECTION_ID: &str = "quick-views";
64 const QUICK_VIEWS_TITLE: &str = "Quick views";
65 65 const QUICK_ROW_HEIGHT: f32 = 32.;
66 66 const QUICK_ICON_SIZE: f32 = 18.;
67 67 const QUICK_VIEWS: [(QuickView, &str); 3] = [
@@ -71,15 +71,9 @@ const QUICK_VIEWS: [(QuickView, &str); 3] = [
71 71 ];
72 72 const HINT_HEIGHT: f32 = 26.;
73 73 const SEE_MORE_HEIGHT: f32 = 28.;
74 const LOADING_OLDER_LABEL: &str = "Loading older chats";
75 74 const FALLBACK_VIEWPORT: f32 = 900.;
76 75 const VIEWPORT_MARGIN: f32 = 300.;
77 76 const AVATAR_SIZE: f32 = 36.;
78 const PINNED_LABEL: &str = "Pinned";
79 const TEAMS_LABEL: &str = "Teams";
80 const MARK_ALL_READ_LABEL: &str = "Mark all as read";
81 const COLLAPSE_ALL_LABEL: &str = "Collapse all sections";
82 const HIDDEN_TEAMS_LABEL: &str = "Hidden teams";
83 77 const TEAM_ROW_HEIGHT: f32 = 36.;
84 78 const CHANNEL_ROW_HEIGHT: f32 = 32.;
85 79 const TEAM_ICON_SIZE: f32 = 20.;
@@ -87,8 +81,6 @@ const TEAM_ICON_RADIUS: f32 = 4.;
87 81 const CHANNEL_INDENT: f32 = 60.;
88 82 pub const CHANNEL_ROW_TAG: &str = "sidebar/channel-row";
89 83 pub const SEE_ALL_CHANNELS_TAG: &str = "sidebar/see-all-channels";
90 const SEE_ALL_CHANNELS: &str = "See all channels";
91 const SEE_FEWER_CHANNELS: &str = "See fewer channels";
92 84 const PRIVATE_MEMBERSHIP: &str = "private";
93 85 const REVEAL_ROW_HEIGHT: f32 = 32.;
94 86 const NEW_CHAT_BUTTON_SIZE: f32 = 32.;
@@ -107,14 +99,14 @@ pub enum SidebarTab {
107 99 }
108 100
109 101 impl SidebarTab {
110 fn title(self) -> &'static str {
102 fn title(self) -> String {
111 103 match self {
112 SidebarTab::Activity => "Activity",
113 SidebarTab::Chats => "Chat",
114 SidebarTab::Channels => "Teams",
115 SidebarTab::Calendar => "Calendar",
116 SidebarTab::Calls => "Calls",
117 SidebarTab::Agents => "Agents",
104 SidebarTab::Activity => tr("rail.activity"),
105 SidebarTab::Chats => tr("rail.chat"),
106 SidebarTab::Channels => tr("rail.teams"),
107 SidebarTab::Calendar => tr("rail.calendar"),
108 SidebarTab::Calls => tr("rail.calls"),
109 SidebarTab::Agents => tr("rail.agents"),
118 110 }
119 111 }
120 112 }
@@ -205,7 +197,7 @@ fn drop_target(section: &Section) -> Option<Option<String>> {
205 197
206 198 fn new_section_item(state: &Entity<AppState>, read_only: bool) -> PopupMenuItem {
207 199 let state = state.clone();
208 PopupMenuItem::new("New section")
200 PopupMenuItem::new(tr("sidebar.new_section"))
209 201 .icon(menu_icon(IconName::Plus))
210 202 .disabled(read_only)
211 203 .on_click(move |_, window, cx| {
@@ -215,7 +207,7 @@ fn new_section_item(state: &Entity<AppState>, read_only: bool) -> PopupMenuItem
215 207
216 208 fn move_section_item(
217 209 state: &Entity<AppState>,
218 label: &'static str,
210 label: String,
219 211 glyph: IconName,
220 212 folder_id: &str,
221 213 target_id: Option<&String>,
@@ -249,7 +241,7 @@ fn section_menu(
249 241 name: target.name.clone(),
250 242 };
251 243 popup = popup.item(
252 PopupMenuItem::new("Rename section")
244 PopupMenuItem::new(tr("sidebar.rename_section"))
253 245 .icon(menu_icon(IconName::Pencil))
254 246 .disabled(target.read_only)
255 247 .on_click(move |_, window, cx| {
@@ -266,7 +258,7 @@ fn section_menu(
266 258 popup = popup
267 259 .item(move_section_item(
268 260 state,
269 "Move up",
261 tr("sidebar.move_up"),
270 262 IconName::ArrowUp,
271 263 &target.id,
272 264 target.previous_id.as_ref(),
@@ -274,7 +266,7 @@ fn section_menu(
274 266 ))
275 267 .item(move_section_item(
276 268 state,
277 "Move down",
269 tr("sidebar.move_down"),
278 270 IconName::ArrowDown,
279 271 &target.id,
280 272 target.next_id.as_ref(),
@@ -288,7 +280,9 @@ fn section_menu(
288 280 let (folder_id, name) = (target.id.clone(), target.name.clone());
289 281 popup = popup.separator().item(
290 282 PopupMenuItem::element(|_, _| {
291 div().text_color(theme::red_soft()).child("Delete section")
283 div()
284 .text_color(theme::red_soft())
285 .child(tr("sidebar.delete_section"))
292 286 })
293 287 .icon(menu_icon(IconName::Trash).text_color(theme::red_soft()))
294 288 .disabled(target.read_only)
@@ -309,15 +303,17 @@ fn confirm_delete_section(
309 303 ) {
310 304 let state = state.clone();
311 305 let folder_id = folder_id.to_owned();
312 let heading = format!("Delete section \"{}\"?", truncated(name, TITLE_LIMIT));
306 let mut args = HashMap::new();
307 args.insert("name".to_owned(), truncated(name, TITLE_LIMIT));
308 let heading = tr_args("sidebar.delete_section_title", &args);
313 309 window.open_alert_dialog(cx, move |alert, _, _| {
314 310 let state = state.clone();
315 311 let folder_id = folder_id.clone();
316 312 let cancel = Button::new("delete-section-cancel")
317 .label("Cancel")
313 .label(tr("common.cancel"))
318 314 .on_click(|_, window, cx| window.close_dialog(cx));
319 315 let delete = Button::new("delete-section-confirm")
320 .label("Delete")
316 .label(tr("common.delete"))
321 317 .danger()
322 318 .on_click(move |_, window, cx| {
323 319 state.update(cx, |state, cx| state.delete_section(&folder_id, cx));
@@ -325,7 +321,7 @@ fn confirm_delete_section(
325 321 });
326 322 alert
327 323 .title(heading.clone())
328 .description("Chats in it move back to Chats.")
324 .description(tr("sidebar.delete_section_detail"))
329 325 .footer(DialogFooter::new().child(cancel).child(delete))
330 326 .on_ok(|_, _, _| false)
331 327 });
@@ -397,14 +393,14 @@ fn local_preview_row(preview: &LocalPreview, color: Hsla) -> Div {
397 393 div()
398 394 .flex_none()
399 395 .text_color(theme::accent_text())
400 .child("Draft:"),
396 .child(tr("sidebar.draft_prefix")),
401 397 )
402 398 .child(div().truncate().child(text.clone())),
403 399 LocalPreview::NotSent => row.child(
404 400 div()
405 401 .flex_none()
406 402 .text_color(theme::red_soft())
407 .child("Not sent"),
403 .child(tr("sidebar.not_sent")),
408 404 ),
409 405 }
410 406 }
@@ -658,7 +654,7 @@ impl SidebarView {
658 654 .cursor_pointer()
659 655 .when(active, |button| button.bg(theme::popup_hover()))
660 656 .hover(|button| button.bg(theme::popup_hover()))
661 .tooltip(|window, cx| Tooltip::new("New chat (Ctrl+N)").build(window, cx))
657 .tooltip(|window, cx| Tooltip::new(tr("sidebar.new_chat_shortcut")).build(window, cx))
662 658 .child(icon(IconName::Pencil, 16., theme::text_soft()))
663 659 .on_click(cx.listener(|this, _, _, cx| {
664 660 this.state.update(cx, |state, cx| state.start_new_chat(cx));
@@ -674,12 +670,12 @@ impl SidebarView {
674 670 .ghost()
675 671 .size(px(NEW_CHAT_BUTTON_SIZE))
676 672 .rounded(px(8.))
677 .tooltip("More options")
673 .tooltip(tr("sidebar.more_options"))
678 674 .dropdown_menu(move |menu, _, _| {
679 675 let (read_state, collapse_state) = (state.clone(), state.clone());
680 676 let section_ids = section_ids.clone();
681 677 menu.item(
682 PopupMenuItem::new(MARK_ALL_READ_LABEL)
678 PopupMenuItem::new(tr("sidebar.mark_all_read"))
683 679 .icon(menu_icon(IconName::CheckCheck))
684 680 .disabled(read_only)
685 681 .on_click(move |_, _, cx| {
@@ -687,7 +683,7 @@ impl SidebarView {
687 683 }),
688 684 )
689 685 .item(
690 PopupMenuItem::new(COLLAPSE_ALL_LABEL)
686 PopupMenuItem::new(tr("sidebar.collapse_all"))
691 687 .icon(menu_icon(IconName::ChevronsDownUp))
692 688 .on_click(move |_, _, cx| {
693 689 let ids = section_ids.clone();
@@ -717,11 +713,11 @@ impl SidebarView {
717 713 .ghost()
718 714 .size(px(NEW_CHAT_BUTTON_SIZE))
719 715 .rounded(px(8.))
720 .tooltip("More options")
716 .tooltip(tr("sidebar.more_options"))
721 717 .dropdown_menu(move |menu, _, _| {
722 718 let (state, view, team_ids) = (state.clone(), view.clone(), team_ids.clone());
723 719 menu.item(
724 PopupMenuItem::new(MARK_ALL_READ_LABEL)
720 PopupMenuItem::new(tr("sidebar.mark_all_read"))
725 721 .icon(menu_icon(IconName::CheckCheck))
726 722 .disabled(read_only)
727 723 .on_click(move |_, _, cx| {
@@ -729,7 +725,7 @@ impl SidebarView {
729 725 }),
730 726 )
731 727 .item(
732 PopupMenuItem::new(COLLAPSE_ALL_LABEL)
728 PopupMenuItem::new(tr("sidebar.collapse_all"))
733 729 .icon(menu_icon(IconName::ChevronsDownUp))
734 730 .on_click(move |_, _, cx| {
735 731 let team_ids = team_ids.clone();
@@ -772,14 +768,14 @@ impl SidebarView {
772 768 .truncate()
773 769 .text_size(px(14.))
774 770 .text_color(theme::text())
775 .child("New chat"),
771 .child(tr("sidebar.new_chat")),
776 772 )
777 773 .child(
778 774 div()
779 775 .truncate()
780 776 .text_size(px(12.5))
781 777 .text_color(theme::text_muted())
782 .child("Draft"),
778 .child(tr("sidebar.draft")),
783 779 ),
784 780 )
785 781 }
@@ -884,7 +880,7 @@ impl SidebarView {
884 880 .text_size(px(12.))
885 881 .font_weight(FontWeight::SEMIBOLD)
886 882 .text_color(theme::text_soft())
887 .child(QUICK_VIEWS_TITLE),
883 .child(tr("sidebar.quick_views")),
888 884 )
889 885 .on_click(cx.listener(|this, _, _, cx| {
890 886 this.state.update(cx, |state, cx| {
@@ -939,9 +935,11 @@ impl SidebarView {
939 935 fn see_more_row(&self, section: &Section, cx: &mut Context<Self>) -> impl IntoElement {
940 936 let toggle_id = section.id.clone();
941 937 let label = if section.hidden_count > 0 {
942 format!("See more ({})", section.hidden_count)
938 let mut args = HashMap::new();
939 args.insert("count".to_owned(), section.hidden_count.to_string());
940 tr_args("sidebar.see_more", &args)
943 941 } else {
944 "See less".to_owned()
942 tr("sidebar.see_less")
945 943 };
946 944 div()
947 945 .id(SharedString::from(format!("see-more-{}", section.id)))
@@ -1109,7 +1107,7 @@ impl SidebarView {
1109 1107 .ghost()
1110 1108 .xsmall()
1111 1109 .icon(IconName::Ellipsis)
1112 .tooltip("More options")
1110 .tooltip(tr("sidebar.more_options"))
1113 1111 .dropdown_menu(move |popup, window, cx| {
1114 1112 chat_menu(popup, window, cx, &more_context, &more_target)
1115 1113 }),
@@ -1315,7 +1313,7 @@ impl SidebarView {
1315 1313 .text_size(px(12.5))
1316 1314 .italic()
1317 1315 .text_color(theme::text_faint())
1318 .child(LOADING_OLDER_LABEL),
1316 .child(tr("sidebar.loading_older")),
1319 1317 );
1320 1318 }
1321 1319 let selected_chat_id = self.selected_chat_id(cx);
@@ -1447,7 +1445,7 @@ impl SidebarView {
1447 1445 .into_any_element()
1448 1446 }
1449 1447
1450 fn plain_header(&self, label: &str) -> impl IntoElement {
1448 fn plain_header(&self, label: impl Into<SharedString>) -> impl IntoElement {
1451 1449 div()
1452 1450 .h(px(SECTION_HEIGHT))
1453 1451 .mt(px(SECTION_GAP))
@@ -1457,7 +1455,7 @@ impl SidebarView {
1457 1455 .text_size(px(12.))
1458 1456 .font_weight(FontWeight::SEMIBOLD)
1459 1457 .text_color(theme::text_soft())
1460 .child(label.to_owned())
1458 .child(label.into())
1461 1459 }
1462 1460
1463 1461 fn team_block(
@@ -1602,9 +1600,9 @@ impl SidebarView {
1602 1600 .text_size(px(13.5))
1603 1601 .text_color(theme::accent_text())
1604 1602 .child(if open {
1605 SEE_FEWER_CHANNELS
1603 tr("sidebar.see_fewer_channels")
1606 1604 } else {
1607 SEE_ALL_CHANNELS
1605 tr("sidebar.see_all_channels")
1608 1606 })
1609 1607 .on_click(on_click)
1610 1608 }
@@ -1775,7 +1773,7 @@ impl SidebarView {
1775 1773 })
1776 1774 .collect();
1777 1775 if !pinned.is_empty() {
1778 list = list.child(self.plain_header(PINNED_LABEL));
1776 list = list.child(self.plain_header(tr("sidebar.pinned")));
1779 1777 for (entry, channel) in pinned {
1780 1778 let is_selected = selected == Some(Selection::Channel(channel.id.clone()));
1781 1779 list = list.child(self.channel_row(
@@ -1787,7 +1785,7 @@ impl SidebarView {
1787 1785 ));
1788 1786 }
1789 1787 }
1790 list = list.child(self.plain_header(TEAMS_LABEL));
1788 list = list.child(self.plain_header(tr("sidebar.teams")));
1791 1789 let hidden_teams: Vec<&SidebarTeam> =
1792 1790 sidebar.teams.iter().filter(|entry| entry.hidden).collect();
1793 1791 for entry in sidebar
@@ -1805,7 +1803,7 @@ impl SidebarView {
1805 1803 let open = self.hidden_teams_open || holds_selection;
1806 1804 list = list.child(self.reveal_row(
1807 1805 "hidden-teams".into(),
1808 format!("{HIDDEN_TEAMS_LABEL} ({})", hidden_teams.len()),
1806 format!("{} ({})", tr("sidebar.hidden_teams"), hidden_teams.len()),
1809 1807 open,
1810 1808 10.,
1811 1809 cx.listener(|this, _, _, cx| {
@@ -2002,11 +2000,11 @@ fn notifications_submenu(
2002 2000 let (state, channel_id) = (state.clone(), channel_id.to_owned());
2003 2001 popup.submenu_with_icon(
2004 2002 Some(menu_icon(IconName::Bell)),
2005 "Notifications",
2003 tr("sidebar.notifications"),
2006 2004 window,
2007 2005 cx,
2008 2006 move |submenu, _, _| {
2009 let level_item = |label: &'static str, level: ChannelNotificationLevel| {
2007 let level_item = |label: String, level: ChannelNotificationLevel| {
2010 2008 let (state, channel_id) = (state.clone(), channel_id.clone());
2011 2009 PopupMenuItem::new(label)
2012 2010 .checked(notifications.level == level)
@@ -2024,14 +2022,20 @@ fn notifications_submenu(
2024 2022 let (replies_state, replies_id) = (state.clone(), channel_id.clone());
2025 2023 submenu
2026 2024 .item(level_item(
2027 "Banner and activity",
2025 tr("sidebar.notify_banner_activity"),
2028 2026 ChannelNotificationLevel::BannerAndFeed,
2029 2027 ))
2030 .item(level_item("Activity only", ChannelNotificationLevel::Feed))
2031 .item(level_item("Off", ChannelNotificationLevel::Off))
2028 .item(level_item(
2029 tr("sidebar.notify_activity_only"),
2030 ChannelNotificationLevel::Feed,
2031 ))
2032 .item(level_item(
2033 tr("sidebar.notify_off"),
2034 ChannelNotificationLevel::Off,
2035 ))
2032 2036 .separator()
2033 2037 .item(
2034 PopupMenuItem::new("Include thread replies")
2038 PopupMenuItem::new(tr("sidebar.include_thread_replies"))
2035 2039 .checked(notifications.include_replies)
2036 2040 .disabled(notifications.level == ChannelNotificationLevel::Off)
2037 2041 .on_click(move |_, _, cx| {
@@ -2140,7 +2144,7 @@ impl Render for SidebarView {
2140 2144 v_flex()
2141 2145 .flex_none()
2142 2146 .child(
2143 page_header(self.tab.title())
2147 page_header(&self.tab.title())
2144 2148 .child(self.chat_list_menu_button(cx))
2145 2149 .child(self.filter_toggle_button(cx))
2146 2150 .child(self.new_chat_button(cx)),
@@ -2151,14 +2155,14 @@ impl Render for SidebarView {
2151 2155 v_flex()
2152 2156 .flex_none()
2153 2157 .child(
2154 page_header(self.tab.title())
2158 page_header(&self.tab.title())
2155 2159 .child(self.channel_list_menu_button(cx))
2156 2160 .child(self.channel_filter_button(cx))
2157 2161 .child(self.new_channel_items_button(cx)),
2158 2162 )
2159 2163 .child(self.channel_filter_bar(cx)),
2160 2164 ),
2161 SidebarTab::Agents => Some(page_header(self.tab.title())),
2165 SidebarTab::Agents => Some(page_header(&self.tab.title())),
2162 2166 SidebarTab::Activity | SidebarTab::Calls | SidebarTab::Calendar => None,
2163 2167 };
2164 2168 v_flex()
@@ -35,6 +35,7 @@ use crate::chat_actions::TITLE_LIMIT;
35use crate::chat_filter::{ChatFilter, filtered_sections, has_no_matches};
35use crate::chat_filter::{ChatFilter, filtered_sections, has_no_matches};
36use crate::data::{AvatarState, Directory, is_pending_folder};
36use crate::data::{AvatarState, Directory, is_pending_folder};
37use crate::format;
37use crate::format;
38use crate::i18n::{tr, tr_args};
38use crate::local_previews::LocalPreview;
39use crate::local_previews::LocalPreview;
39use crate::notice::truncated;
40use crate::notice::truncated;
40use crate::sidebar_model::{
41use crate::sidebar_model::{
@@ -61,7 +62,6 @@ const PINNED_CHANNEL_HEIGHT: f32 = 48.;
61const SECTION_HEIGHT: f32 = 30.;
62const SECTION_HEIGHT: f32 = 30.;
62const SECTION_GAP: f32 = 4.;
63const SECTION_GAP: f32 = 4.;
63const QUICK_VIEWS_SECTION_ID: &str = "quick-views";
64const QUICK_VIEWS_SECTION_ID: &str = "quick-views";
64const QUICK_VIEWS_TITLE: &str = "Quick views";
65const QUICK_ROW_HEIGHT: f32 = 32.;
65const QUICK_ROW_HEIGHT: f32 = 32.;
66const QUICK_ICON_SIZE: f32 = 18.;
66const QUICK_ICON_SIZE: f32 = 18.;
67const QUICK_VIEWS: [(QuickView, &str); 3] = [
67const QUICK_VIEWS: [(QuickView, &str); 3] = [
@@ -71,15 +71,9 @@ const QUICK_VIEWS: [(QuickView, &str); 3] = [
71];
71];
72const HINT_HEIGHT: f32 = 26.;
72const HINT_HEIGHT: f32 = 26.;
73const SEE_MORE_HEIGHT: f32 = 28.;
73const SEE_MORE_HEIGHT: f32 = 28.;
74const LOADING_OLDER_LABEL: &str = "Loading older chats";
75const FALLBACK_VIEWPORT: f32 = 900.;
74const FALLBACK_VIEWPORT: f32 = 900.;
76const VIEWPORT_MARGIN: f32 = 300.;
75const VIEWPORT_MARGIN: f32 = 300.;
77const AVATAR_SIZE: f32 = 36.;
76const AVATAR_SIZE: f32 = 36.;
78const PINNED_LABEL: &str = "Pinned";
79const TEAMS_LABEL: &str = "Teams";
80const MARK_ALL_READ_LABEL: &str = "Mark all as read";
81const COLLAPSE_ALL_LABEL: &str = "Collapse all sections";
82const HIDDEN_TEAMS_LABEL: &str = "Hidden teams";
83const TEAM_ROW_HEIGHT: f32 = 36.;
77const TEAM_ROW_HEIGHT: f32 = 36.;
84const CHANNEL_ROW_HEIGHT: f32 = 32.;
78const CHANNEL_ROW_HEIGHT: f32 = 32.;
85const TEAM_ICON_SIZE: f32 = 20.;
79const TEAM_ICON_SIZE: f32 = 20.;
@@ -87,8 +81,6 @@ const TEAM_ICON_RADIUS: f32 = 4.;
87const CHANNEL_INDENT: f32 = 60.;
81const CHANNEL_INDENT: f32 = 60.;
88pub const CHANNEL_ROW_TAG: &str = "sidebar/channel-row";
82pub const CHANNEL_ROW_TAG: &str = "sidebar/channel-row";
89pub const SEE_ALL_CHANNELS_TAG: &str = "sidebar/see-all-channels";
83pub const SEE_ALL_CHANNELS_TAG: &str = "sidebar/see-all-channels";
90const SEE_ALL_CHANNELS: &str = "See all channels";
91const SEE_FEWER_CHANNELS: &str = "See fewer channels";
92const PRIVATE_MEMBERSHIP: &str = "private";
84const PRIVATE_MEMBERSHIP: &str = "private";
93const REVEAL_ROW_HEIGHT: f32 = 32.;
85const REVEAL_ROW_HEIGHT: f32 = 32.;
94const NEW_CHAT_BUTTON_SIZE: f32 = 32.;
86const NEW_CHAT_BUTTON_SIZE: f32 = 32.;
@@ -107,14 +99,14 @@ pub enum SidebarTab {
107}
99}
108
100
109impl SidebarTab {
101impl SidebarTab {
110 fn title(self) -> &'static str {
102 fn title(self) -> String {
111 match self {
103 match self {
112 SidebarTab::Activity => "Activity",
104 SidebarTab::Activity => tr("rail.activity"),
113 SidebarTab::Chats => "Chat",
105 SidebarTab::Chats => tr("rail.chat"),
114 SidebarTab::Channels => "Teams",
106 SidebarTab::Channels => tr("rail.teams"),
115 SidebarTab::Calendar => "Calendar",
107 SidebarTab::Calendar => tr("rail.calendar"),
116 SidebarTab::Calls => "Calls",
108 SidebarTab::Calls => tr("rail.calls"),
117 SidebarTab::Agents => "Agents",
109 SidebarTab::Agents => tr("rail.agents"),
118 }
110 }
119 }
111 }
120}
112}
@@ -205,7 +197,7 @@ fn drop_target(section: &Section) -> Option<Option<String>> {
205
197
206fn new_section_item(state: &Entity<AppState>, read_only: bool) -> PopupMenuItem {
198fn new_section_item(state: &Entity<AppState>, read_only: bool) -> PopupMenuItem {
207 let state = state.clone();
199 let state = state.clone();
208 PopupMenuItem::new("New section")
200 PopupMenuItem::new(tr("sidebar.new_section"))
209 .icon(menu_icon(IconName::Plus))
201 .icon(menu_icon(IconName::Plus))
210 .disabled(read_only)
202 .disabled(read_only)
211 .on_click(move |_, window, cx| {
203 .on_click(move |_, window, cx| {
@@ -215,7 +207,7 @@ fn new_section_item(state: &Entity<AppState>, read_only: bool) -> PopupMenuItem
215
207
216fn move_section_item(
208fn move_section_item(
217 state: &Entity<AppState>,
209 state: &Entity<AppState>,
218 label: &'static str,
210 label: String,
219 glyph: IconName,
211 glyph: IconName,
220 folder_id: &str,
212 folder_id: &str,
221 target_id: Option<&String>,
213 target_id: Option<&String>,
@@ -249,7 +241,7 @@ fn section_menu(
249 name: target.name.clone(),
241 name: target.name.clone(),
250 };
242 };
251 popup = popup.item(
243 popup = popup.item(
252 PopupMenuItem::new("Rename section")
244 PopupMenuItem::new(tr("sidebar.rename_section"))
253 .icon(menu_icon(IconName::Pencil))
245 .icon(menu_icon(IconName::Pencil))
254 .disabled(target.read_only)
246 .disabled(target.read_only)
255 .on_click(move |_, window, cx| {
247 .on_click(move |_, window, cx| {
@@ -266,7 +258,7 @@ fn section_menu(
266 popup = popup
258 popup = popup
267 .item(move_section_item(
259 .item(move_section_item(
268 state,
260 state,
269 "Move up",
261 tr("sidebar.move_up"),
270 IconName::ArrowUp,
262 IconName::ArrowUp,
271 &target.id,
263 &target.id,
272 target.previous_id.as_ref(),
264 target.previous_id.as_ref(),
@@ -274,7 +266,7 @@ fn section_menu(
274 ))
266 ))
275 .item(move_section_item(
267 .item(move_section_item(
276 state,
268 state,
277 "Move down",
269 tr("sidebar.move_down"),
278 IconName::ArrowDown,
270 IconName::ArrowDown,
279 &target.id,
271 &target.id,
280 target.next_id.as_ref(),
272 target.next_id.as_ref(),
@@ -288,7 +280,9 @@ fn section_menu(
288 let (folder_id, name) = (target.id.clone(), target.name.clone());
280 let (folder_id, name) = (target.id.clone(), target.name.clone());
289 popup = popup.separator().item(
281 popup = popup.separator().item(
290 PopupMenuItem::element(|_, _| {
282 PopupMenuItem::element(|_, _| {
291 div().text_color(theme::red_soft()).child("Delete section")
283 div()
284 .text_color(theme::red_soft())
285 .child(tr("sidebar.delete_section"))
292 })
286 })
293 .icon(menu_icon(IconName::Trash).text_color(theme::red_soft()))
287 .icon(menu_icon(IconName::Trash).text_color(theme::red_soft()))
294 .disabled(target.read_only)
288 .disabled(target.read_only)
@@ -309,15 +303,17 @@ fn confirm_delete_section(
309) {
303) {
310 let state = state.clone();
304 let state = state.clone();
311 let folder_id = folder_id.to_owned();
305 let folder_id = folder_id.to_owned();
312 let heading = format!("Delete section \"{}\"?", truncated(name, TITLE_LIMIT));
306 let mut args = HashMap::new();
307 args.insert("name".to_owned(), truncated(name, TITLE_LIMIT));
308 let heading = tr_args("sidebar.delete_section_title", &args);
313 window.open_alert_dialog(cx, move |alert, _, _| {
309 window.open_alert_dialog(cx, move |alert, _, _| {
314 let state = state.clone();
310 let state = state.clone();
315 let folder_id = folder_id.clone();
311 let folder_id = folder_id.clone();
316 let cancel = Button::new("delete-section-cancel")
312 let cancel = Button::new("delete-section-cancel")
317 .label("Cancel")
313 .label(tr("common.cancel"))
318 .on_click(|_, window, cx| window.close_dialog(cx));
314 .on_click(|_, window, cx| window.close_dialog(cx));
319 let delete = Button::new("delete-section-confirm")
315 let delete = Button::new("delete-section-confirm")
320 .label("Delete")
316 .label(tr("common.delete"))
321 .danger()
317 .danger()
322 .on_click(move |_, window, cx| {
318 .on_click(move |_, window, cx| {
323 state.update(cx, |state, cx| state.delete_section(&folder_id, cx));
319 state.update(cx, |state, cx| state.delete_section(&folder_id, cx));
@@ -325,7 +321,7 @@ fn confirm_delete_section(
325 });
321 });
326 alert
322 alert
327 .title(heading.clone())
323 .title(heading.clone())
328 .description("Chats in it move back to Chats.")
324 .description(tr("sidebar.delete_section_detail"))
329 .footer(DialogFooter::new().child(cancel).child(delete))
325 .footer(DialogFooter::new().child(cancel).child(delete))
330 .on_ok(|_, _, _| false)
326 .on_ok(|_, _, _| false)
331 });
327 });
@@ -397,14 +393,14 @@ fn local_preview_row(preview: &LocalPreview, color: Hsla) -> Div {
397 div()
393 div()
398 .flex_none()
394 .flex_none()
399 .text_color(theme::accent_text())
395 .text_color(theme::accent_text())
400 .child("Draft:"),
396 .child(tr("sidebar.draft_prefix")),
401 )
397 )
402 .child(div().truncate().child(text.clone())),
398 .child(div().truncate().child(text.clone())),
403 LocalPreview::NotSent => row.child(
399 LocalPreview::NotSent => row.child(
404 div()
400 div()
405 .flex_none()
401 .flex_none()
406 .text_color(theme::red_soft())
402 .text_color(theme::red_soft())
407 .child("Not sent"),
403 .child(tr("sidebar.not_sent")),
408 ),
404 ),
409 }
405 }
410}
406}
@@ -658,7 +654,7 @@ impl SidebarView {
658 .cursor_pointer()
654 .cursor_pointer()
659 .when(active, |button| button.bg(theme::popup_hover()))
655 .when(active, |button| button.bg(theme::popup_hover()))
660 .hover(|button| button.bg(theme::popup_hover()))
656 .hover(|button| button.bg(theme::popup_hover()))
661 .tooltip(|window, cx| Tooltip::new("New chat (Ctrl+N)").build(window, cx))
657 .tooltip(|window, cx| Tooltip::new(tr("sidebar.new_chat_shortcut")).build(window, cx))
662 .child(icon(IconName::Pencil, 16., theme::text_soft()))
658 .child(icon(IconName::Pencil, 16., theme::text_soft()))
663 .on_click(cx.listener(|this, _, _, cx| {
659 .on_click(cx.listener(|this, _, _, cx| {
664 this.state.update(cx, |state, cx| state.start_new_chat(cx));
660 this.state.update(cx, |state, cx| state.start_new_chat(cx));
@@ -674,12 +670,12 @@ impl SidebarView {
674 .ghost()
670 .ghost()
675 .size(px(NEW_CHAT_BUTTON_SIZE))
671 .size(px(NEW_CHAT_BUTTON_SIZE))
676 .rounded(px(8.))
672 .rounded(px(8.))
677 .tooltip("More options")
673 .tooltip(tr("sidebar.more_options"))
678 .dropdown_menu(move |menu, _, _| {
674 .dropdown_menu(move |menu, _, _| {
679 let (read_state, collapse_state) = (state.clone(), state.clone());
675 let (read_state, collapse_state) = (state.clone(), state.clone());
680 let section_ids = section_ids.clone();
676 let section_ids = section_ids.clone();
681 menu.item(
677 menu.item(
682 PopupMenuItem::new(MARK_ALL_READ_LABEL)
678 PopupMenuItem::new(tr("sidebar.mark_all_read"))
683 .icon(menu_icon(IconName::CheckCheck))
679 .icon(menu_icon(IconName::CheckCheck))
684 .disabled(read_only)
680 .disabled(read_only)
685 .on_click(move |_, _, cx| {
681 .on_click(move |_, _, cx| {
@@ -687,7 +683,7 @@ impl SidebarView {
687 }),
683 }),
688 )
684 )
689 .item(
685 .item(
690 PopupMenuItem::new(COLLAPSE_ALL_LABEL)
686 PopupMenuItem::new(tr("sidebar.collapse_all"))
691 .icon(menu_icon(IconName::ChevronsDownUp))
687 .icon(menu_icon(IconName::ChevronsDownUp))
692 .on_click(move |_, _, cx| {
688 .on_click(move |_, _, cx| {
693 let ids = section_ids.clone();
689 let ids = section_ids.clone();
@@ -717,11 +713,11 @@ impl SidebarView {
717 .ghost()
713 .ghost()
718 .size(px(NEW_CHAT_BUTTON_SIZE))
714 .size(px(NEW_CHAT_BUTTON_SIZE))
719 .rounded(px(8.))
715 .rounded(px(8.))
720 .tooltip("More options")
716 .tooltip(tr("sidebar.more_options"))
721 .dropdown_menu(move |menu, _, _| {
717 .dropdown_menu(move |menu, _, _| {
722 let (state, view, team_ids) = (state.clone(), view.clone(), team_ids.clone());
718 let (state, view, team_ids) = (state.clone(), view.clone(), team_ids.clone());
723 menu.item(
719 menu.item(
724 PopupMenuItem::new(MARK_ALL_READ_LABEL)
720 PopupMenuItem::new(tr("sidebar.mark_all_read"))
725 .icon(menu_icon(IconName::CheckCheck))
721 .icon(menu_icon(IconName::CheckCheck))
726 .disabled(read_only)
722 .disabled(read_only)
727 .on_click(move |_, _, cx| {
723 .on_click(move |_, _, cx| {
@@ -729,7 +725,7 @@ impl SidebarView {
729 }),
725 }),
730 )
726 )
731 .item(
727 .item(
732 PopupMenuItem::new(COLLAPSE_ALL_LABEL)
728 PopupMenuItem::new(tr("sidebar.collapse_all"))
733 .icon(menu_icon(IconName::ChevronsDownUp))
729 .icon(menu_icon(IconName::ChevronsDownUp))
734 .on_click(move |_, _, cx| {
730 .on_click(move |_, _, cx| {
735 let team_ids = team_ids.clone();
731 let team_ids = team_ids.clone();
@@ -772,14 +768,14 @@ impl SidebarView {
772 .truncate()
768 .truncate()
773 .text_size(px(14.))
769 .text_size(px(14.))
774 .text_color(theme::text())
770 .text_color(theme::text())
775 .child("New chat"),
771 .child(tr("sidebar.new_chat")),
776 )
772 )
777 .child(
773 .child(
778 div()
774 div()
779 .truncate()
775 .truncate()
780 .text_size(px(12.5))
776 .text_size(px(12.5))
781 .text_color(theme::text_muted())
777 .text_color(theme::text_muted())
782 .child("Draft"),
778 .child(tr("sidebar.draft")),
783 ),
779 ),
784 )
780 )
785 }
781 }
@@ -884,7 +880,7 @@ impl SidebarView {
884 .text_size(px(12.))
880 .text_size(px(12.))
885 .font_weight(FontWeight::SEMIBOLD)
881 .font_weight(FontWeight::SEMIBOLD)
886 .text_color(theme::text_soft())
882 .text_color(theme::text_soft())
887 .child(QUICK_VIEWS_TITLE),
883 .child(tr("sidebar.quick_views")),
888 )
884 )
889 .on_click(cx.listener(|this, _, _, cx| {
885 .on_click(cx.listener(|this, _, _, cx| {
890 this.state.update(cx, |state, cx| {
886 this.state.update(cx, |state, cx| {
@@ -939,9 +935,11 @@ impl SidebarView {
939 fn see_more_row(&self, section: &Section, cx: &mut Context<Self>) -> impl IntoElement {
935 fn see_more_row(&self, section: &Section, cx: &mut Context<Self>) -> impl IntoElement {
940 let toggle_id = section.id.clone();
936 let toggle_id = section.id.clone();
941 let label = if section.hidden_count > 0 {
937 let label = if section.hidden_count > 0 {
942 format!("See more ({})", section.hidden_count)
938 let mut args = HashMap::new();
939 args.insert("count".to_owned(), section.hidden_count.to_string());
940 tr_args("sidebar.see_more", &args)
943 } else {
941 } else {
944 "See less".to_owned()
942 tr("sidebar.see_less")
945 };
943 };
946 div()
944 div()
947 .id(SharedString::from(format!("see-more-{}", section.id)))
945 .id(SharedString::from(format!("see-more-{}", section.id)))
@@ -1109,7 +1107,7 @@ impl SidebarView {
1109 .ghost()
1107 .ghost()
1110 .xsmall()
1108 .xsmall()
1111 .icon(IconName::Ellipsis)
1109 .icon(IconName::Ellipsis)
1112 .tooltip("More options")
1110 .tooltip(tr("sidebar.more_options"))
1113 .dropdown_menu(move |popup, window, cx| {
1111 .dropdown_menu(move |popup, window, cx| {
1114 chat_menu(popup, window, cx, &more_context, &more_target)
1112 chat_menu(popup, window, cx, &more_context, &more_target)
1115 }),
1113 }),
@@ -1315,7 +1313,7 @@ impl SidebarView {
1315 .text_size(px(12.5))
1313 .text_size(px(12.5))
1316 .italic()
1314 .italic()
1317 .text_color(theme::text_faint())
1315 .text_color(theme::text_faint())
1318 .child(LOADING_OLDER_LABEL),
1316 .child(tr("sidebar.loading_older")),
1319 );
1317 );
1320 }
1318 }
1321 let selected_chat_id = self.selected_chat_id(cx);
1319 let selected_chat_id = self.selected_chat_id(cx);
@@ -1447,7 +1445,7 @@ impl SidebarView {
1447 .into_any_element()
1445 .into_any_element()
1448 }
1446 }
1449
1447
1450 fn plain_header(&self, label: &str) -> impl IntoElement {
1448 fn plain_header(&self, label: impl Into<SharedString>) -> impl IntoElement {
1451 div()
1449 div()
1452 .h(px(SECTION_HEIGHT))
1450 .h(px(SECTION_HEIGHT))
1453 .mt(px(SECTION_GAP))
1451 .mt(px(SECTION_GAP))
@@ -1457,7 +1455,7 @@ impl SidebarView {
1457 .text_size(px(12.))
1455 .text_size(px(12.))
1458 .font_weight(FontWeight::SEMIBOLD)
1456 .font_weight(FontWeight::SEMIBOLD)
1459 .text_color(theme::text_soft())
1457 .text_color(theme::text_soft())
1460 .child(label.to_owned())
1458 .child(label.into())
1461 }
1459 }
1462
1460
1463 fn team_block(
1461 fn team_block(
@@ -1602,9 +1600,9 @@ impl SidebarView {
1602 .text_size(px(13.5))
1600 .text_size(px(13.5))
1603 .text_color(theme::accent_text())
1601 .text_color(theme::accent_text())
1604 .child(if open {
1602 .child(if open {
1605 SEE_FEWER_CHANNELS
1603 tr("sidebar.see_fewer_channels")
1606 } else {
1604 } else {
1607 SEE_ALL_CHANNELS
1605 tr("sidebar.see_all_channels")
1608 })
1606 })
1609 .on_click(on_click)
1607 .on_click(on_click)
1610 }
1608 }
@@ -1775,7 +1773,7 @@ impl SidebarView {
1775 })
1773 })
1776 .collect();
1774 .collect();
1777 if !pinned.is_empty() {
1775 if !pinned.is_empty() {
1778 list = list.child(self.plain_header(PINNED_LABEL));
1776 list = list.child(self.plain_header(tr("sidebar.pinned")));
1779 for (entry, channel) in pinned {
1777 for (entry, channel) in pinned {
1780 let is_selected = selected == Some(Selection::Channel(channel.id.clone()));
1778 let is_selected = selected == Some(Selection::Channel(channel.id.clone()));
1781 list = list.child(self.channel_row(
1779 list = list.child(self.channel_row(
@@ -1787,7 +1785,7 @@ impl SidebarView {
1787 ));
1785 ));
1788 }
1786 }
1789 }
1787 }
1790 list = list.child(self.plain_header(TEAMS_LABEL));
1788 list = list.child(self.plain_header(tr("sidebar.teams")));
1791 let hidden_teams: Vec<&SidebarTeam> =
1789 let hidden_teams: Vec<&SidebarTeam> =
1792 sidebar.teams.iter().filter(|entry| entry.hidden).collect();
1790 sidebar.teams.iter().filter(|entry| entry.hidden).collect();
1793 for entry in sidebar
1791 for entry in sidebar
@@ -1805,7 +1803,7 @@ impl SidebarView {
1805 let open = self.hidden_teams_open || holds_selection;
1803 let open = self.hidden_teams_open || holds_selection;
1806 list = list.child(self.reveal_row(
1804 list = list.child(self.reveal_row(
1807 "hidden-teams".into(),
1805 "hidden-teams".into(),
1808 format!("{HIDDEN_TEAMS_LABEL} ({})", hidden_teams.len()),
1806 format!("{} ({})", tr("sidebar.hidden_teams"), hidden_teams.len()),
1809 open,
1807 open,
1810 10.,
1808 10.,
1811 cx.listener(|this, _, _, cx| {
1809 cx.listener(|this, _, _, cx| {
@@ -2002,11 +2000,11 @@ fn notifications_submenu(
2002 let (state, channel_id) = (state.clone(), channel_id.to_owned());
2000 let (state, channel_id) = (state.clone(), channel_id.to_owned());
2003 popup.submenu_with_icon(
2001 popup.submenu_with_icon(
2004 Some(menu_icon(IconName::Bell)),
2002 Some(menu_icon(IconName::Bell)),
2005 "Notifications",
2003 tr("sidebar.notifications"),
2006 window,
2004 window,
2007 cx,
2005 cx,
2008 move |submenu, _, _| {
2006 move |submenu, _, _| {
2009 let level_item = |label: &'static str, level: ChannelNotificationLevel| {
2007 let level_item = |label: String, level: ChannelNotificationLevel| {
2010 let (state, channel_id) = (state.clone(), channel_id.clone());
2008 let (state, channel_id) = (state.clone(), channel_id.clone());
2011 PopupMenuItem::new(label)
2009 PopupMenuItem::new(label)
2012 .checked(notifications.level == level)
2010 .checked(notifications.level == level)
@@ -2024,14 +2022,20 @@ fn notifications_submenu(
2024 let (replies_state, replies_id) = (state.clone(), channel_id.clone());
2022 let (replies_state, replies_id) = (state.clone(), channel_id.clone());
2025 submenu
2023 submenu
2026 .item(level_item(
2024 .item(level_item(
2027 "Banner and activity",
2025 tr("sidebar.notify_banner_activity"),
2028 ChannelNotificationLevel::BannerAndFeed,
2026 ChannelNotificationLevel::BannerAndFeed,
2029 ))
2027 ))
2030 .item(level_item("Activity only", ChannelNotificationLevel::Feed))
2028 .item(level_item(
2031 .item(level_item("Off", ChannelNotificationLevel::Off))
2029 tr("sidebar.notify_activity_only"),
2030 ChannelNotificationLevel::Feed,
2031 ))
2032 .item(level_item(
2033 tr("sidebar.notify_off"),
2034 ChannelNotificationLevel::Off,
2035 ))
2032 .separator()
2036 .separator()
2033 .item(
2037 .item(
2034 PopupMenuItem::new("Include thread replies")
2038 PopupMenuItem::new(tr("sidebar.include_thread_replies"))
2035 .checked(notifications.include_replies)
2039 .checked(notifications.include_replies)
2036 .disabled(notifications.level == ChannelNotificationLevel::Off)
2040 .disabled(notifications.level == ChannelNotificationLevel::Off)
2037 .on_click(move |_, _, cx| {
2041 .on_click(move |_, _, cx| {
@@ -2140,7 +2144,7 @@ impl Render for SidebarView {
2140 v_flex()
2144 v_flex()
2141 .flex_none()
2145 .flex_none()
2142 .child(
2146 .child(
2143 page_header(self.tab.title())
2147 page_header(&self.tab.title())
2144 .child(self.chat_list_menu_button(cx))
2148 .child(self.chat_list_menu_button(cx))
2145 .child(self.filter_toggle_button(cx))
2149 .child(self.filter_toggle_button(cx))
2146 .child(self.new_chat_button(cx)),
2150 .child(self.new_chat_button(cx)),
@@ -2151,14 +2155,14 @@ impl Render for SidebarView {
2151 v_flex()
2155 v_flex()
2152 .flex_none()
2156 .flex_none()
2153 .child(
2157 .child(
2154 page_header(self.tab.title())
2158 page_header(&self.tab.title())
2155 .child(self.channel_list_menu_button(cx))
2159 .child(self.channel_list_menu_button(cx))
2156 .child(self.channel_filter_button(cx))
2160 .child(self.channel_filter_button(cx))
2157 .child(self.new_channel_items_button(cx)),
2161 .child(self.new_channel_items_button(cx)),
2158 )
2162 )
2159 .child(self.channel_filter_bar(cx)),
2163 .child(self.channel_filter_bar(cx)),
2160 ),
2164 ),
2161 SidebarTab::Agents => Some(page_header(self.tab.title())),
2165 SidebarTab::Agents => Some(page_header(&self.tab.title())),
2162 SidebarTab::Activity | SidebarTab::Calls | SidebarTab::Calendar => None,
2166 SidebarTab::Activity | SidebarTab::Calls | SidebarTab::Calendar => None,
2163 };
2167 };
2164 v_flex()
2168 v_flex()
crates/app/src/views/sidebar/channel_filter_bar.rs +11 −12
@@ -8,15 +8,14 @@ use gpui_kit::*;
8 8
9 9 use super::{NEW_CHAT_BUTTON_SIZE, SidebarEvent, SidebarView};
10 10 use crate::app_state::Selection;
11 use crate::channel_filter::{CHANNEL_FILTER_PLACEHOLDER, UNREAD_PILL};
12 use crate::chat_filter::{CLOSE_FILTER_TEXT, SHOW_FILTER_TEXT};
11 use crate::channel_filter::{channel_filter_placeholder, channel_unread_pill};
12 use crate::chat_filter::{filter_close_box, filter_show_box};
13 use crate::i18n::tr;
13 14 use crate::theme;
14 15 use crate::views::create_channel_dialog::open_create_channel_dialog;
15 16 use crate::views::widgets::{icon, menu_icon};
16 17
17 18 pub const CHANNEL_FILTER_TAG: &str = "shell/islands/sidebar/channel-filter";
18 const NEW_CHANNEL_LABEL: &str = "New channel";
19 const NEW_MESSAGE_LABEL: &str = "New message";
20 19 const INPUT_HEIGHT: f32 = 32.;
21 20 const PILL_HEIGHT: f32 = 24.;
22 21 const SIDE_INSET: f32 = 16.;
@@ -52,7 +51,7 @@ impl SidebarView {
52 51 return input.clone();
53 52 }
54 53 let input =
55 cx.new(|cx| InputState::new(window, cx).placeholder(CHANNEL_FILTER_PLACEHOLDER));
54 cx.new(|cx| InputState::new(window, cx).placeholder(channel_filter_placeholder()));
56 55 let subscription = cx.subscribe_in(&input, window, |this, input, event, _, cx| {
57 56 if matches!(event, InputEvent::Change) {
58 57 this.channel_filter.text = input.read(cx).value().to_string();
@@ -67,9 +66,9 @@ impl SidebarView {
67 66 pub(super) fn channel_filter_button(&self, cx: &mut Context<Self>) -> impl IntoElement {
68 67 let open = self.channel_filter_open;
69 68 let label = if open {
70 CLOSE_FILTER_TEXT
69 filter_close_box()
71 70 } else {
72 SHOW_FILTER_TEXT
71 filter_show_box()
73 72 };
74 73 div()
75 74 .id("channel-filter-toggle")
@@ -82,7 +81,7 @@ impl SidebarView {
82 81 .cursor_pointer()
83 82 .when(open, |button| button.bg(theme::popup_hover()))
84 83 .hover(|button| button.bg(theme::popup_hover()))
85 .tooltip(move |window, cx| Tooltip::new(label).build(window, cx))
84 .tooltip(move |window, cx| Tooltip::new(label.clone()).build(window, cx))
86 85 .child(icon(
87 86 IconName::Search,
88 87 16.,
@@ -120,11 +119,11 @@ impl SidebarView {
120 119 .ghost()
121 120 .size(px(NEW_CHAT_BUTTON_SIZE))
122 121 .rounded(px(8.))
123 .tooltip("New items")
122 .tooltip(tr("sidebar.new_items"))
124 123 .dropdown_menu(move |menu, _, _| {
125 124 let (state, team_id, sidebar) = (state.clone(), team_id.clone(), sidebar.clone());
126 125 menu.item(
127 PopupMenuItem::new(NEW_MESSAGE_LABEL)
126 PopupMenuItem::new(tr("sidebar.new_message"))
128 127 .icon(menu_icon(IconName::MessageSquare))
129 128 .disabled(!channel_selected)
130 129 .on_click(move |_, _, cx| {
@@ -134,7 +133,7 @@ impl SidebarView {
134 133 }),
135 134 )
136 135 .item(
137 PopupMenuItem::new(NEW_CHANNEL_LABEL)
136 PopupMenuItem::new(tr("sidebar.new_channel"))
138 137 .icon(menu_icon(IconName::Hash))
139 138 .disabled(team_id.is_none())
140 139 .on_click(move |_, window, cx| {
@@ -180,7 +179,7 @@ impl SidebarView {
180 179 .text_color(theme::text_soft())
181 180 .hover(|chip| chip.bg(theme::border_strong()))
182 181 })
183 .child(UNREAD_PILL)
182 .child(channel_unread_pill())
184 183 .on_click(cx.listener(|this, _, _, cx| {
185 184 this.channel_filter.unread_only = !this.channel_filter.unread_only;
186 185 cx.notify();
@@ -8,15 +8,14 @@ use gpui_kit::*;
8
8
9use super::{NEW_CHAT_BUTTON_SIZE, SidebarEvent, SidebarView};
9use super::{NEW_CHAT_BUTTON_SIZE, SidebarEvent, SidebarView};
10use crate::app_state::Selection;
10use crate::app_state::Selection;
11use crate::channel_filter::{CHANNEL_FILTER_PLACEHOLDER, UNREAD_PILL};
11use crate::channel_filter::{channel_filter_placeholder, channel_unread_pill};
12use crate::chat_filter::{CLOSE_FILTER_TEXT, SHOW_FILTER_TEXT};
12use crate::chat_filter::{filter_close_box, filter_show_box};
13use crate::i18n::tr;
13use crate::theme;
14use crate::theme;
14use crate::views::create_channel_dialog::open_create_channel_dialog;
15use crate::views::create_channel_dialog::open_create_channel_dialog;
15use crate::views::widgets::{icon, menu_icon};
16use crate::views::widgets::{icon, menu_icon};
16
17
17pub const CHANNEL_FILTER_TAG: &str = "shell/islands/sidebar/channel-filter";
18pub const CHANNEL_FILTER_TAG: &str = "shell/islands/sidebar/channel-filter";
18const NEW_CHANNEL_LABEL: &str = "New channel";
19const NEW_MESSAGE_LABEL: &str = "New message";
20const INPUT_HEIGHT: f32 = 32.;
19const INPUT_HEIGHT: f32 = 32.;
21const PILL_HEIGHT: f32 = 24.;
20const PILL_HEIGHT: f32 = 24.;
22const SIDE_INSET: f32 = 16.;
21const SIDE_INSET: f32 = 16.;
@@ -52,7 +51,7 @@ impl SidebarView {
52 return input.clone();
51 return input.clone();
53 }
52 }
54 let input =
53 let input =
55 cx.new(|cx| InputState::new(window, cx).placeholder(CHANNEL_FILTER_PLACEHOLDER));
54 cx.new(|cx| InputState::new(window, cx).placeholder(channel_filter_placeholder()));
56 let subscription = cx.subscribe_in(&input, window, |this, input, event, _, cx| {
55 let subscription = cx.subscribe_in(&input, window, |this, input, event, _, cx| {
57 if matches!(event, InputEvent::Change) {
56 if matches!(event, InputEvent::Change) {
58 this.channel_filter.text = input.read(cx).value().to_string();
57 this.channel_filter.text = input.read(cx).value().to_string();
@@ -67,9 +66,9 @@ impl SidebarView {
67 pub(super) fn channel_filter_button(&self, cx: &mut Context<Self>) -> impl IntoElement {
66 pub(super) fn channel_filter_button(&self, cx: &mut Context<Self>) -> impl IntoElement {
68 let open = self.channel_filter_open;
67 let open = self.channel_filter_open;
69 let label = if open {
68 let label = if open {
70 CLOSE_FILTER_TEXT
69 filter_close_box()
71 } else {
70 } else {
72 SHOW_FILTER_TEXT
71 filter_show_box()
73 };
72 };
74 div()
73 div()
75 .id("channel-filter-toggle")
74 .id("channel-filter-toggle")
@@ -82,7 +81,7 @@ impl SidebarView {
82 .cursor_pointer()
81 .cursor_pointer()
83 .when(open, |button| button.bg(theme::popup_hover()))
82 .when(open, |button| button.bg(theme::popup_hover()))
84 .hover(|button| button.bg(theme::popup_hover()))
83 .hover(|button| button.bg(theme::popup_hover()))
85 .tooltip(move |window, cx| Tooltip::new(label).build(window, cx))
84 .tooltip(move |window, cx| Tooltip::new(label.clone()).build(window, cx))
86 .child(icon(
85 .child(icon(
87 IconName::Search,
86 IconName::Search,
88 16.,
87 16.,
@@ -120,11 +119,11 @@ impl SidebarView {
120 .ghost()
119 .ghost()
121 .size(px(NEW_CHAT_BUTTON_SIZE))
120 .size(px(NEW_CHAT_BUTTON_SIZE))
122 .rounded(px(8.))
121 .rounded(px(8.))
123 .tooltip("New items")
122 .tooltip(tr("sidebar.new_items"))
124 .dropdown_menu(move |menu, _, _| {
123 .dropdown_menu(move |menu, _, _| {
125 let (state, team_id, sidebar) = (state.clone(), team_id.clone(), sidebar.clone());
124 let (state, team_id, sidebar) = (state.clone(), team_id.clone(), sidebar.clone());
126 menu.item(
125 menu.item(
127 PopupMenuItem::new(NEW_MESSAGE_LABEL)
126 PopupMenuItem::new(tr("sidebar.new_message"))
128 .icon(menu_icon(IconName::MessageSquare))
127 .icon(menu_icon(IconName::MessageSquare))
129 .disabled(!channel_selected)
128 .disabled(!channel_selected)
130 .on_click(move |_, _, cx| {
129 .on_click(move |_, _, cx| {
@@ -134,7 +133,7 @@ impl SidebarView {
134 }),
133 }),
135 )
134 )
136 .item(
135 .item(
137 PopupMenuItem::new(NEW_CHANNEL_LABEL)
136 PopupMenuItem::new(tr("sidebar.new_channel"))
138 .icon(menu_icon(IconName::Hash))
137 .icon(menu_icon(IconName::Hash))
139 .disabled(team_id.is_none())
138 .disabled(team_id.is_none())
140 .on_click(move |_, window, cx| {
139 .on_click(move |_, window, cx| {
@@ -180,7 +179,7 @@ impl SidebarView {
180 .text_color(theme::text_soft())
179 .text_color(theme::text_soft())
181 .hover(|chip| chip.bg(theme::border_strong()))
180 .hover(|chip| chip.bg(theme::border_strong()))
182 })
181 })
183 .child(UNREAD_PILL)
182 .child(channel_unread_pill())
184 .on_click(cx.listener(|this, _, _, cx| {
183 .on_click(cx.listener(|this, _, _, cx| {
185 this.channel_filter.unread_only = !this.channel_filter.unread_only;
184 this.channel_filter.unread_only = !this.channel_filter.unread_only;
186 cx.notify();
185 cx.notify();
crates/app/src/views/sidebar/chat_filter_bar.rs +12 −9
@@ -9,9 +9,10 @@ use gpui_kit::*;
9 9 use super::{NEW_CHAT_BUTTON_SIZE, SidebarEvent, SidebarTab, SidebarView};
10 10 use crate::app_state::Selection;
11 11 use crate::chat_filter::{
12 CLEAR_FILTER_TEXT, CLEAR_FILTERS, CLOSE_FILTER_TEXT, ChatFilterPill, FILTER_PLACEHOLDER,
13 NO_MATCHES, SHOW_FILTER_TEXT, mentioned_conversations,
12 ChatFilterPill, filter_clear_all, filter_clear_text, filter_close_box, filter_no_matches,
13 filter_placeholder, filter_show_box, mentioned_conversations,
14 14 };
15 use crate::i18n::tr_args;
15 16 use crate::theme;
16 17 use crate::views::widgets::icon;
17 18
@@ -83,7 +84,7 @@ impl SidebarView {
83 84 if let Some(input) = &self.filter_input {
84 85 return input.clone();
85 86 }
86 let input = cx.new(|cx| InputState::new(window, cx).placeholder(FILTER_PLACEHOLDER));
87 let input = cx.new(|cx| InputState::new(window, cx).placeholder(filter_placeholder()));
87 88 let subscription = cx.subscribe_in(&input, window, |this, input, event, _, cx| {
88 89 if matches!(event, InputEvent::Change) {
89 90 this.chat_filter.text = input.read(cx).value().to_string();
@@ -99,9 +100,9 @@ impl SidebarView {
99 100 let open = self.filter_box_open;
100 101 let active = open || self.chat_filter.is_active();
101 102 let label = if open {
102 CLOSE_FILTER_TEXT
103 filter_close_box()
103 104 } else {
104 SHOW_FILTER_TEXT
105 filter_show_box()
105 106 };
106 107 div()
107 108 .id("chat-filter-toggle")
@@ -115,7 +116,9 @@ impl SidebarView {
115 116 .when(active, |button| button.bg(theme::popup_hover()))
116 117 .hover(|button| button.bg(theme::popup_hover()))
117 118 .tooltip(move |window, cx| {
118 Tooltip::new(format!("{label} (Ctrl+Shift+F)")).build(window, cx)
119 let mut args = std::collections::HashMap::new();
120 args.insert("label".to_owned(), label.clone());
121 Tooltip::new(tr_args("sidebar.filter.show_shortcut", &args)).build(window, cx)
119 122 })
120 123 .child(icon(
121 124 IconName::Funnel,
@@ -181,7 +184,7 @@ impl SidebarView {
181 184 .rounded(px(6.))
182 185 .cursor_pointer()
183 186 .hover(|button| button.bg(theme::popup_hover()))
184 .tooltip(|window, cx| Tooltip::new(CLEAR_FILTER_TEXT).build(window, cx))
187 .tooltip(|window, cx| Tooltip::new(filter_clear_text()).build(window, cx))
185 188 .child(icon(IconName::X, 14., theme::text_muted()))
186 189 .on_click(cx.listener(|this, _, window, cx| {
187 190 this.chat_filter.text.clear();
@@ -260,7 +263,7 @@ impl SidebarView {
260 263 div()
261 264 .text_size(px(13.))
262 265 .text_color(theme::text_muted())
263 .child(NO_MATCHES),
266 .child(filter_no_matches()),
264 267 )
265 268 .child(
266 269 div()
@@ -274,7 +277,7 @@ impl SidebarView {
274 277 .text_size(px(12.))
275 278 .text_color(theme::accent_text())
276 279 .hover(|button| button.bg(theme::surface_raised()))
277 .child(CLEAR_FILTERS)
280 .child(filter_clear_all())
278 281 .on_click(cx.listener(|this, _, window, cx| this.clear_filters(window, cx))),
279 282 )
280 283 }
@@ -9,9 +9,10 @@ use gpui_kit::*;
9use super::{NEW_CHAT_BUTTON_SIZE, SidebarEvent, SidebarTab, SidebarView};
9use super::{NEW_CHAT_BUTTON_SIZE, SidebarEvent, SidebarTab, SidebarView};
10use crate::app_state::Selection;
10use crate::app_state::Selection;
11use crate::chat_filter::{
11use crate::chat_filter::{
12 CLEAR_FILTER_TEXT, CLEAR_FILTERS, CLOSE_FILTER_TEXT, ChatFilterPill, FILTER_PLACEHOLDER,
12 ChatFilterPill, filter_clear_all, filter_clear_text, filter_close_box, filter_no_matches,
13 NO_MATCHES, SHOW_FILTER_TEXT, mentioned_conversations,
13 filter_placeholder, filter_show_box, mentioned_conversations,
14};
14};
15use crate::i18n::tr_args;
15use crate::theme;
16use crate::theme;
16use crate::views::widgets::icon;
17use crate::views::widgets::icon;
17
18
@@ -83,7 +84,7 @@ impl SidebarView {
83 if let Some(input) = &self.filter_input {
84 if let Some(input) = &self.filter_input {
84 return input.clone();
85 return input.clone();
85 }
86 }
86 let input = cx.new(|cx| InputState::new(window, cx).placeholder(FILTER_PLACEHOLDER));
87 let input = cx.new(|cx| InputState::new(window, cx).placeholder(filter_placeholder()));
87 let subscription = cx.subscribe_in(&input, window, |this, input, event, _, cx| {
88 let subscription = cx.subscribe_in(&input, window, |this, input, event, _, cx| {
88 if matches!(event, InputEvent::Change) {
89 if matches!(event, InputEvent::Change) {
89 this.chat_filter.text = input.read(cx).value().to_string();
90 this.chat_filter.text = input.read(cx).value().to_string();
@@ -99,9 +100,9 @@ impl SidebarView {
99 let open = self.filter_box_open;
100 let open = self.filter_box_open;
100 let active = open || self.chat_filter.is_active();
101 let active = open || self.chat_filter.is_active();
101 let label = if open {
102 let label = if open {
102 CLOSE_FILTER_TEXT
103 filter_close_box()
103 } else {
104 } else {
104 SHOW_FILTER_TEXT
105 filter_show_box()
105 };
106 };
106 div()
107 div()
107 .id("chat-filter-toggle")
108 .id("chat-filter-toggle")
@@ -115,7 +116,9 @@ impl SidebarView {
115 .when(active, |button| button.bg(theme::popup_hover()))
116 .when(active, |button| button.bg(theme::popup_hover()))
116 .hover(|button| button.bg(theme::popup_hover()))
117 .hover(|button| button.bg(theme::popup_hover()))
117 .tooltip(move |window, cx| {
118 .tooltip(move |window, cx| {
118 Tooltip::new(format!("{label} (Ctrl+Shift+F)")).build(window, cx)
119 let mut args = std::collections::HashMap::new();
120 args.insert("label".to_owned(), label.clone());
121 Tooltip::new(tr_args("sidebar.filter.show_shortcut", &args)).build(window, cx)
119 })
122 })
120 .child(icon(
123 .child(icon(
121 IconName::Funnel,
124 IconName::Funnel,
@@ -181,7 +184,7 @@ impl SidebarView {
181 .rounded(px(6.))
184 .rounded(px(6.))
182 .cursor_pointer()
185 .cursor_pointer()
183 .hover(|button| button.bg(theme::popup_hover()))
186 .hover(|button| button.bg(theme::popup_hover()))
184 .tooltip(|window, cx| Tooltip::new(CLEAR_FILTER_TEXT).build(window, cx))
187 .tooltip(|window, cx| Tooltip::new(filter_clear_text()).build(window, cx))
185 .child(icon(IconName::X, 14., theme::text_muted()))
188 .child(icon(IconName::X, 14., theme::text_muted()))
186 .on_click(cx.listener(|this, _, window, cx| {
189 .on_click(cx.listener(|this, _, window, cx| {
187 this.chat_filter.text.clear();
190 this.chat_filter.text.clear();
@@ -260,7 +263,7 @@ impl SidebarView {
260 div()
263 div()
261 .text_size(px(13.))
264 .text_size(px(13.))
262 .text_color(theme::text_muted())
265 .text_color(theme::text_muted())
263 .child(NO_MATCHES),
266 .child(filter_no_matches()),
264 )
267 )
265 .child(
268 .child(
266 div()
269 div()
@@ -274,7 +277,7 @@ impl SidebarView {
274 .text_size(px(12.))
277 .text_size(px(12.))
275 .text_color(theme::accent_text())
278 .text_color(theme::accent_text())
276 .hover(|button| button.bg(theme::surface_raised()))
279 .hover(|button| button.bg(theme::surface_raised()))
277 .child(CLEAR_FILTERS)
280 .child(filter_clear_all())
278 .on_click(cx.listener(|this, _, window, cx| this.clear_filters(window, cx))),
281 .on_click(cx.listener(|this, _, window, cx| this.clear_filters(window, cx))),
279 )
282 )
280 }
283 }
crates/app/src/views/status_menu.rs +18 −19
@@ -14,6 +14,7 @@ use super::avatar::{person_avatar, status_glyph, with_presence, with_presence_ba
14 14 use super::widgets::{menu_icon, symbol};
15 15 use crate::app_state::AppState;
16 16 use crate::data::{Person, PresenceKind};
17 use crate::i18n::tr;
17 18 use crate::notify::pause;
18 19 use crate::own_status::{
19 20 STATUS_CHOICES, STATUS_DURATIONS, StateSummary, StatusDuration, choice_label, duration_target,
@@ -26,8 +27,6 @@ pub const MENU_WIDTH: f32 = 250.;
26 27 pub(crate) const TITLE_AVATAR_SIZE: f32 = 28.;
27 28 pub(crate) const OWN_AVATAR_DISC: &str = "shell/title-bar/own-status/avatar/disc";
28 29 pub(crate) const SETTINGS_MORE_TAG: &str = "shell/title-bar/settings-more";
29 const SETTINGS_MORE_TITLE: &str = "Settings and more";
30 const VIEW_ACCOUNT_LABEL: &str = "View account";
31 30 const VIEW_ACCOUNT_URL: &str = "https://myaccount.microsoft.com";
32 31 const TITLE_PRESENCE_SIZE: f32 = 14.;
33 32 const HEADER_AVATAR_SIZE: f32 = 40.;
@@ -170,7 +169,7 @@ fn header(context: &MenuContext, cx: &App) -> Div {
170 169 .text_size(px(12.))
171 170 .text_color(theme::text_soft())
172 171 .hover(|link| link.text_color(theme::accent_text()))
173 .child(VIEW_ACCOUNT_LABEL)
172 .child(tr("status_menu.view_account"))
174 173 .child(menu_icon(IconName::ExternalLink).size(px(12.)))
175 174 .on_click(|_, _, cx| cx.open_url(VIEW_ACCOUNT_URL)),
176 175 )
@@ -212,7 +211,7 @@ fn status_menu(
212 211 .item(pause_item(&context.app, window, cx))
213 212 .item(work_location_item(context, window, cx))
214 213 .item(
215 PopupMenuItem::new("Set status message")
214 PopupMenuItem::new(tr("status_menu.set_status_message"))
216 215 .icon(menu_icon(IconName::Pencil))
217 216 .on_click(move |_, _, cx| {
218 217 message_app.update(cx, |state, cx| state.request_status_message(cx));
@@ -245,7 +244,7 @@ fn pause_item(
245 244 return menu;
246 245 }
247 246 menu.separator().item(
248 PopupMenuItem::new("Resume notifications")
247 PopupMenuItem::new(tr("status_menu.resume_notifications"))
249 248 .icon(menu_icon(IconName::BellRing))
250 249 .on_click(move |_, _, cx| {
251 250 resume_app.update(cx, |state, cx| state.resume_notifications(cx));
@@ -268,7 +267,7 @@ pub fn settings_more_button(app: &Entity<AppState>) -> AnyElement {
268 267 Button::new("title-settings-more")
269 268 .ghost()
270 269 .icon(IconName::Ellipsis)
271 .tooltip(SETTINGS_MORE_TITLE)
270 .tooltip(tr("shell.settings_and_more"))
272 271 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, window, cx| {
273 272 settings_more_menu(popup, window, cx, &app)
274 273 }),
@@ -293,7 +292,7 @@ fn settings_more_menu(
293 292 let popup = popup
294 293 .min_w(px(MENU_WIDTH))
295 294 .item(
296 PopupMenuItem::new("Settings")
295 PopupMenuItem::new(tr("common.settings"))
297 296 .icon(menu_icon(IconName::Settings))
298 297 .on_click(move |_, _, cx| {
299 298 settings_app.update(cx, |state, cx| {
@@ -303,7 +302,7 @@ fn settings_more_menu(
303 302 )
304 303 .separator()
305 304 .item(
306 PopupMenuItem::new("Chat list")
305 PopupMenuItem::new(tr("status_menu.chat_list"))
307 306 .icon(menu_icon(IconName::LayoutList))
308 307 .on_click(move |_, _, cx| {
309 308 chat_list_app.update(cx, |state, cx| {
@@ -312,7 +311,7 @@ fn settings_more_menu(
312 311 }),
313 312 )
314 313 .item(
315 PopupMenuItem::new("Translation")
314 PopupMenuItem::new(tr("status_menu.translation"))
316 315 .icon(menu_icon(IconName::Languages))
317 316 .on_click(move |_, _, cx| {
318 317 translation_app.update(cx, |state, cx| {
@@ -321,7 +320,7 @@ fn settings_more_menu(
321 320 }),
322 321 )
323 322 .item(
324 PopupMenuItem::new("Notification settings")
323 PopupMenuItem::new(tr("status_menu.notification_settings"))
325 324 .icon(menu_icon(IconName::Bell))
326 325 .on_click(move |_, _, cx| {
327 326 notification_app.update(cx, |state, cx| {
@@ -330,7 +329,7 @@ fn settings_more_menu(
330 329 }),
331 330 )
332 331 .item(
333 PopupMenuItem::new("Make a test call")
332 PopupMenuItem::new(tr("status_menu.test_call"))
334 333 .icon(menu_icon(IconName::Phone))
335 334 .on_click(move |_, _, cx| {
336 335 call_app.update(cx, |state, cx| state.start_test_call(cx));
@@ -343,7 +342,7 @@ fn settings_more_menu(
343 342 return popup;
344 343 }
345 344 popup.item(
346 PopupMenuItem::new("Simulate incoming call")
345 PopupMenuItem::new(tr("status_menu.simulate_incoming"))
347 346 .icon(menu_icon(IconName::Phone))
348 347 .on_click(move |_, _, cx| {
349 348 ring_app.update(cx, |state, cx| state.demo_incoming_ring(cx));
@@ -367,7 +366,7 @@ fn work_location_item(
367 366 let current = context.status.work_location;
368 367 let app = context.app.clone();
369 368 let submenu = PopupMenu::build(window, cx, move |menu, _, _| {
370 let pick = |label: &'static str, kind: WorkLocationKind| {
369 let pick = |label: String, kind: WorkLocationKind| {
371 370 let app = app.clone();
372 371 PopupMenuItem::new(label)
373 372 .icon(work_location_icon(Some(kind)))
@@ -377,14 +376,14 @@ fn work_location_item(
377 376 };
378 377 let clear_app = app.clone();
379 378 let menu = menu
380 .item(PopupMenuItem::label("Set work location for today"))
381 .item(pick("Office", WorkLocationKind::Office))
382 .item(pick("Remote", WorkLocationKind::Remote));
379 .item(PopupMenuItem::label(tr("status_menu.work_location_today")))
380 .item(pick(tr("status_menu.office"), WorkLocationKind::Office))
381 .item(pick(tr("status_menu.remote"), WorkLocationKind::Remote));
383 382 if current.is_none() {
384 383 return menu;
385 384 }
386 385 menu.separator().item(
387 PopupMenuItem::new("Clear work location")
386 PopupMenuItem::new(tr("status_menu.clear_work_location"))
388 387 .icon(menu_icon(IconName::X))
389 388 .on_click(move |_, _, cx| {
390 389 clear_app.update(cx, |state, cx| state.set_own_work_location(None, cx));
@@ -429,12 +428,12 @@ fn state_menu(
429 428 popup
430 429 .separator()
431 430 .item(
432 PopupMenuItem::submenu("Duration", durations)
431 PopupMenuItem::submenu(tr("status_menu.duration"), durations)
433 432 .icon(menu_icon(IconName::Clock))
434 433 .disabled(target.is_none()),
435 434 )
436 435 .item(
437 PopupMenuItem::new("Reset status")
436 PopupMenuItem::new(tr("status_menu.reset_status"))
438 437 .icon(menu_icon(IconName::RotateCcw))
439 438 .on_click(move |_, _, cx| {
440 439 reset_app.update(cx, |state, cx| state.set_own_availability(None, cx));
@@ -14,6 +14,7 @@ use super::avatar::{person_avatar, status_glyph, with_presence, with_presence_ba
14use super::widgets::{menu_icon, symbol};
14use super::widgets::{menu_icon, symbol};
15use crate::app_state::AppState;
15use crate::app_state::AppState;
16use crate::data::{Person, PresenceKind};
16use crate::data::{Person, PresenceKind};
17use crate::i18n::tr;
17use crate::notify::pause;
18use crate::notify::pause;
18use crate::own_status::{
19use crate::own_status::{
19 STATUS_CHOICES, STATUS_DURATIONS, StateSummary, StatusDuration, choice_label, duration_target,
20 STATUS_CHOICES, STATUS_DURATIONS, StateSummary, StatusDuration, choice_label, duration_target,
@@ -26,8 +27,6 @@ pub const MENU_WIDTH: f32 = 250.;
26pub(crate) const TITLE_AVATAR_SIZE: f32 = 28.;
27pub(crate) const TITLE_AVATAR_SIZE: f32 = 28.;
27pub(crate) const OWN_AVATAR_DISC: &str = "shell/title-bar/own-status/avatar/disc";
28pub(crate) const OWN_AVATAR_DISC: &str = "shell/title-bar/own-status/avatar/disc";
28pub(crate) const SETTINGS_MORE_TAG: &str = "shell/title-bar/settings-more";
29pub(crate) const SETTINGS_MORE_TAG: &str = "shell/title-bar/settings-more";
29const SETTINGS_MORE_TITLE: &str = "Settings and more";
30const VIEW_ACCOUNT_LABEL: &str = "View account";
31const VIEW_ACCOUNT_URL: &str = "https://myaccount.microsoft.com";
30const VIEW_ACCOUNT_URL: &str = "https://myaccount.microsoft.com";
32const TITLE_PRESENCE_SIZE: f32 = 14.;
31const TITLE_PRESENCE_SIZE: f32 = 14.;
33const HEADER_AVATAR_SIZE: f32 = 40.;
32const HEADER_AVATAR_SIZE: f32 = 40.;
@@ -170,7 +169,7 @@ fn header(context: &MenuContext, cx: &App) -> Div {
170 .text_size(px(12.))
169 .text_size(px(12.))
171 .text_color(theme::text_soft())
170 .text_color(theme::text_soft())
172 .hover(|link| link.text_color(theme::accent_text()))
171 .hover(|link| link.text_color(theme::accent_text()))
173 .child(VIEW_ACCOUNT_LABEL)
172 .child(tr("status_menu.view_account"))
174 .child(menu_icon(IconName::ExternalLink).size(px(12.)))
173 .child(menu_icon(IconName::ExternalLink).size(px(12.)))
175 .on_click(|_, _, cx| cx.open_url(VIEW_ACCOUNT_URL)),
174 .on_click(|_, _, cx| cx.open_url(VIEW_ACCOUNT_URL)),
176 )
175 )
@@ -212,7 +211,7 @@ fn status_menu(
212 .item(pause_item(&context.app, window, cx))
211 .item(pause_item(&context.app, window, cx))
213 .item(work_location_item(context, window, cx))
212 .item(work_location_item(context, window, cx))
214 .item(
213 .item(
215 PopupMenuItem::new("Set status message")
214 PopupMenuItem::new(tr("status_menu.set_status_message"))
216 .icon(menu_icon(IconName::Pencil))
215 .icon(menu_icon(IconName::Pencil))
217 .on_click(move |_, _, cx| {
216 .on_click(move |_, _, cx| {
218 message_app.update(cx, |state, cx| state.request_status_message(cx));
217 message_app.update(cx, |state, cx| state.request_status_message(cx));
@@ -245,7 +244,7 @@ fn pause_item(
245 return menu;
244 return menu;
246 }
245 }
247 menu.separator().item(
246 menu.separator().item(
248 PopupMenuItem::new("Resume notifications")
247 PopupMenuItem::new(tr("status_menu.resume_notifications"))
249 .icon(menu_icon(IconName::BellRing))
248 .icon(menu_icon(IconName::BellRing))
250 .on_click(move |_, _, cx| {
249 .on_click(move |_, _, cx| {
251 resume_app.update(cx, |state, cx| state.resume_notifications(cx));
250 resume_app.update(cx, |state, cx| state.resume_notifications(cx));
@@ -268,7 +267,7 @@ pub fn settings_more_button(app: &Entity<AppState>) -> AnyElement {
268 Button::new("title-settings-more")
267 Button::new("title-settings-more")
269 .ghost()
268 .ghost()
270 .icon(IconName::Ellipsis)
269 .icon(IconName::Ellipsis)
271 .tooltip(SETTINGS_MORE_TITLE)
270 .tooltip(tr("shell.settings_and_more"))
272 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, window, cx| {
271 .dropdown_menu_with_anchor(Anchor::TopRight, move |popup, window, cx| {
273 settings_more_menu(popup, window, cx, &app)
272 settings_more_menu(popup, window, cx, &app)
274 }),
273 }),
@@ -293,7 +292,7 @@ fn settings_more_menu(
293 let popup = popup
292 let popup = popup
294 .min_w(px(MENU_WIDTH))
293 .min_w(px(MENU_WIDTH))
295 .item(
294 .item(
296 PopupMenuItem::new("Settings")
295 PopupMenuItem::new(tr("common.settings"))
297 .icon(menu_icon(IconName::Settings))
296 .icon(menu_icon(IconName::Settings))
298 .on_click(move |_, _, cx| {
297 .on_click(move |_, _, cx| {
299 settings_app.update(cx, |state, cx| {
298 settings_app.update(cx, |state, cx| {
@@ -303,7 +302,7 @@ fn settings_more_menu(
303 )
302 )
304 .separator()
303 .separator()
305 .item(
304 .item(
306 PopupMenuItem::new("Chat list")
305 PopupMenuItem::new(tr("status_menu.chat_list"))
307 .icon(menu_icon(IconName::LayoutList))
306 .icon(menu_icon(IconName::LayoutList))
308 .on_click(move |_, _, cx| {
307 .on_click(move |_, _, cx| {
309 chat_list_app.update(cx, |state, cx| {
308 chat_list_app.update(cx, |state, cx| {
@@ -312,7 +311,7 @@ fn settings_more_menu(
312 }),
311 }),
313 )
312 )
314 .item(
313 .item(
315 PopupMenuItem::new("Translation")
314 PopupMenuItem::new(tr("status_menu.translation"))
316 .icon(menu_icon(IconName::Languages))
315 .icon(menu_icon(IconName::Languages))
317 .on_click(move |_, _, cx| {
316 .on_click(move |_, _, cx| {
318 translation_app.update(cx, |state, cx| {
317 translation_app.update(cx, |state, cx| {
@@ -321,7 +320,7 @@ fn settings_more_menu(
321 }),
320 }),
322 )
321 )
323 .item(
322 .item(
324 PopupMenuItem::new("Notification settings")
323 PopupMenuItem::new(tr("status_menu.notification_settings"))
325 .icon(menu_icon(IconName::Bell))
324 .icon(menu_icon(IconName::Bell))
326 .on_click(move |_, _, cx| {
325 .on_click(move |_, _, cx| {
327 notification_app.update(cx, |state, cx| {
326 notification_app.update(cx, |state, cx| {
@@ -330,7 +329,7 @@ fn settings_more_menu(
330 }),
329 }),
331 )
330 )
332 .item(
331 .item(
333 PopupMenuItem::new("Make a test call")
332 PopupMenuItem::new(tr("status_menu.test_call"))
334 .icon(menu_icon(IconName::Phone))
333 .icon(menu_icon(IconName::Phone))
335 .on_click(move |_, _, cx| {
334 .on_click(move |_, _, cx| {
336 call_app.update(cx, |state, cx| state.start_test_call(cx));
335 call_app.update(cx, |state, cx| state.start_test_call(cx));
@@ -343,7 +342,7 @@ fn settings_more_menu(
343 return popup;
342 return popup;
344 }
343 }
345 popup.item(
344 popup.item(
346 PopupMenuItem::new("Simulate incoming call")
345 PopupMenuItem::new(tr("status_menu.simulate_incoming"))
347 .icon(menu_icon(IconName::Phone))
346 .icon(menu_icon(IconName::Phone))
348 .on_click(move |_, _, cx| {
347 .on_click(move |_, _, cx| {
349 ring_app.update(cx, |state, cx| state.demo_incoming_ring(cx));
348 ring_app.update(cx, |state, cx| state.demo_incoming_ring(cx));
@@ -367,7 +366,7 @@ fn work_location_item(
367 let current = context.status.work_location;
366 let current = context.status.work_location;
368 let app = context.app.clone();
367 let app = context.app.clone();
369 let submenu = PopupMenu::build(window, cx, move |menu, _, _| {
368 let submenu = PopupMenu::build(window, cx, move |menu, _, _| {
370 let pick = |label: &'static str, kind: WorkLocationKind| {
369 let pick = |label: String, kind: WorkLocationKind| {
371 let app = app.clone();
370 let app = app.clone();
372 PopupMenuItem::new(label)
371 PopupMenuItem::new(label)
373 .icon(work_location_icon(Some(kind)))
372 .icon(work_location_icon(Some(kind)))
@@ -377,14 +376,14 @@ fn work_location_item(
377 };
376 };
378 let clear_app = app.clone();
377 let clear_app = app.clone();
379 let menu = menu
378 let menu = menu
380 .item(PopupMenuItem::label("Set work location for today"))
379 .item(PopupMenuItem::label(tr("status_menu.work_location_today")))
381 .item(pick("Office", WorkLocationKind::Office))
380 .item(pick(tr("status_menu.office"), WorkLocationKind::Office))
382 .item(pick("Remote", WorkLocationKind::Remote));
381 .item(pick(tr("status_menu.remote"), WorkLocationKind::Remote));
383 if current.is_none() {
382 if current.is_none() {
384 return menu;
383 return menu;
385 }
384 }
386 menu.separator().item(
385 menu.separator().item(
387 PopupMenuItem::new("Clear work location")
386 PopupMenuItem::new(tr("status_menu.clear_work_location"))
388 .icon(menu_icon(IconName::X))
387 .icon(menu_icon(IconName::X))
389 .on_click(move |_, _, cx| {
388 .on_click(move |_, _, cx| {
390 clear_app.update(cx, |state, cx| state.set_own_work_location(None, cx));
389 clear_app.update(cx, |state, cx| state.set_own_work_location(None, cx));
@@ -429,12 +428,12 @@ fn state_menu(
429 popup
428 popup
430 .separator()
429 .separator()
431 .item(
430 .item(
432 PopupMenuItem::submenu("Duration", durations)
431 PopupMenuItem::submenu(tr("status_menu.duration"), durations)
433 .icon(menu_icon(IconName::Clock))
432 .icon(menu_icon(IconName::Clock))
434 .disabled(target.is_none()),
433 .disabled(target.is_none()),
435 )
434 )
436 .item(
435 .item(
437 PopupMenuItem::new("Reset status")
436 PopupMenuItem::new(tr("status_menu.reset_status"))
438 .icon(menu_icon(IconName::RotateCcw))
437 .icon(menu_icon(IconName::RotateCcw))
439 .on_click(move |_, _, cx| {
438 .on_click(move |_, _, cx| {
440 reset_app.update(cx, |state, cx| state.set_own_availability(None, cx));
439 reset_app.update(cx, |state, cx| state.set_own_availability(None, cx));
crates/app/src/views/status_message_dialog.rs +2 −1
@@ -14,6 +14,7 @@ use teams_core::StatusNote;
14 14
15 15 use super::widgets::symbol;
16 16 use crate::app_state::AppState;
17 use crate::i18n::tr;
17 18 use crate::own_status::{NOTE_DURATIONS, NOTE_LIMIT, NoteDuration, clamp_note};
18 19 use crate::theme::{self, ElevatedSurface as _};
19 20
@@ -300,7 +301,7 @@ impl Render for StatusMessageDialog {
300 301 .child(
301 302 Button::new("status-message-cancel")
302 303 .ghost()
303 .label("Cancel")
304 .label(tr("common.cancel"))
304 305 .on_click(cx.listener(|_, _, _, cx| {
305 306 cx.emit(StatusMessageDialogEvent::Close)
306 307 })),
@@ -14,6 +14,7 @@ use teams_core::StatusNote;
14
14
15use super::widgets::symbol;
15use super::widgets::symbol;
16use crate::app_state::AppState;
16use crate::app_state::AppState;
17use crate::i18n::tr;
17use crate::own_status::{NOTE_DURATIONS, NOTE_LIMIT, NoteDuration, clamp_note};
18use crate::own_status::{NOTE_DURATIONS, NOTE_LIMIT, NoteDuration, clamp_note};
18use crate::theme::{self, ElevatedSurface as _};
19use crate::theme::{self, ElevatedSurface as _};
19
20
@@ -300,7 +301,7 @@ impl Render for StatusMessageDialog {
300 .child(
301 .child(
301 Button::new("status-message-cancel")
302 Button::new("status-message-cancel")
302 .ghost()
303 .ghost()
303 .label("Cancel")
304 .label(tr("common.cancel"))
304 .on_click(cx.listener(|_, _, _, cx| {
305 .on_click(cx.listener(|_, _, _, cx| {
305 cx.emit(StatusMessageDialogEvent::Close)
306 cx.emit(StatusMessageDialogEvent::Close)
306 })),
307 })),
crates/app/src/views/transfer_picker.rs +2 −1
@@ -15,6 +15,7 @@ use super::widgets::icon;
15 15 use crate::app_state::AppState;
16 16 use crate::call::TransferCandidate;
17 17 use crate::fuzzy;
18 use crate::i18n::tr;
18 19 use crate::theme::{self, ElevatedSurface as _};
19 20
20 21 const MAX_RESULTS: usize = 6;
@@ -228,7 +229,7 @@ impl Render for TransferPicker {
228 229 .child(
229 230 Button::new("transfer-cancel")
230 231 .ghost()
231 .label("Cancel")
232 .label(tr("common.cancel"))
232 233 .on_click(cx.listener(|this, _, _, cx| this.close(cx))),
233 234 )
234 235 .children(match self.mode {
@@ -15,6 +15,7 @@ use super::widgets::icon;
15use crate::app_state::AppState;
15use crate::app_state::AppState;
16use crate::call::TransferCandidate;
16use crate::call::TransferCandidate;
17use crate::fuzzy;
17use crate::fuzzy;
18use crate::i18n::tr;
18use crate::theme::{self, ElevatedSurface as _};
19use crate::theme::{self, ElevatedSurface as _};
19
20
20const MAX_RESULTS: usize = 6;
21const MAX_RESULTS: usize = 6;
@@ -228,7 +229,7 @@ impl Render for TransferPicker {
228 .child(
229 .child(
229 Button::new("transfer-cancel")
230 Button::new("transfer-cancel")
230 .ghost()
231 .ghost()
231 .label("Cancel")
232 .label(tr("common.cancel"))
232 .on_click(cx.listener(|this, _, _, cx| this.close(cx))),
233 .on_click(cx.listener(|this, _, _, cx| this.close(cx))),
233 )
234 )
234 .children(match self.mode {
235 .children(match self.mode {