forge
Explore
Log in

Don't you dare go Hollow

Turkish language, redesigned person card, Ctrl+K and room header

Browse files at this commit

61a5ac2600cbe900753d2f2258f35f97c7caf8f2Ahmet Kaan GümüşParent: 679ab95
  • feat
    • Turkish language, redesigned person card, Ctrl+K and room header
Show full message
✨ feat: Turkish language, redesigned person card, Ctrl+K and room header

Translations live in crates/client/lang/{en,tr}/*.txt and build.rs turns them into typed Words; language is a setting, defaulting to the system locale. Dates take month names and order from the language files.

Person card: name alone, status under it, presence is the avatar dot (own card: dot opens a presence menu), account switcher is a chevron after your name. Ctrl+K and the room header follow the approved canvas. The app reopens the last chat per account. The sidebar shield button is gone (Builder lives in Ctrl+K). Stale avatar size test fixed.

147 changed files +4182 -1235

crates/client/Cargo.tomlmodified+1 -0
@@ -30,6 +30,7 @@ tracing = "0.1.44"
30 tracing-subscriber = "0.3.23"30 tracing-subscriber = "0.3.23"
31 jiff = "1.0.2"31 jiff = "1.0.2"
32 dirs = "7.0.0"32 dirs = "7.0.0"
33+sys-locale = "0.3.2"
33 image = { version = "0.25.10", default-features = false, features = ["jpeg", "png", "webp", "gif"] }34 image = { version = "0.25.10", default-features = false, features = ["jpeg", "png", "webp", "gif"] }
34 rtrb = "0.4.1"35 rtrb = "0.4.1"
35 gethostname = "1.1.0"36 gethostname = "1.1.0"
crates/client/build.rsmodified+157 -5
@@ -25,6 +25,7 @@ const MEDIA_FOUNDATION: [&str; 3] = ["mf.dll", "mfplat.dll", "mfreadwrite.dll"];
25 fn main() {25 fn main() {
26 println!("cargo::rerun-if-changed={SOURCE}");26 println!("cargo::rerun-if-changed={SOURCE}");
27 icons();27 icons();
28+ words();
28 if env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") {29 if env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") {
29 for dll in MEDIA_FOUNDATION {30 for dll in MEDIA_FOUNDATION {
30 println!("cargo::rustc-link-arg-bins=/DELAYLOAD:{dll}");31 println!("cargo::rustc-link-arg-bins=/DELAYLOAD:{dll}");
@@ -130,11 +131,15 @@ fn names(value: &Value) -> Vec<String> {
130 }131 }
131 132
132 fn camel(name: &str) -> String {133 fn camel(name: &str) -> String {
133- let mut chars = name.chars();134+ name.split('_')
134- chars135+ .map(|part| {
135- .next()136+ let mut chars = part.chars();
136- .map(|first| first.to_uppercase().chain(chars).collect())137+ chars
137- .unwrap_or_default()138+ .next()
139+ .map(|first| first.to_uppercase().chain(chars).collect::<String>())
140+ .unwrap_or_default()
141+ })
142+ .collect()
138 }143 }
139 144
140 fn hex(color: &str) -> String {145 fn hex(color: &str) -> String {
@@ -194,3 +199,150 @@ fn inset(size: u32) -> Vec<u8> {
194 }199 }
195 canvas200 canvas
196 }201 }
202+
203+const LANGS: [&str; 2] = ["en", "tr"];
204+
205+type Section = Vec<(String, String)>;
206+
207+fn words() {
208+ println!("cargo::rerun-if-changed=lang");
209+ let langs: Vec<Vec<(String, Section)>> = LANGS.map(sections).into();
210+ let base = &langs[0];
211+ for (lang, other) in LANGS.iter().zip(&langs).skip(1) {
212+ assert_eq!(
213+ base.iter().map(|(name, _)| name).collect::<Vec<_>>(),
214+ other.iter().map(|(name, _)| name).collect::<Vec<_>>(),
215+ "lang/{lang}: same files as lang/en"
216+ );
217+ for ((name, en), (_, local)) in base.iter().zip(other) {
218+ let keys = |section: &Section| {
219+ section
220+ .iter()
221+ .map(|(key, _)| key.clone())
222+ .collect::<Vec<_>>()
223+ };
224+ let mut wanted = keys(en);
225+ let mut got = keys(local);
226+ wanted.sort();
227+ got.sort();
228+ assert_eq!(wanted, got, "lang/{lang}/{name}.txt: same keys as lang/en");
229+ for (key, text) in en {
230+ let translated = &local.iter().find(|(other, _)| other == key).expect("key").1;
231+ assert_eq!(
232+ holes(text),
233+ holes(translated),
234+ "lang/{lang}/{name}.txt: {key} placeholders"
235+ );
236+ }
237+ }
238+ }
239+
240+ let mut out = String::new();
241+ writeln!(
242+ out,
243+ "pub struct Words {{\n{}}}",
244+ base.iter()
245+ .map(|(name, _)| format!(" pub {name}: {},\n", camel(name)))
246+ .collect::<String>()
247+ )
248+ .unwrap();
249+ for (name, section) in base {
250+ writeln!(out, "pub struct {} {{", camel(name)).unwrap();
251+ for (key, text) in section {
252+ let public = if holes(text).is_empty() { "pub " } else { "" };
253+ writeln!(out, " {public}{key}: &'static str,").unwrap();
254+ }
255+ writeln!(out, "}}\nimpl {} {{", camel(name)).unwrap();
256+ for (key, text) in section {
257+ let holes = holes(text);
258+ if holes.is_empty() {
259+ continue;
260+ }
261+ writeln!(
262+ out,
263+ " pub fn {key}(&self, {}) -> String {{ self.{key}{} }}",
264+ holes
265+ .iter()
266+ .map(|hole| format!("{hole}: impl std::fmt::Display"))
267+ .collect::<Vec<_>>()
268+ .join(", "),
269+ holes
270+ .iter()
271+ .map(|hole| format!(".replace(\"{{{hole}}}\", &{hole}.to_string())"))
272+ .collect::<String>()
273+ )
274+ .unwrap();
275+ }
276+ writeln!(out, "}}").unwrap();
277+ }
278+ for (lang, sections) in LANGS.iter().zip(&langs) {
279+ writeln!(out, "pub static {}: Words = Words {{", lang.to_uppercase()).unwrap();
280+ for (name, section) in sections {
281+ writeln!(out, " {name}: {} {{", camel(name)).unwrap();
282+ for (key, text) in section {
283+ writeln!(out, " {key}: {text:?},").unwrap();
284+ }
285+ writeln!(out, " }},").unwrap();
286+ }
287+ writeln!(out, "}};").unwrap();
288+ }
289+
290+ let path = Path::new(&env::var("OUT_DIR").expect("OUT_DIR")).join("words.rs");
291+ fs::write(path, out).expect("write words");
292+}
293+
294+fn sections(lang: &str) -> Vec<(String, Section)> {
295+ let mut files: Vec<PathBuf> = fs::read_dir(format!("lang/{lang}"))
296+ .expect("lang dir")
297+ .map(|entry| entry.expect("lang entry").path())
298+ .filter(|path| path.extension().is_some_and(|ext| ext == "txt"))
299+ .collect();
300+ files.sort();
301+ files
302+ .into_iter()
303+ .map(|path| {
304+ let name = path
305+ .file_stem()
306+ .expect("stem")
307+ .to_string_lossy()
308+ .to_string();
309+ let text = fs::read_to_string(&path).expect("read lang");
310+ let mut section = Section::new();
311+ for line in text.lines().map(str::trim) {
312+ if line.is_empty() || line.starts_with('#') {
313+ continue;
314+ }
315+ let (key, value) = line
316+ .split_once('=')
317+ .unwrap_or_else(|| panic!("{}: `key = text` expected: {line}", path.display()));
318+ let key = key.trim().to_string();
319+ assert!(
320+ !key.is_empty()
321+ && key
322+ .chars()
323+ .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_'),
324+ "{}: bad key {key}",
325+ path.display()
326+ );
327+ assert!(
328+ section.iter().all(|(other, _)| *other != key),
329+ "{}: duplicate key {key}",
330+ path.display()
331+ );
332+ section.push((key, value.trim().replace("\\n", "\n")));
333+ }
334+ (name, section)
335+ })
336+ .collect()
337+}
338+
339+fn holes(text: &str) -> Vec<String> {
340+ let mut holes: Vec<String> = text
341+ .split('{')
342+ .skip(1)
343+ .filter_map(|part| part.split_once('}').map(|(hole, _)| hole.to_string()))
344+ .collect();
345+ holes.sort();
346+ holes.dedup();
347+ holes
348+}
crates/client/lang/en/audio_capture_windows.txtadded+2 -0
@@ -0,0 +1,2 @@
1+app_not_running = share audio app is not running
2+device_unsupported = share audio device capture is not supported
crates/client/lang/en/auth.txtadded+9 -0
@@ -0,0 +1,9 @@
1+server = Server
2+username_placeholder = Username...
3+password_placeholder = Password...
4+invite_placeholder = Invite code...
5+log_in = Log in
6+register = Register
7+maintenance = Maintenance
8+accept_any_cert = Accept any certificate
9+forget = Forget
crates/client/lang/en/builder.txtadded+14 -0
@@ -0,0 +1,14 @@
1+overview = Overview
2+users = Users
3+communities = Communities
4+messages = Messages
5+voice = Voice
6+storage = Storage
7+access = Access
8+reports = Reports
9+server = Server
10+log = Log
11+ghost = Ghost
12+refresh = Refresh
13+save = Save
14+export = Export
crates/client/lang/en/builder_access.txtadded+12 -0
@@ -0,0 +1,12 @@
1+never = never
2+expires = expires {time}
3+one_use_left = 1 use left
4+uses_left = {count} uses left
5+copy = Copy
6+username = Username
7+remove = Remove
8+create = Create
9+invite_codes = Invite codes
10+bans = Bans
11+no_invite_codes = No invite codes
12+no_bans = No bans
crates/client/lang/en/builder_backups.txtadded+4 -0
@@ -0,0 +1,4 @@
1+backups = Backups
2+create = Create
3+export = Export
4+no_backups = No backups
crates/client/lang/en/builder_communities.txtadded+11 -0
@@ -0,0 +1,11 @@
1+empty = No communities
2+voice_off = Voice off
3+voice_on = Voice on
4+open = Open
5+log = Log
6+transfer = Transfer
7+confirm = Confirm
8+confirm_delete = Confirm delete
9+delete = Delete
10+members = {count} members
11+owner = owner {name}
crates/client/lang/en/builder_log.txtadded+37 -0
@@ -0,0 +1,37 @@
1+role_changed = {actor} set {target} to {role}
2+user_deleted = {actor} deleted {target}
3+user_suspended = {actor} suspended {target}
4+user_unsuspended = {actor} unsuspended {target}
5+sessions_revoked = {actor} revoked sessions of {target}
6+password_reset = {actor} reset password of {target}
7+profile_cleared = {actor} cleared profile of {target}
8+user_created = {actor} created {target}
9+community_deleted = {actor} deleted {community}
10+ownership_transferred = {actor} transferred {community} to {target}
11+settings_changed = {actor} changed settings
12+user_renamed = {actor} renamed {from} to {target}
13+user_timeout_cleared = {actor} cleared timeout of {target}
14+user_timed_out = {actor} timed out {target} for {minutes} min
15+user_banned = {actor} banned {target}
16+ban_removed = {actor} removed a ban
17+invite_created = {actor} created an invite code
18+invite_deleted = {actor} deleted an invite code
19+report_handled = {actor} marked a report of {target} as {status}
20+message_deleted = {actor} deleted a message of {target} in {community}
21+user_purged = {actor} purged {target}, {messages} messages
22+voice_kicked = {actor} kicked {target} from voice
23+voice_muted = {actor} muted {target} in voice
24+voice_unmuted = {actor} unmuted {target} in voice
25+community_voice_enabled = {actor} enabled voice in {community}
26+community_voice_disabled = {actor} disabled voice in {community}
27+attachment_deleted = {actor} deleted an attachment of {target} in {community}
28+ghost_enabled = {actor} enabled ghost mode
29+ghost_disabled = {actor} disabled ghost mode
30+ghost_visit = {actor} visited {community} as ghost
31+ghost_voice = {actor} listened in {community} as ghost for {seconds}s
32+backup_created = {actor} created backup {name}
33+backup_deleted = {actor} deleted backup {name}
34+backup_downloaded = {actor} exported backup {name}
35+unknown_user = Unknown user
36+apply = Apply
37+no_entries = No entries
crates/client/lang/en/builder_messages.txtadded+7 -0
@@ -0,0 +1,7 @@
1+open_chat = Open chat
2+confirm_purge = Confirm purge
3+purge_user = Purge user
4+no_messages = No messages
5+search = Search
6+unknown_user = Unknown user
7+unknown_community = Unknown community
crates/client/lang/en/builder_overview.txtadded+9 -0
@@ -0,0 +1,9 @@
1+users = Users
2+builders = Builders
3+communities = Communities
4+online = Online
5+in_voice = In voice
6+storage = Storage
7+active_users = Active users
8+messages = Messages
9+server = Server
crates/client/lang/en/builder_reports.txtadded+11 -0
@@ -0,0 +1,11 @@
1+all = All
2+someone = someone
3+deleted_community = deleted community
4+reported_by = reported by {name}
5+handled_by = by {name}
6+no_reports = No reports
7+resolve = Resolve
8+dismiss = Dismiss
9+delete_message = Delete message
10+timeout = Timeout 1h
11+ban = Ban
crates/client/lang/en/builder_server.txtadded+25 -0
@@ -0,0 +1,25 @@
1+name = Name
2+registration = Registration
3+open = Open
4+closed = Closed
5+maintenance = Maintenance
6+off = Off
7+on = On
8+announcement = Announcement
9+max_attachment = Max attachment (MB)
10+max_avatar = Max avatar (KB)
11+max_message_length = Max message length
12+communities_per_user = Communities per user
13+user_quota = User quota (MB)
14+community_quota = Community quota (MB)
15+message_retention = Message retention (days)
16+attachment_retention = Attachment retention (days)
17+messages_per_minute = Messages / min
18+logins_per_minute = Logins / min
19+general = General
20+limits = Limits
21+storage = Storage
22+rate_limits = Rate limits
23+zero_unlimited = 0 = unlimited
24+zero_off = 0 = off
25+invalid_number = Invalid number
crates/client/lang/en/builder_storage.txtadded+8 -0
@@ -0,0 +1,8 @@
1+users = Users
2+communities = Communities
3+no_data = No data
4+search = Search
5+no_attachments = No attachments
6+attachments = Attachments
7+unknown_user = Unknown user
8+unknown_community = Unknown community
crates/client/lang/en/builder_ui.txtadded+3 -0
@@ -0,0 +1,3 @@
1+confirm = Confirm
2+delete = Delete
3+confirm_tip = Click again to confirm
crates/client/lang/en/builder_users.txtadded+49 -0
@@ -0,0 +1,49 @@
1+seen_never = never
2+seen_now = now
3+seen_minutes = {count}m ago
4+seen_hours = {count}h ago
5+no_users = No users
6+create = Create
7+confirm = Confirm
8+revoke = Revoke
9+end_session = End this session
10+unknown_device = unknown device
11+ip_on = IP: on
12+ip_off = IP: off
13+manage = Manage
14+remove_builder = Remove builder
15+make_builder = Make builder
16+revoke_admin = Revoke admin tools
17+grant_admin = Grant admin tools
18+unsuspend = Unsuspend
19+suspend = Suspend
20+allow_sign_in = Allow sign in again
21+block_until_lifted = Block sign in until lifted
22+sign_out = Sign out
23+end_all_sessions = End every session
24+stats = Stats
25+stats_tip = Live connection and machine stats
26+password = Password
27+password_tip = Set a new password
28+rename = Rename
29+rename_tip = Change username
30+timeout = Timeout
31+timeout_tip = Block sign in for a while
32+ban = Ban
33+ban_tip = Ban username or IP from the server
34+clear_profile = Clear profile
35+clear_profile_tip = Remove avatar and status
36+purge = Purge
37+purge_tip = Delete all their messages
38+delete = Delete
39+delete_tip = Delete the account
40+tag_suspended = Suspended
41+tag_timed_out = Timed out
42+tag_ghost = Ghost
43+joined_seen = joined {joined} · seen {seen}
44+group_account = Account
45+group_moderation = Moderation
46+group_danger = Danger
47+group_sessions = Sessions
48+group_friends = Friends
49+tag_builder = Builder
crates/client/lang/en/builder_voice.txtadded+10 -0
@@ -0,0 +1,10 @@
1+no_rooms = No active voice rooms
2+join = Join
3+voice_on = Voice on
4+voice_off = Voice off
5+no_users = No users
6+muted = Muted
7+ghost = Ghost
8+unmute = Unmute
9+mute = Mute
10+kick = Kick
crates/client/lang/en/call_bar.txtadded+11 -0
@@ -0,0 +1,11 @@
1+unmute = Unmute
2+mute = Mute
3+undeafen = Undeafen
4+deafen = Deafen
5+turn_off_camera = Turn off camera
6+turn_on_camera = Turn on camera
7+stop_sharing = Stop sharing
8+share_screen = Share screen
9+leave_call = Leave call
10+go_to_call = Go to call
11+connection_stats = Connection stats
crates/client/lang/en/camera.txtadded+3 -0
@@ -0,0 +1,3 @@
1+needs_media_pack = Camera needs the Media Feature Pack
2+no_response = Camera did not respond
3+not_found = No camera found
crates/client/lang/en/camera_view.txtadded+3 -0
@@ -0,0 +1,3 @@
1+watch = Watch
2+screens = screens
3+more = {count} more
crates/client/lang/en/capture.txtadded+2 -0
@@ -0,0 +1,2 @@
1+did_not_start = screen capture did not start
2+no_stream = no screen stream
crates/client/lang/en/capture_windows.txtadded+3 -0
@@ -0,0 +1,3 @@
1+screen = Screen
2+screen_numbered = Screen {number}
3+window_gone = window is gone
crates/client/lang/en/chat.txtadded+64 -0
@@ -0,0 +1,64 @@
1+message = Message
2+find = Find
3+find_user = Find user
4+search_messages = Search messages
5+search = Search...
6+new_password = New password...
7+password = Password...
8+question = Question
9+username = Username...
10+community_name = Community name...
11+status = Status...
12+actor = Actor...
13+target = Target...
14+all = All
15+date_from = From YYYY-MM-DD
16+date_to = To YYYY-MM-DD
17+text = Text...
18+user = User...
19+community = Community...
20+server_name = Server name...
21+announcement = Announcement...
22+max_message_length = Max message length...
23+minutes = Minutes...
24+reason = Reason...
25+uses = Uses...
26+hours = Hours
27+new_username = New username...
28+someone = Someone
29+unknown = unknown
30+typing_one = {name} is typing…
31+typing_many = {count} people are typing…
32+new_messages = {count} new messages
33+people = People
34+send = Send
35+ghost_title = Speak as ghost?
36+ghost_hint = Everyone in the call will hear you.
37+cancel = Cancel
38+speak = Speak
39+call = Call
40+hang_up = Hang up
41+join = Join
42+leave = Leave
43+calling = Calling…
44+accept = Accept
45+decline = Decline
46+is_calling = {name} is calling
47+strip = Strip
48+grid = Grid
49+hide = Hide
50+stats = Connection stats
51+stats_hide = Hide connection stats
52+in_call = In call
53+online = Online
54+offline = Offline
55+new = New
56+edited = (edited)
57+calls = {count} calls
58+call_started_mine = You started a call
59+call_started = {name} started a call
60+call_declined_mine = You declined the call
61+call_declined = {name} declined the call
62+call_missed_mine = You called, no answer
63+call_missed = Missed call from {name}
64+call_ended = Call ended · {duration}
crates/client/lang/en/common.txtadded+20 -0
@@ -0,0 +1,20 @@
1+language = English
2+role_user = User
3+role_builder = Builder
4+presence_online = Online
5+presence_busy = Busy
6+presence_offline = Offline
7+rank_member = Member
8+rank_moderator = Moderator
9+rank_admin = Admin
10+rank_owner = Owner
11+rank_builder = Builder
12+report_open = Open
13+report_resolved = Resolved
14+report_dismissed = Dismissed
15+months = Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
16+stamp = %b %-d, %H:%M
17+year_stamp = %b %-d %Y, %H:%M
18+day = %b %-d
19+day_year = %b %-d, %Y
20+date = %b %-d %Y
crates/client/lang/en/community_settings.txtadded+31 -0
@@ -0,0 +1,31 @@
1+profile = Profile
2+general = General
3+name = Name
4+voice = Voice
5+bans = Bans
6+logs = Logs
7+moderation = Moderation
8+leave_community = Leave community
9+delete_community = Delete community
10+newest = Newest
11+oldest = Oldest
12+on = On
13+off = Off
14+view = View
15+leave = Leave
16+unban = Unban
17+no_bans = No bans
18+no_logs = No logs
19+someone = someone
20+created = {actor} created the community
21+renamed = {actor} renamed to {name}
22+avatar_changed = {actor} changed the avatar
23+avatar_removed = {actor} removed the avatar
24+invited = {actor} invited {target}
25+joined_log = {actor} joined
26+left_log = {actor} left
27+kicked = {actor} kicked {target}
28+banned = {actor} banned {target}
29+unbanned = {actor} unbanned {target}
30+rank_changed = {actor} changed rank of {target} to {rank}
31+message_deleted = {actor} deleted a message by {target}
crates/client/lang/en/composer.txtadded+18 -0
@@ -0,0 +1,18 @@
1+selected = {count} selected
2+forward = Forward
3+replying_to = Replying to
4+unknown_author = unknown
5+slow_down = Slow down, you can send again in {seconds}s
6+editing = Editing
7+cancel = Cancel
8+no_community = No Community Selected
9+option = Option
10+remove_option = Remove option
11+file = File
12+poll = Poll
13+hour = 1h
14+day = 1d
15+week = 1w
16+multiple_answers = Multiple answers
17+show_voters = Show voters
18+create = Create
crates/client/lang/en/fail.txtadded+6 -0
@@ -0,0 +1,6 @@
1+unreachable = Server unreachable
2+tls = Certificate error
3+outdated = Client is outdated
4+reset = Connection lost
5+offline = Offline
6+protocol = Protocol error
crates/client/lang/en/forward.txtadded+3 -0
@@ -0,0 +1,3 @@
1+filter = Filter
2+keep_authors = Keep authors
3+forward = Forward
crates/client/lang/en/gui.txtadded+8 -0
@@ -0,0 +1,8 @@
1+notes = Notes
2+connecting = Connecting…
3+reconnecting = Reconnecting… {error} ({attempts})
4+not_connected = Not connected
5+banned = Banned from {community}
6+banned_reason = Banned from {community}: {reason}
7+kicked = Kicked from {community}
8+kicked_reason = Kicked from {community}: {reason}
crates/client/lang/en/jump.txtadded+19 -0
@@ -0,0 +1,19 @@
1+placeholder = Where to?
2+esc = esc
3+hint_settings = settings
4+hint_theme = theme
5+notes = Notes
6+friends = Friends
7+mute = Mute
8+unmute = Unmute
9+deafen = Deafen
10+undeafen = Undeafen
11+stop_sharing = Stop sharing
12+share_screen = Share screen
13+camera_on = Camera on
14+camera_off = Camera off
15+leave_call = Leave call
16+new_community = New community
17+expand_sidebar = Expand sidebar
18+collapse_sidebar = Collapse sidebar
19+log_out = Log out
crates/client/lang/en/media_mod.txtadded+1 -0
@@ -0,0 +1 @@
1+no_track = no playable video or audio track
crates/client/lang/en/media_view.txtadded+4 -0
@@ -0,0 +1,4 @@
1+save = Save
2+play = Play
3+pause = Pause
4+remove = Remove
crates/client/lang/en/message_actions.txtadded+11 -0
@@ -0,0 +1,11 @@
1+attachments = {count} attachments
2+reply = Reply
3+edit = Edit
4+forward = Forward
5+select = Select
6+pin = Pin
7+unpin = Unpin
8+report = Report
9+confirm = Confirm
10+delete = Delete
11+send = Send
crates/client/lang/en/poll.txtadded+12 -0
@@ -0,0 +1,12 @@
1+days_left = {count}d
2+hours_left = {count}h
3+minutes_left = {count}m
4+end_poll = End poll
5+voters_visible = Voters visible
6+anonymous = Anonymous
7+multiple_choice = Multiple choice
8+closed = Closed
9+votes = {count} votes
10+previous = Previous
11+next = Next
12+jump_to_message = Jump to message
crates/client/lang/en/profile.txtadded+18 -0
@@ -0,0 +1,18 @@
1+message = Message
2+call = Call
3+report = Report
4+more = More
5+kick = Kick
6+ban = Ban
7+make_rank = Make {rank}
8+delete_user = Delete user
9+confirm = Confirm
10+a_call = a call
11+in_room = in {room}
12+edit_status = Edit status
13+mute = Mute
14+accounts = Accounts
15+settings = Settings
16+log_out = Log out
17+add_account = Add account
18+reason_optional = Reason (optional)
crates/client/lang/en/session.txtadded+1 -0
@@ -0,0 +1 @@
1+codec_unavailable = codec unavailable
crates/client/lang/en/settings.txtadded+3 -0
@@ -0,0 +1,3 @@
1+small = Small
2+medium = Medium
3+large = Large
crates/client/lang/en/settings_page.txtadded+30 -0
@@ -0,0 +1,30 @@
1+profile = Profile
2+voice = Voice
3+camera_share = Camera & share
4+appearance = Appearance
5+title = Settings
6+back = Back
7+identity = Identity
8+name = Name
9+status = Status
10+presence = Presence
11+account = Account
12+log_out = Log out
13+delete_account = Delete account
14+danger_zone = Danger zone
15+delete = Delete
16+confirm = Confirm
17+save = Save
18+remove = Remove
19+change_picture = Change picture
20+theme = Theme
21+font_size = Font size
22+language = Language
23+close_to_tray = Close to tray
24+your_hue = Your hue
25+camera = Camera
26+screen_share = Screen share
27+quality = Quality
28+frame_rate = Frame rate
29+codec = Codec
30+share_audio = Share audio
crates/client/lang/en/share_view.txtadded+21 -0
@@ -0,0 +1,21 @@
1+share = Share
2+off = Off
3+all = All
4+pick = Pick
5+no_camera = No camera
6+resolution = Resolution
7+codec = Codec
8+sound_from = Sound from
9+apps = Apps
10+outputs = Outputs
11+inputs = Inputs
12+esc_exit = Esc to leave fullscreen
13+stream_stats = Stream stats
14+unmute = Unmute
15+mute = Mute
16+close = Close
17+exit_fullscreen = Exit fullscreen
18+fullscreen = Fullscreen
19+screen_settings = Screen settings
20+camera_settings = Camera settings
21+auto = Auto
crates/client/lang/en/sidebar.txtadded+26 -0
@@ -0,0 +1,26 @@
1+in_call = In call
2+go_to_call = Go to call
3+new_community = New community
4+create = Create
5+name_placeholder = Name...
6+expand = Expand
7+collapse = Collapse
8+notes = Notes
9+remove_friend = Remove friend
10+requests = Requests
11+message = Message
12+accept = Accept
13+decline = Decline
14+cancel = Cancel
15+from_user = from {name}
16+ghost_on = Ghost on
17+stop_watching = Stop watching
18+watch_camera = Watch camera
19+watch_screen = Watch screen
20+invite = Invite
21+settings = Settings
22+pin = Pin
23+unpin = Unpin
24+mute = Mute
25+unmute = Unmute
26+leave = Leave
crates/client/lang/en/snippet.txtadded+2 -0
@@ -0,0 +1,2 @@
1+forwarded = Forwarded
2+forwarded_from = Forwarded · {origin}
crates/client/lang/en/social.txtadded+7 -0
@@ -0,0 +1,7 @@
1+remove_friend = Remove friend
2+cancel_request = Cancel request
3+accept_friend = Accept friend
4+add_friend = Add friend
5+username_placeholder = Username...
6+invite = Invite
7+no_such_user = No such user
crates/client/lang/en/stream_stats.txtadded+4 -0
@@ -0,0 +1,4 @@
1+loss = loss %
2+latency = latency ms
3+buffer = buffer {count} ms
4+keyframes = keyframes {count}
crates/client/lang/en/tray.txtadded+3 -0
@@ -0,0 +1,3 @@
1+tip = {name} · {messages} unread · {mentions} mentions
2+show = Show
3+quit = Quit
crates/client/lang/en/unsupported.txtadded+1 -0
@@ -0,0 +1 @@
1+not_supported = screen share is not supported on this OS
crates/client/lang/en/voice_note.txtadded+4 -0
@@ -0,0 +1,4 @@
1+cancel = Cancel
2+send = Send
3+voice_message = Voice message
4+leave_call_first = Leave voice call first
crates/client/lang/en/voice_settings.txtadded+21 -0
@@ -0,0 +1,21 @@
1+default = Default
2+voice_activity = Voice activity
3+push_to_talk = Push to talk
4+voice = Voice
5+music = Music
6+input_device = Input device
7+output_device = Output device
8+input_volume = Input volume
9+output_volume = Output volume
10+mode = Mode
11+profile = Profile
12+test = Test
13+sensitivity = Sensitivity
14+key = Key
15+stop = Stop
16+hear_yourself = Hear yourself
17+play_sound = Play sound
18+press_key = Press key
19+set_key = Set key
20+microphone = Microphone
21+speaker = Speaker
crates/client/lang/en/voice_stats.txtadded+29 -0
@@ -0,0 +1,29 @@
1+good = good
2+fair = fair
3+poor = poor
4+connection = Connection
5+traffic = Traffic
6+this_machine = This machine
7+sending_screen = Sending screen
8+sending_camera = Sending camera
9+watching = Watching
10+streams_one = {count} stream
11+streams_many = {count} streams
12+loss = loss %
13+buffer = buffer ms
14+up = up
15+down = down
16+rate = rate
17+memory = memory
18+storage = storage
19+thread_gui = gui
20+thread_camera = camera
21+thread_encode = encode
22+thread_decode = decode
23+camera = camera
24+screen = screen
25+hardware = hardware
26+software = software
27+latency = latency {ms}
28+loss_now = loss {percent} %
29+keyframes = keyframes {count}
crates/client/lang/tr/audio_capture_windows.txtadded+2 -0
@@ -0,0 +1,2 @@
1+app_not_running = paylaşılacak ses uygulaması çalışmıyor
2+device_unsupported = ses aygıtı yakalama desteklenmiyor
crates/client/lang/tr/auth.txtadded+9 -0
@@ -0,0 +1,9 @@
1+server = Sunucu
2+username_placeholder = Kullanıcı adı...
3+password_placeholder = Şifre...
4+invite_placeholder = Davet kodu...
5+log_in = Giriş yap
6+register = Kayıt ol
7+maintenance = Bakım
8+accept_any_cert = Her sertifikayı kabul et
9+forget = Unut
crates/client/lang/tr/builder.txtadded+14 -0
@@ -0,0 +1,14 @@
1+overview = Genel Bakış
2+users = Kullanıcılar
3+communities = Topluluklar
4+messages = Mesajlar
5+voice = Ses
6+storage = Depolama
7+access = Erişim
8+reports = Raporlar
9+server = Sunucu
10+log = Günlük
11+ghost = Hayalet
12+refresh = Yenile
13+save = Kaydet
14+export = Dışa aktar
crates/client/lang/tr/builder_access.txtadded+12 -0
@@ -0,0 +1,12 @@
1+never = süresiz
2+expires = son: {time}
3+one_use_left = 1 kullanım kaldı
4+uses_left = {count} kullanım kaldı
5+copy = Kopyala
6+username = Kullanıcı adı
7+remove = Kaldır
8+create = Oluştur
9+invite_codes = Davet kodları
10+bans = Yasaklar
11+no_invite_codes = Davet kodu yok
12+no_bans = Yasak yok
crates/client/lang/tr/builder_backups.txtadded+4 -0
@@ -0,0 +1,4 @@
1+backups = Yedekler
2+create = Oluştur
3+export = Dışa aktar
4+no_backups = Yedek yok
crates/client/lang/tr/builder_communities.txtadded+11 -0
@@ -0,0 +1,11 @@
1+empty = Topluluk yok
2+voice_off = Ses kapalı
3+voice_on = Ses açık
4+open = Aç
5+log = Günlük
6+transfer = Devret
7+confirm = Onayla
8+confirm_delete = Silmeyi onayla
9+delete = Sil
10+members = {count} üye
11+owner = sahip: {name}
crates/client/lang/tr/builder_log.txtadded+37 -0
@@ -0,0 +1,37 @@
1+role_changed = {actor} rolünü değiştirdi: {target} → {role}
2+user_deleted = {actor} sildi: {target}
3+user_suspended = {actor} askıya aldı: {target}
4+user_unsuspended = {actor} askıdan çıkardı: {target}
5+sessions_revoked = {actor} oturumları kapattı: {target}
6+password_reset = {actor} şifreyi sıfırladı: {target}
7+profile_cleared = {actor} profili temizledi: {target}
8+user_created = {actor} oluşturdu: {target}
9+community_deleted = {actor} topluluğu sildi: {community}
10+ownership_transferred = {actor} sahipliği devretti: {community} → {target}
11+settings_changed = {actor} ayarları değiştirdi
12+user_renamed = {actor} adını değiştirdi: {from} → {target}
13+user_timeout_cleared = {actor} susturmayı kaldırdı: {target}
14+user_timed_out = {actor} susturdu: {target} ({minutes} dk)
15+user_banned = {actor} yasakladı: {target}
16+ban_removed = {actor} yasağı kaldırdı
17+invite_created = {actor} davet kodu oluşturdu
18+invite_deleted = {actor} davet kodunu sildi
19+report_handled = {actor} raporu işaretledi: {target} → {status}
20+message_deleted = {actor} mesaj sildi: {target} ({community})
21+user_purged = {actor} temizledi: {target}, {messages} mesaj
22+voice_kicked = {actor} sesten attı: {target}
23+voice_muted = {actor} sesli sohbette susturdu: {target}
24+voice_unmuted = {actor} sesli sohbette sesini açtı: {target}
25+community_voice_enabled = {actor} sesi açtı: {community}
26+community_voice_disabled = {actor} sesi kapattı: {community}
27+attachment_deleted = {actor} ek sildi: {target} ({community})
28+ghost_enabled = {actor} hayalet modu açtı
29+ghost_disabled = {actor} hayalet modu kapattı
30+ghost_visit = {actor} hayalet olarak ziyaret etti: {community}
31+ghost_voice = {actor} hayalet olarak dinledi: {community} ({seconds} sn)
32+backup_created = {actor} yedek oluşturdu: {name}
33+backup_deleted = {actor} yedeği sildi: {name}
34+backup_downloaded = {actor} yedeği dışa aktardı: {name}
35+unknown_user = Bilinmeyen kullanıcı
36+apply = Uygula
37+no_entries = Kayıt yok
crates/client/lang/tr/builder_messages.txtadded+7 -0
@@ -0,0 +1,7 @@
1+open_chat = Sohbeti aç
2+confirm_purge = Temizlemeyi onayla
3+purge_user = Kullanıcıyı temizle
4+no_messages = Mesaj yok
5+search = Ara
6+unknown_user = Bilinmeyen kullanıcı
7+unknown_community = Bilinmeyen topluluk
crates/client/lang/tr/builder_overview.txtadded+9 -0
@@ -0,0 +1,9 @@
1+users = Kullanıcılar
2+builders = Kurucular
3+communities = Topluluklar
4+online = Çevrimiçi
5+in_voice = Seste
6+storage = Depolama
7+active_users = Aktif kullanıcılar
8+messages = Mesajlar
9+server = Sunucu
crates/client/lang/tr/builder_reports.txtadded+11 -0
@@ -0,0 +1,11 @@
1+all = Tümü
2+someone = birisi
3+deleted_community = silinmiş topluluk
4+reported_by = bildiren: {name}
5+handled_by = işleyen: {name}
6+no_reports = Rapor yok
7+resolve = Çöz
8+dismiss = Reddet
9+delete_message = Mesajı sil
10+timeout = 1 saat sustur
11+ban = Yasakla
crates/client/lang/tr/builder_server.txtadded+25 -0
@@ -0,0 +1,25 @@
1+name = Ad
2+registration = Kayıt
3+open = Açık
4+closed = Kapalı
5+maintenance = Bakım
6+off = Kapalı
7+on = Açık
8+announcement = Duyuru
9+max_attachment = Maks. ek boyutu (MB)
10+max_avatar = Maks. avatar boyutu (KB)
11+max_message_length = Maks. mesaj uzunluğu
12+communities_per_user = Kullanıcı başına topluluk
13+user_quota = Kullanıcı kotası (MB)
14+community_quota = Topluluk kotası (MB)
15+message_retention = Mesaj saklama (gün)
16+attachment_retention = Ek saklama (gün)
17+messages_per_minute = Mesaj / dk
18+logins_per_minute = Giriş / dk
19+general = Genel
20+limits = Sınırlar
21+storage = Depolama
22+rate_limits = Hız sınırları
23+zero_unlimited = 0 = sınırsız
24+zero_off = 0 = kapalı
25+invalid_number = Geçersiz sayı
crates/client/lang/tr/builder_storage.txtadded+8 -0
@@ -0,0 +1,8 @@
1+users = Kullanıcılar
2+communities = Topluluklar
3+no_data = Veri yok
4+search = Ara
5+no_attachments = Ek yok
6+attachments = Ekler
7+unknown_user = Bilinmeyen kullanıcı
8+unknown_community = Bilinmeyen topluluk
crates/client/lang/tr/builder_ui.txtadded+3 -0
@@ -0,0 +1,3 @@
1+confirm = Onayla
2+delete = Sil
3+confirm_tip = Onaylamak için tekrar tıkla
crates/client/lang/tr/builder_users.txtadded+49 -0
@@ -0,0 +1,49 @@
1+seen_never = hiç
2+seen_now = şimdi
3+seen_minutes = {count} dk önce
4+seen_hours = {count} sa önce
5+no_users = Kullanıcı yok
6+create = Oluştur
7+confirm = Onayla
8+revoke = İptal et
9+end_session = Bu oturumu sonlandır
10+unknown_device = bilinmeyen cihaz
11+ip_on = IP: açık
12+ip_off = IP: kapalı
13+manage = Yönet
14+remove_builder = Kurucu yetkisini al
15+make_builder = Kurucu yap
16+revoke_admin = Yönetici araçlarını al
17+grant_admin = Yönetici araçlarını ver
18+unsuspend = Askıyı kaldır
19+suspend = Askıya al
20+allow_sign_in = Yeniden girişe izin ver
21+block_until_lifted = Kaldırılana kadar girişi engelle
22+sign_out = Oturumu kapat
23+end_all_sessions = Tüm oturumları sonlandır
24+stats = İstatistik
25+stats_tip = Canlı bağlantı ve makine istatistikleri
26+password = Şifre
27+password_tip = Yeni şifre belirle
28+rename = Yeniden adlandır
29+rename_tip = Kullanıcı adını değiştir
30+timeout = Zaman aşımı
31+timeout_tip = Bir süreliğine girişi engelle
32+ban = Yasakla
33+ban_tip = Kullanıcı adını veya IP'yi sunucudan yasakla
34+clear_profile = Profili temizle
35+clear_profile_tip = Avatar ve durumu kaldır
36+purge = Mesajları sil
37+purge_tip = Tüm mesajlarını sil
38+delete = Sil
39+delete_tip = Hesabı sil
40+tag_suspended = Askıda
41+tag_timed_out = Zaman aşımında
42+tag_ghost = Hayalet
43+joined_seen = katıldı {joined} · görüldü {seen}
44+group_account = Hesap
45+group_moderation = Moderasyon
46+group_danger = Tehlike
47+group_sessions = Oturumlar
48+group_friends = Arkadaşlar
49+tag_builder = Kurucu
crates/client/lang/tr/builder_voice.txtadded+10 -0
@@ -0,0 +1,10 @@
1+no_rooms = Aktif ses odası yok
2+join = Katıl
3+voice_on = Ses açık
4+voice_off = Ses kapalı
5+no_users = Kullanıcı yok
6+muted = Susturuldu
7+ghost = Hayalet
8+unmute = Sesi aç
9+mute = Sustur
10+kick = At
crates/client/lang/tr/call_bar.txtadded+11 -0
@@ -0,0 +1,11 @@
1+unmute = Sesi aç
2+mute = Sessize al
3+undeafen = Sağırlaştırmayı kaldır
4+deafen = Sağırlaştır
5+turn_off_camera = Kamerayı kapat
6+turn_on_camera = Kamerayı aç
7+stop_sharing = Paylaşımı durdur
8+share_screen = Ekranı paylaş
9+leave_call = Görüşmeden ayrıl
10+go_to_call = Görüşmeye git
11+connection_stats = Bağlantı istatistikleri
crates/client/lang/tr/camera.txtadded+3 -0
@@ -0,0 +1,3 @@
1+needs_media_pack = Kamera için Media Feature Pack gerekli
2+no_response = Kamera yanıt vermedi
3+not_found = Kamera bulunamadı
crates/client/lang/tr/camera_view.txtadded+3 -0
@@ -0,0 +1,3 @@
1+watch = İzle
2+screens = ekran
3+more = {count} daha
crates/client/lang/tr/capture.txtadded+2 -0
@@ -0,0 +1,2 @@
1+did_not_start = ekran yakalama başlamadı
2+no_stream = ekran akışı yok
crates/client/lang/tr/capture_windows.txtadded+3 -0
@@ -0,0 +1,3 @@
1+screen = Ekran
2+screen_numbered = Ekran {number}
3+window_gone = pencere artık yok
crates/client/lang/tr/chat.txtadded+64 -0
@@ -0,0 +1,64 @@
1+message = Mesaj
2+find = Bul
3+find_user = Kullanıcı bul
4+search_messages = Mesajlarda ara
5+search = Ara...
6+new_password = Yeni şifre...
7+password = Şifre...
8+question = Soru
9+username = Kullanıcı adı...
10+community_name = Topluluk adı...
11+status = Durum...
12+actor = Yapan...
13+target = Hedef...
14+all = Tümü
15+date_from = Başlangıç YYYY-AA-GG
16+date_to = Bitiş YYYY-AA-GG
17+text = Metin...
18+user = Kullanıcı...
19+community = Topluluk...
20+server_name = Sunucu adı...
21+announcement = Duyuru...
22+max_message_length = En fazla mesaj uzunluğu...
23+minutes = Dakika...
24+reason = Sebep...
25+uses = Kullanım...
26+hours = Saat
27+new_username = Yeni kullanıcı adı...
28+someone = Biri
29+unknown = bilinmiyor
30+typing_one = {name} yazıyor…
31+typing_many = {count} kişi yazıyor…
32+new_messages = {count} yeni mesaj
33+people = Kişiler
34+send = Gönder
35+ghost_title = Hayalet olarak konuş?
36+ghost_hint = Aramadaki herkes seni duyacak.
37+cancel = İptal
38+speak = Konuş
39+call = Ara
40+hang_up = Aramayı kapat
41+join = Katıl
42+leave = Ayrıl
43+calling = Aranıyor…
44+accept = Kabul et
45+decline = Reddet
46+is_calling = {name} arıyor
47+strip = Şerit
48+grid = Izgara
49+hide = Gizle
50+stats = Bağlantı istatistikleri
51+stats_hide = Bağlantı istatistiklerini gizle
52+in_call = Aramada
53+online = Çevrimiçi
54+offline = Çevrimdışı
55+new = Yeni
56+edited = (düzenlendi)
57+calls = {count} arama
58+call_started_mine = Bir arama başlattın
59+call_started = {name} bir arama başlattı
60+call_declined_mine = Aramayı reddettin
61+call_declined = {name} aramayı reddetti
62+call_missed_mine = Aradın, cevap yok
63+call_missed = Cevapsız arama: {name}
64+call_ended = Arama bitti · {duration}
crates/client/lang/tr/common.txtadded+20 -0
@@ -0,0 +1,20 @@
1+language = Türkçe
2+role_user = Kullanıcı
3+role_builder = Kurucu
4+presence_online = Çevrimiçi
5+presence_busy = Meşgul
6+presence_offline = Çevrimdışı
7+rank_member = Üye
8+rank_moderator = Moderatör
9+rank_admin = Yönetici
10+rank_owner = Sahip
11+rank_builder = Kurucu
12+report_open = Açık
13+report_resolved = Çözüldü
14+report_dismissed = Reddedildi
15+months = Oca Şub Mar Nis May Haz Tem Ağu Eyl Eki Kas Ara
16+stamp = %-d %b, %H:%M
17+year_stamp = %-d %b %Y, %H:%M
18+day = %-d %b
19+day_year = %-d %b %Y
20+date = %-d %b %Y
crates/client/lang/tr/community_settings.txtadded+31 -0
@@ -0,0 +1,31 @@
1+profile = Profil
2+general = Genel
3+name = İsim
4+voice = Ses
5+bans = Yasaklar
6+logs = Kayıtlar
7+moderation = Moderasyon
8+leave_community = Topluluktan ayrıl
9+delete_community = Topluluğu sil
10+newest = En yeni
11+oldest = En eski
12+on = Açık
13+off = Kapalı
14+view = Görüntüle
15+leave = Ayrıl
16+unban = Yasağı kaldır
17+no_bans = Yasak yok
18+no_logs = Kayıt yok
19+someone = birisi
20+created = {actor} topluluğu oluşturdu
21+renamed = {actor} adı {name} olarak değiştirdi
22+avatar_changed = {actor} avatarı değiştirdi
23+avatar_removed = {actor} avatarı kaldırdı
24+invited = {actor} davet etti: {target}
25+joined_log = {actor} katıldı
26+left_log = {actor} ayrıldı
27+kicked = {actor} çıkardı: {target}
28+banned = {actor} yasakladı: {target}
29+unbanned = {actor} yasağı kaldırdı: {target}
30+rank_changed = {actor} rütbe değiştirdi: {target} ({rank})
31+message_deleted = {actor} bir mesaj sildi ({target})
crates/client/lang/tr/composer.txtadded+18 -0
@@ -0,0 +1,18 @@
1+selected = {count} seçili
2+forward = İlet
3+replying_to = Yanıt:
4+unknown_author = bilinmeyen
5+slow_down = Yavaşla, {seconds} sn sonra tekrar gönderebilirsin
6+editing = Düzenleniyor
7+cancel = İptal
8+no_community = Topluluk seçilmedi
9+option = Seçenek
10+remove_option = Seçeneği kaldır
11+file = Dosya
12+poll = Anket
13+hour = 1 sa
14+day = 1 gün
15+week = 1 hafta
16+multiple_answers = Birden fazla cevap
17+show_voters = Oy verenleri göster
18+create = Oluştur
crates/client/lang/tr/fail.txtadded+6 -0
@@ -0,0 +1,6 @@
1+unreachable = Sunucuya ulaşılamıyor
2+tls = Sertifika hatası
3+outdated = İstemci sürümü eski
4+reset = Bağlantı koptu
5+offline = Çevrimdışı
6+protocol = Protokol hatası
crates/client/lang/tr/forward.txtadded+3 -0
@@ -0,0 +1,3 @@
1+filter = Filtrele
2+keep_authors = Yazarları koru
3+forward = İlet
crates/client/lang/tr/gui.txtadded+8 -0
@@ -0,0 +1,8 @@
1+notes = Notlar
2+connecting = Bağlanıyor…
3+reconnecting = Yeniden bağlanılıyor… {error} ({attempts})
4+not_connected = Bağlı değil
5+banned = Yasaklandın: {community}
6+banned_reason = Yasaklandın: {community} ({reason})
7+kicked = Atıldın: {community}
8+kicked_reason = Atıldın: {community} ({reason})
crates/client/lang/tr/jump.txtadded+19 -0
@@ -0,0 +1,19 @@
1+placeholder = Nereye?
2+esc = esc
3+hint_settings = ayarlar
4+hint_theme = tema
5+notes = Notlar
6+friends = Arkadaşlar
7+mute = Sessize al
8+unmute = Sesi aç
9+deafen = Sağırlaştır
10+undeafen = Sağırlaştırmayı kaldır
11+stop_sharing = Paylaşımı durdur
12+share_screen = Ekranı paylaş
13+camera_on = Kamerayı aç
14+camera_off = Kamerayı kapat
15+leave_call = Görüşmeden ayrıl
16+new_community = Yeni topluluk
17+expand_sidebar = Kenar çubuğunu genişlet
18+collapse_sidebar = Kenar çubuğunu daralt
19+log_out = Çıkış yap
crates/client/lang/tr/media_mod.txtadded+1 -0
@@ -0,0 +1 @@
1+no_track = oynatılabilir video veya ses parçası yok
crates/client/lang/tr/media_view.txtadded+4 -0
@@ -0,0 +1,4 @@
1+save = Kaydet
2+play = Oynat
3+pause = Duraklat
4+remove = Kaldır
crates/client/lang/tr/message_actions.txtadded+11 -0
@@ -0,0 +1,11 @@
1+attachments = {count} ek
2+reply = Yanıtla
3+edit = Düzenle
4+forward = İlet
5+select = Seç
6+pin = Sabitle
7+unpin = Sabitlemeyi kaldır
8+report = Bildir
9+confirm = Onayla
10+delete = Sil
11+send = Gönder
crates/client/lang/tr/poll.txtadded+12 -0
@@ -0,0 +1,12 @@
1+days_left = {count}g
2+hours_left = {count}sa
3+minutes_left = {count}dk
4+end_poll = Anketi bitir
5+voters_visible = Oylar görünür
6+anonymous = Anonim
7+multiple_choice = Çoklu seçim
8+closed = Kapalı
9+votes = {count} oy
10+previous = Önceki
11+next = Sonraki
12+jump_to_message = Mesaja git
crates/client/lang/tr/profile.txtadded+18 -0
@@ -0,0 +1,18 @@
1+message = Mesaj
2+call = Ara
3+report = Bildir
4+more = Daha fazla
5+kick = Çıkar
6+ban = Yasakla
7+make_rank = {rank} yap
8+delete_user = Kullanıcıyı sil
9+confirm = Onayla
10+a_call = bir arama
11+in_room = {room} içinde
12+edit_status = Durumu düzenle
13+mute = Sustur
14+accounts = Hesaplar
15+settings = Ayarlar
16+log_out = Çıkış yap
17+add_account = Hesap ekle
18+reason_optional = Sebep (isteğe bağlı)
crates/client/lang/tr/session.txtadded+1 -0
@@ -0,0 +1 @@
1+codec_unavailable = codec kullanılamıyor
crates/client/lang/tr/settings.txtadded+3 -0
@@ -0,0 +1,3 @@
1+small = Küçük
2+medium = Orta
3+large = Büyük
crates/client/lang/tr/settings_page.txtadded+30 -0
@@ -0,0 +1,30 @@
1+profile = Profil
2+voice = Ses
3+camera_share = Kamera ve paylaşım
4+appearance = Görünüm
5+title = Ayarlar
6+back = Geri
7+identity = Kimlik
8+name = Ad
9+status = Durum
10+presence = Görünürlük
11+account = Hesap
12+log_out = Çıkış yap
13+delete_account = Hesabı sil
14+danger_zone = Tehlikeli bölge
15+delete = Sil
16+confirm = Onayla
17+save = Kaydet
18+remove = Kaldır
19+change_picture = Resmi değiştir
20+theme = Tema
21+font_size = Yazı boyutu
22+language = Dil
23+close_to_tray = Tepsiye küçült
24+your_hue = Rengin
25+camera = Kamera
26+screen_share = Ekran paylaşımı
27+quality = Kalite
28+frame_rate = Kare hızı
29+codec = Kodek
30+share_audio = Sesi paylaş
crates/client/lang/tr/share_view.txtadded+21 -0
@@ -0,0 +1,21 @@
1+share = Paylaş
2+off = Kapalı
3+all = Tümü
4+pick = Seç
5+no_camera = Kamera yok
6+resolution = Çözünürlük
7+codec = Kodek
8+sound_from = Ses kaynağı
9+apps = Uygulamalar
10+outputs = Çıkışlar
11+inputs = Girişler
12+esc_exit = Tam ekrandan çıkmak için Esc
13+stream_stats = Yayın istatistikleri
14+unmute = Sesi aç
15+mute = Sessize al
16+close = Kapat
17+exit_fullscreen = Tam ekrandan çık
18+fullscreen = Tam ekran
19+screen_settings = Ekran ayarları
20+camera_settings = Kamera ayarları
21+auto = Otomatik
crates/client/lang/tr/sidebar.txtadded+26 -0
@@ -0,0 +1,26 @@
1+in_call = Görüşmede
2+go_to_call = Görüşmeye git
3+new_community = Yeni topluluk
4+create = Oluştur
5+name_placeholder = Ad...
6+expand = Genişlet
7+collapse = Daralt
8+notes = Notlar
9+remove_friend = Arkadaşlıktan çıkar
10+requests = İstekler
11+message = Mesaj
12+accept = Kabul et
13+decline = Reddet
14+cancel = İptal
15+from_user = gönderen: {name}
16+ghost_on = Hayalet açık
17+stop_watching = İzlemeyi bırak
18+watch_camera = Kamerayı izle
19+watch_screen = Ekranı izle
20+invite = Davet et
21+settings = Ayarlar
22+pin = Sabitle
23+unpin = Sabitlemeyi kaldır
24+mute = Sessize al
25+unmute = Sesi aç
26+leave = Ayrıl
crates/client/lang/tr/snippet.txtadded+2 -0
@@ -0,0 +1,2 @@
1+forwarded = İletildi
2+forwarded_from = İletildi · {origin}
crates/client/lang/tr/social.txtadded+7 -0
@@ -0,0 +1,7 @@
1+remove_friend = Arkadaşlıktan çıkar
2+cancel_request = İsteği iptal et
3+accept_friend = Arkadaşlığı kabul et
4+add_friend = Arkadaş ekle
5+username_placeholder = Kullanıcı adı...
6+invite = Davet et
7+no_such_user = Böyle bir kullanıcı yok
crates/client/lang/tr/stream_stats.txtadded+4 -0
@@ -0,0 +1,4 @@
1+loss = kayıp %
2+latency = gecikme ms
3+buffer = tampon {count} ms
4+keyframes = anahtar kare {count}
crates/client/lang/tr/tray.txtadded+3 -0
@@ -0,0 +1,3 @@
1+tip = {name} · {messages} okunmamış · {mentions} bahsetme
2+show = Göster
3+quit = Çık
crates/client/lang/tr/unsupported.txtadded+1 -0
@@ -0,0 +1 @@
1+not_supported = Ekran paylaşımı bu işletim sisteminde desteklenmiyor
crates/client/lang/tr/voice_note.txtadded+4 -0
@@ -0,0 +1,4 @@
1+cancel = İptal
2+send = Gönder
3+voice_message = Sesli mesaj
4+leave_call_first = Önce sesli aramadan ayrıl
crates/client/lang/tr/voice_settings.txtadded+21 -0
@@ -0,0 +1,21 @@
1+default = Varsayılan
2+voice_activity = Ses algılama
3+push_to_talk = Bas konuş
4+voice = Ses
5+music = Müzik
6+input_device = Giriş aygıtı
7+output_device = Çıkış aygıtı
8+input_volume = Giriş sesi
9+output_volume = Çıkış sesi
10+mode = Mod
11+profile = Profil
12+test = Test
13+sensitivity = Hassasiyet
14+key = Tuş
15+stop = Durdur
16+hear_yourself = Kendini dinle
17+play_sound = Ses çal
18+press_key = Tuşa bas
19+set_key = Tuş ata
20+microphone = Mikrofon
21+speaker = Hoparlör
crates/client/lang/tr/voice_stats.txtadded+29 -0
@@ -0,0 +1,29 @@
1+good = iyi
2+fair = orta
3+poor = kötü
4+connection = Bağlantı
5+traffic = Trafik
6+this_machine = Bu makine
7+sending_screen = Ekran gönderiliyor
8+sending_camera = Kamera gönderiliyor
9+watching = İzleniyor
10+streams_one = {count} akış
11+streams_many = {count} akış
12+loss = kayıp %
13+buffer = tampon ms
14+up = yükleme
15+down = indirme
16+rate = hız
17+memory = bellek
18+storage = depolama
19+thread_gui = arayüz
20+thread_camera = kamera
21+thread_encode = kodlama
22+thread_decode = kod çözme
23+camera = kamera
24+screen = ekran
25+hardware = donanım
26+software = yazılım
27+latency = gecikme {ms}
28+loss_now = kayıp {percent} %
29+keyframes = anahtar kare {count}
crates/client/src/gui.rsmodified+48 -35
@@ -1,4 +1,5 @@
1 use crate::gui::glyph::Fill as _;1 use crate::gui::glyph::Fill as _;
2+use crate::lang::{Label as _, w};
2 use common::model::{Hue, Id};3 use common::model::{Hue, Id};
3 use std::{collections::HashMap, fmt::Display, rc::Rc, sync::Arc, time::Instant};4 use std::{collections::HashMap, fmt::Display, rc::Rc, sync::Arc, time::Instant};
4 5
@@ -17,9 +18,10 @@ use gpui_kit::{
17 Entity, FontWeight, Hsla, Image, ImageFormat, InteractiveElement, IntoElement, KeyBinding,18 Entity, FontWeight, Hsla, Image, ImageFormat, InteractiveElement, IntoElement, KeyBinding,
18 KeyDownEvent, KeyUpEvent, ModifiersChangedEvent, ParentElement, Pixels, Rems, Render,19 KeyDownEvent, KeyUpEvent, ModifiersChangedEvent, ParentElement, Pixels, Rems, Render,
19 RenderOnce, Stateful, StatefulInteractiveElement, Styled, WeakEntity, Window, actions,20 RenderOnce, Stateful, StatefulInteractiveElement, Styled, WeakEntity, Window, actions,
21+ assets::IconName,
20 base::Selectable,22 base::Selectable,
21 component::{23 component::{
22- Sizable, Theme, ThemeRegistry, WindowExt,24+ Icon, Sizable, Theme, ThemeRegistry, WindowExt,
23 input::{Input, InputEvent, InputState},25 input::{Input, InputEvent, InputState},
24 notification::Notification,26 notification::Notification,
25 spinner::Spinner,27 spinner::Spinner,
@@ -61,6 +63,7 @@ mod social;
61 mod stream_stats;63 mod stream_stats;
62 pub mod style;64 pub mod style;
63 mod surface;65 mod surface;
66+mod tow;
64 mod voice_note;67 mod voice_note;
65 mod voice_settings;68 mod voice_settings;
66 mod voice_stats;69 mod voice_stats;
@@ -318,7 +321,7 @@ pub fn community_name(community: &Community) -> &str {
318 CommunityKind::Group => &community.name,321 CommunityKind::Group => &community.name,
319 CommunityKind::Direct { peer } if community.name.is_empty() => &peer.username,322 CommunityKind::Direct { peer } if community.name.is_empty() => &peer.username,
320 CommunityKind::Direct { .. } => &community.name,323 CommunityKind::Direct { .. } => &community.name,
321- CommunityKind::Notes => "Notes",324+ CommunityKind::Notes => w().gui.notes,
322 }325 }
323 }326 }
324 327
@@ -343,7 +346,7 @@ pub fn community_icon(
343 },346 },
344 CommunityKind::Direct { peer } => avatar(palette, peer, size, font, avatars),347 CommunityKind::Direct { peer } => avatar(palette, peer, size, font, avatars),
345 CommunityKind::Notes => {348 CommunityKind::Notes => {
346- badge(palette, community.id, "Notes", size, font).rounded(px(radius::SM))349+ badge(palette, community.id, w().gui.notes, size, font).rounded(px(radius::SM))
347 }350 }
348 }351 }
349 }352 }
@@ -352,12 +355,7 @@ pub const KB: f64 = 1024.0;
352 pub const MB: f64 = KB * 1024.0;355 pub const MB: f64 = KB * 1024.0;
353 const GB: f64 = MB * 1024.0;356 const GB: f64 = MB * 1024.0;
354 357
355-pub const STAMP: &str = "%b %-d, %H:%M";
356-pub const YEAR_STAMP: &str = "%b %-d %Y, %H:%M";
357 pub const CLOCK: &str = "%H:%M";358 pub const CLOCK: &str = "%H:%M";
358-pub const DAY: &str = "%b %-d";
359-pub const DAY_YEAR: &str = "%b %-d, %Y";
360-pub const DATE: &str = "%b %-d %Y";
361 359
362 pub fn storage(bytes: u64) -> String {360 pub fn storage(bytes: u64) -> String {
363 let bytes = bytes as f64;361 let bytes = bytes as f64;
@@ -375,12 +373,22 @@ pub fn millis_time(millis: u64, format: &str) -> String {
375 return String::new();373 return String::new();
376 };374 };
377 375
378- timestamp376+ let zoned = timestamp.to_zoned_datetime(TimeZone::system());
379- .to_zoned_datetime(TimeZone::system())377+ zoned
380- .strftime(format)378+ .strftime(&month_named(format, zoned.month()))
381 .to_string()379 .to_string()
382 }380 }
383 381
382+pub fn month_named(format: &str, month: i8) -> String {
383+ let name = crate::lang::w()
384+ .common
385+ .months
386+ .split(' ')
387+ .nth(month as usize - 1)
388+ .unwrap_or_default();
389+ format.replace("%b", name)
390+}
391+
384 pub use parts::motion;392 pub use parts::motion;
385 393
386 pub fn hoverable(id: impl Into<ElementId>, element: Div, palette: Palette) -> Stateful<Div> {394 pub fn hoverable(id: impl Into<ElementId>, element: Div, palette: Palette) -> Stateful<Div> {
@@ -481,19 +489,18 @@ impl RenderOnce for Trigger {
481 }489 }
482 490
483 pub fn rank_tag(rank: Option<Rank>, palette: Palette) -> Option<Div> {491 pub fn rank_tag(rank: Option<Rank>, palette: Palette) -> Option<Div> {
484- let rank = rank?;492+ let tag = div()
485- let color = match rank {493+ .flex_shrink_0()
486- Rank::Member => return None,494+ .text_size(text(style::text::CAPTION))
487- Rank::Builder => palette.text,495+ .text_color(palette.muted);
488- _ => palette.muted,496+ match rank? {
489- };497+ Rank::Member => None,
490-498+ Rank::Builder => Some(
491- Some(499+ tag.text_color(palette.accent)
492- div()500+ .child(Icon::new(IconName::Shield).size(px(size::ICON_SM))),
493- .text_size(text(style::text::CAPTION))501+ ),
494- .text_color(color)502+ rank => Some(tag.child(rank.label())),
495- .child(rank.label()),503+ }
496- )
497 }504 }
498 505
499 pub fn presence_color(presence: Presence, palette: Palette) -> Hsla {506 pub fn presence_color(presence: Presence, palette: Palette) -> Hsla {
@@ -570,10 +577,10 @@ impl Connection {
570 577
571 fn connection_notice(connection: &Connection, palette: Palette) -> Option<Div> {578 fn connection_notice(connection: &Connection, palette: Palette) -> Option<Div> {
572 let (label, color) = match connection {579 let (label, color) = match connection {
573- Connection::Connecting => ("Connecting…".to_string(), palette.muted),580+ Connection::Connecting => (w().gui.connecting.to_string(), palette.muted),
574 Connection::Connected => return None,581 Connection::Connected => return None,
575 Connection::Lost { error, attempts } => {582 Connection::Lost { error, attempts } => {
576- (format!("Reconnecting… {error} ({attempts})"), palette.alert)583+ (w().gui.reconnecting(attempts, error), palette.alert)
577 }584 }
578 };585 };
579 Some(586 Some(
@@ -660,6 +667,7 @@ impl Yumush {
660 })667 })
661 .detach();668 .detach();
662 669
670+ sidebar::wander(cx);
663 let voice = VoiceControls::new(&settings.voice, window, cx);671 let voice = VoiceControls::new(&settings.voice, window, cx);
664 672
665 let server = network.server();673 let server = network.server();
@@ -765,7 +773,7 @@ impl Yumush {
765 return;773 return;
766 };774 };
767 if !self.connection.is_connected() {775 if !self.connection.is_connected() {
768- window.push_notification(Notification::error("Not connected"), cx);776+ window.push_notification(Notification::error(w().gui.not_connected), cx);
769 return;777 return;
770 }778 }
771 if self.user.is_some() {779 if self.user.is_some() {
@@ -1205,13 +1213,15 @@ impl Yumush {
1205 } => {1213 } => {
1206 self.leave_voice_in(community_id, cx);1214 self.leave_voice_in(community_id, cx);
1207 self.chat.remove_community(community_id);1215 self.chat.remove_community(community_id);
1208- let action = match sanction {1216+ let text = match (sanction, reason) {
1209- Sanction::Ban => "Banned from",1217+ (Sanction::Ban, Some(reason)) => {
1210- Sanction::Kick => "Kicked from",1218+ w().gui.banned_reason(community_name, reason)
1211- };1219+ }
1212- let text = match reason {1220+ (Sanction::Ban, None) => w().gui.banned(community_name),
1213- Some(reason) => format!("{action} {community_name}: {reason}"),1221+ (Sanction::Kick, Some(reason)) => {
1214- None => format!("{action} {community_name}"),1222+ w().gui.kicked_reason(community_name, reason)
1223+ }
1224+ (Sanction::Kick, None) => w().gui.kicked(community_name),
1215 };1225 };
1216 window.push_notification(Notification::warning(text), cx);1226 window.push_notification(Notification::warning(text), cx);
1217 }1227 }
@@ -1405,6 +1415,9 @@ impl Render for Yumush {
1405 self.fullscreen = fullscreen;1415 self.fullscreen = fullscreen;
1406 window.toggle_fullscreen();1416 window.toggle_fullscreen();
1407 }1417 }
1418+ if window.focused(cx).is_none() {
1419+ window.focus(&self.focus, cx);
1420+ }
1408 self.hide_idle_cursor(window, cx);1421 self.hide_idle_cursor(window, cx);
1409 self.schedule_pump(window, cx);1422 self.schedule_pump(window, cx);
1410 let palette = palette(cx);1423 let palette = palette(cx);
@@ -1432,7 +1445,7 @@ impl Render for Yumush {
1432 this.zoom = None;1445 this.zoom = None;
1433 cx.notify();1446 cx.notify();
1434 } else if this.chat.friends_open {1447 } else if this.chat.friends_open {
1435- this.close_friends(cx);1448+ this.close_friends(window, cx);
1436 } else if this.chat.goto.open {1449 } else if this.chat.goto.open {
1437 this.close_jump(window, cx);1450 this.close_jump(window, cx);
1438 } else if this.fullscreen {1451 } else if this.fullscreen {
crates/client/src/gui/auth.rsmodified+18 -11
@@ -18,6 +18,7 @@ use super::{
18 text,18 text,
19 widget::{field, frame},19 widget::{field, frame},
20 };20 };
21+use crate::lang::w;
21 22
22 pub struct Auth {23 pub struct Auth {
23 server_input: Entity<InputState>,24 server_input: Entity<InputState>,
@@ -30,7 +31,7 @@ pub struct Auth {
30 31
31 impl Auth {32 impl Auth {
32 pub fn new(server: &crate::Server, window: &mut Window, cx: &mut Context<Yumush>) -> Self {33 pub fn new(server: &crate::Server, window: &mut Window, cx: &mut Context<Yumush>) -> Self {
33- let server_input = new_input("Server", window, cx);34+ let server_input = new_input(w().auth.server, window, cx);
34 server_input.update(cx, |input, cx| input.set_value(&server.address, window, cx));35 server_input.update(cx, |input, cx| input.set_value(&server.address, window, cx));
35 cx.subscribe_in(&server_input, window, |this, _, event, _, cx| {36 cx.subscribe_in(&server_input, window, |this, _, event, _, cx| {
36 if matches!(event, InputEvent::PressEnter { .. }) {37 if matches!(event, InputEvent::PressEnter { .. }) {
@@ -38,9 +39,9 @@ impl Auth {
38 }39 }
39 })40 })
40 .detach();41 .detach();
41- let username_input = new_input("Username...", window, cx);42+ let username_input = new_input(w().auth.username_placeholder, window, cx);
42- let password_input = new_input("Password...", window, cx);43+ let password_input = new_input(w().auth.password_placeholder, window, cx);
43- let invite_input = new_input("Invite code...", window, cx);44+ let invite_input = new_input(w().auth.invite_placeholder, window, cx);
44 password_input.update(cx, |input, cx| input.set_masked(true, window, cx));45 password_input.update(cx, |input, cx| input.set_masked(true, window, cx));
45 username_input.update(cx, |input, cx| input.focus(window, cx));46 username_input.update(cx, |input, cx| input.focus(window, cx));
46 47
@@ -162,8 +163,8 @@ impl Yumush {
162 pub(super) fn auth_page(&self, route: Route, cx: &mut Context<Self>) -> impl IntoElement {163 pub(super) fn auth_page(&self, route: Route, cx: &mut Context<Self>) -> impl IntoElement {
163 let palette = palette(cx);164 let palette = palette(cx);
164 let action_label = match route {165 let action_label = match route {
165- Route::Register => "Register",166+ Route::Register => w().auth.register,
166- Route::Login | Route::Chat => "Log in",167+ Route::Login | Route::Chat => w().auth.log_in,
167 };168 };
168 169
169 let entity = cx.entity();170 let entity = cx.entity();
@@ -185,8 +186,14 @@ impl Yumush {
185 let title = server.map_or_else(|| "yumush".to_string(), |settings| settings.name.clone());186 let title = server.map_or_else(|| "yumush".to_string(), |settings| settings.name.clone());
186 187
187 let tabs = segment_track(palette)188 let tabs = segment_track(palette)
188- .child(tab(palette, &entity, Route::Login, "Log in", route))189+ .child(tab(palette, &entity, Route::Login, w().auth.log_in, route))
189- .child(tab(palette, &entity, Route::Register, "Register", route));190+ .child(tab(
191+ palette,
192+ &entity,
193+ Route::Register,
194+ w().auth.register,
195+ route,
196+ ));
190 let invite = (route == Route::Register && !registration_open)197 let invite = (route == Route::Register && !registration_open)
191 .then(|| field(palette, &self.auth.invite_input));198 .then(|| field(palette, &self.auth.invite_input));
192 199
@@ -213,7 +220,7 @@ impl Yumush {
213 div()220 div()
214 .text_size(text(text::CAPTION))221 .text_size(text(text::CAPTION))
215 .text_color(palette.muted)222 .text_color(palette.muted)
216- .child("Maintenance")223+ .child(w().auth.maintenance)
217 }))224 }))
218 .children(self.saved_accounts(&entity, palette))225 .children(self.saved_accounts(&entity, palette))
219 .child(tabs)226 .child(tabs)
@@ -242,7 +249,7 @@ impl Yumush {
242 .justify_between()249 .justify_between()
243 .text_size(text(text::CAPTION))250 .text_size(text(text::CAPTION))
244 .text_color(palette.muted)251 .text_color(palette.muted)
245- .child("Accept any certificate")252+ .child(w().auth.accept_any_cert)
246 .child(super::parts::toggle(253 .child(super::parts::toggle(
247 "any_cert_switch",254 "any_cert_switch",
248 self.auth.any_cert,255 self.auth.any_cert,
@@ -308,7 +315,7 @@ impl Yumush {
308 });315 });
309 },316 },
310 )317 )
311- .tip("Forget")318+ .tip(w().auth.forget)
312 .size(px(size::CHIP))319 .size(px(size::CHIP))
313 .flex()320 .flex()
314 .items_center()321 .items_center()
crates/client/src/gui/builder.rsmodified+32 -15
@@ -11,6 +11,7 @@ mod ui;
11 mod users;11 mod users;
12 mod voice;12 mod voice;
13 13
14+use crate::lang::{Label as _, w};
14 use common::model::Id;15 use common::model::Id;
15 use std::{fmt::Display, future::Future, path::PathBuf};16 use std::{fmt::Display, future::Future, path::PathBuf};
16 17
@@ -69,18 +70,34 @@ impl BuilderTab {
69 Self::Log,70 Self::Log,
70 ];71 ];
71 72
73+ pub(super) fn id(self) -> &'static str {
74+ match self {
75+ Self::Overview => "overview",
76+ Self::Users => "users",
77+ Self::Communities => "communities",
78+ Self::Messages => "messages",
79+ Self::Voice => "voice",
80+ Self::Storage => "storage",
81+ Self::Access => "access",
82+ Self::Reports => "reports",
83+ Self::Server => "server",
84+ Self::Log => "log",
85+ }
86+ }
87+
72 pub(super) fn label(self) -> &'static str {88 pub(super) fn label(self) -> &'static str {
89+ let w = &w().builder;
73 match self {90 match self {
74- Self::Overview => "Overview",91+ Self::Overview => w.overview,
75- Self::Users => "Users",92+ Self::Users => w.users,
76- Self::Communities => "Communities",93+ Self::Communities => w.communities,
77- Self::Messages => "Messages",94+ Self::Messages => w.messages,
78- Self::Voice => "Voice",95+ Self::Voice => w.voice,
79- Self::Storage => "Storage",96+ Self::Storage => w.storage,
80- Self::Access => "Access",97+ Self::Access => w.access,
81- Self::Reports => "Reports",98+ Self::Reports => w.reports,
82- Self::Server => "Server",99+ Self::Server => w.server,
83- Self::Log => "Log",100+ Self::Log => w.log,
84 }101 }
85 }102 }
86 }103 }
@@ -169,7 +186,7 @@ impl Yumush {
169 BuilderTab::Voice => vec![186 BuilderTab::Voice => vec![
170 plain_button(187 plain_button(
171 "refresh_voice_button".to_string(),188 "refresh_voice_button".to_string(),
172- "Refresh",189+ w().builder.refresh,
173 palette,190 palette,
174 entity_action(entity, |yumush, window, cx| {191 entity_action(entity, |yumush, window, cx| {
175 yumush.load_voice_rooms(window, cx)192 yumush.load_voice_rooms(window, cx)
@@ -180,7 +197,7 @@ impl Yumush {
180 BuilderTab::Server if self.server_form(cx) != self.server => vec![197 BuilderTab::Server if self.server_form(cx) != self.server => vec![
181 accent_button(198 accent_button(
182 "save_server",199 "save_server",
183- "Save",200+ w().builder.save,
184 palette,201 palette,
185 entity_action(entity, |yumush, window, cx| {202 entity_action(entity, |yumush, window, cx| {
186 yumush.save_server_settings(window, cx)203 yumush.save_server_settings(window, cx)
@@ -192,7 +209,7 @@ impl Yumush {
192 icon_button(209 icon_button(
193 "export_builder_log".to_string(),210 "export_builder_log".to_string(),
194 IconName::Download,211 IconName::Download,
195- "Export",212+ w().builder.export,
196 palette.muted,213 palette.muted,
197 palette,214 palette,
198 entity_action(entity, |yumush, window, cx| {215 entity_action(entity, |yumush, window, cx| {
@@ -233,7 +250,7 @@ impl Yumush {
233 .filter(|count| *count > 0);250 .filter(|count| *count > 0);
234 251
235 clickable(252 clickable(
236- format!("builder_tab_{label}"),253+ format!("builder_tab_{}", tab.id()),
237 palette,254 palette,
238 entity_action(entity, move |yumush, window, cx| {255 entity_action(entity, move |yumush, window, cx| {
239 yumush.select_builder_tab(tab, window, cx)256 yumush.select_builder_tab(tab, window, cx)
@@ -268,7 +285,7 @@ impl Yumush {
268 .justify_between()285 .justify_between()
269 .text_size(text(text::LABEL))286 .text_size(text(text::LABEL))
270 .text_color(palette.muted)287 .text_color(palette.muted)
271- .child("Ghost")288+ .child(w().builder.ghost)
272 .child(super::parts::toggle(289 .child(super::parts::toggle(
273 "ghost_switch",290 "ghost_switch",
274 enabled,291 enabled,
crates/client/src/gui/builder/access.rsmodified+31 -17
@@ -12,9 +12,9 @@ use super::ui::{
12 accent_button, card, card_header, confirmed, delete_icon_button, fixed, icon_button, pill,12 accent_button, card, card_header, confirmed, delete_icon_button, fixed, icon_button, pill,
13 toolbar,13 toolbar,
14 };14 };
15-use crate::gui::STAMP;
16 use crate::gui::style::{size, space, text};15 use crate::gui::style::{size, space, text};
17 use crate::gui::{Palette, Yumush, entity_action, millis_time, notify_error, text, widget::field};16 use crate::gui::{Palette, Yumush, entity_action, millis_time, notify_error, text, widget::field};
17+use crate::lang::w;
18 18
19 fn list_card(header: Div, rows: Vec<Div>, empty: &str, palette: Palette) -> Div {19 fn list_card(header: Div, rows: Vec<Div>, empty: &str, palette: Palette) -> Div {
20 let body = if rows.is_empty() {20 let body = if rows.is_empty() {
@@ -48,9 +48,16 @@ fn invite_row(
48 let copy_code = invite.code.clone();48 let copy_code = invite.code.clone();
49 let delete_code = invite.code.clone();49 let delete_code = invite.code.clone();
50 let expiry = invite.expires_at.map_or_else(50 let expiry = invite.expires_at.map_or_else(
51- || "never".to_string(),51+ || w().builder_access.never.to_string(),
52- |at| format!("expires {}", millis_time(at, STAMP)),52+ |at| {
53+ w().builder_access
54+ .expires(millis_time(at, crate::lang::w().common.stamp))
55+ },
53 );56 );
57+ let left = match invite.uses_left {
58+ 1 => w().builder_access.one_use_left.to_string(),
59+ uses => w().builder_access.uses_left(uses),
60+ };
54 61
55 div()62 div()
56 .min_h(px(size::ROW))63 .min_h(px(size::ROW))
@@ -76,17 +83,13 @@ fn invite_row(
76 .text_size(text(text::CAPTION))83 .text_size(text(text::CAPTION))
77 .text_color(palette.muted)84 .text_color(palette.muted)
78 .truncate()85 .truncate()
79- .child(format!(86+ .child(format!("{left} · {expiry}")),
80- "{} {} left · {expiry}",
81- invite.uses_left,
82- if invite.uses_left == 1 { "use" } else { "uses" }
83- )),
84 ),87 ),
85 )88 )
86 .child(icon_button(89 .child(icon_button(
87 format!("copy_invite_{}", invite.code),90 format!("copy_invite_{}", invite.code),
88 IconName::Copy,91 IconName::Copy,
89- "Copy",92+ w().builder_access.copy,
90 palette.muted,93 palette.muted,
91 palette,94 palette,
92 entity_action(entity, move |yumush, _, cx| {95 entity_action(entity, move |yumush, _, cx| {
@@ -107,7 +110,7 @@ fn ban_row(ban: &ServerBan, entity: &Entity<Yumush>, palette: Palette) -> Div {
107 let remove_id = ban.id;110 let remove_id = ban.id;
108 let kind = match ban.kind {111 let kind = match ban.kind {
109 ServerBanKind::Ip => "IP",112 ServerBanKind::Ip => "IP",
110- ServerBanKind::Username => "Username",113+ ServerBanKind::Username => w().builder_access.username,
111 };114 };
112 115
113 div()116 div()
@@ -144,7 +147,7 @@ fn ban_row(ban: &ServerBan, entity: &Entity<Yumush>, palette: Palette) -> Div {
144 .child(icon_button(147 .child(icon_button(
145 format!("remove_ban_{}", ban.id),148 format!("remove_ban_{}", ban.id),
146 IconName::X,149 IconName::X,
147- "Remove",150+ w().builder_access.remove,
148 palette.muted,151 palette.muted,
149 palette,152 palette,
150 entity_action(entity, move |yumush, window, cx| {153 entity_action(entity, move |yumush, window, cx| {
@@ -260,7 +263,7 @@ impl Yumush {
260 fixed(size::THUMB, field(palette, &self.chat.invite_hours)),263 fixed(size::THUMB, field(palette, &self.chat.invite_hours)),
261 accent_button(264 accent_button(
262 "create_invite",265 "create_invite",
263- "Create",266+ w().builder_access.create,
264 palette,267 palette,
265 entity_action(entity, |yumush, window, cx| {268 entity_action(entity, |yumush, window, cx| {
266 yumush.create_invite(window, cx)269 yumush.create_invite(window, cx)
@@ -269,7 +272,7 @@ impl Yumush {
269 .into_any_element(),272 .into_any_element(),
270 ])273 ])
271 .into_any_element();274 .into_any_element();
272- let invite_header = card_header("Invite codes", vec![controls], palette);275+ let invite_header = card_header(w().builder_access.invite_codes, vec![controls], palette);
273 let invites = self.chat.builder_invites.iter().map(|invite| {276 let invites = self.chat.builder_invites.iter().map(|invite| {
274 let pending = self.chat.pending_invite_delete.as_deref() == Some(invite.code.as_str());277 let pending = self.chat.pending_invite_delete.as_deref() == Some(invite.code.as_str());
275 invite_row(invite, pending, entity, palette)278 invite_row(invite, pending, entity, palette)
@@ -279,12 +282,23 @@ impl Yumush {
279 .builder_bans282 .builder_bans
280 .iter()283 .iter()
281 .map(|ban| ban_row(ban, entity, palette));284 .map(|ban| ban_row(ban, entity, palette));
282- let ban_header = card_header("Bans", Vec::new(), palette);285+ let ban_header = card_header(w().builder_access.bans, Vec::new(), palette);
283 286
284 vec![287 vec![
285- list_card(invite_header, invites.collect(), "No invite codes", palette)288+ list_card(
286- .into_any_element(),289+ invite_header,
287- list_card(ban_header, bans.collect(), "No bans", palette).into_any_element(),290+ invites.collect(),
291+ w().builder_access.no_invite_codes,
292+ palette,
293+ )
294+ .into_any_element(),
295+ list_card(
296+ ban_header,
297+ bans.collect(),
298+ w().builder_access.no_bans,
299+ palette,
300+ )
301+ .into_any_element(),
288 ]302 ]
289 }303 }
290 }304 }
crates/client/src/gui/builder/backups.rsmodified+11 -6
@@ -12,10 +12,11 @@ use super::{
12 ui::{accent_button, card, card_header, confirmed, delete_icon_button, icon_button, list_row},12 ui::{accent_button, card, card_header, confirmed, delete_icon_button, icon_button, list_row},
13 };13 };
14 use crate::gui::{14 use crate::gui::{
15- DATE, Palette, Yumush, entity_action, millis_time, notify_error, storage,15+ Palette, Yumush, entity_action, millis_time, notify_error, storage,
16 style::{size, space, text},16 style::{size, space, text},
17 text,17 text,
18 };18 };
19+use crate::lang::w;
19 20
20 const STORAGE_WIDTH: f32 = 72.;21 const STORAGE_WIDTH: f32 = 72.;
21 22
@@ -24,7 +25,7 @@ fn backup_row(info: &BackupInfo, pending: bool, entity: &Entity<Yumush>, palette
24 let export = icon_button(25 let export = icon_button(
25 format!("export_backup_{}", info.name),26 format!("export_backup_{}", info.name),
26 IconName::Download,27 IconName::Download,
27- "Export",28+ w().builder_backups.export,
28 palette.muted,29 palette.muted,
29 palette,30 palette,
30 entity_action(entity, move |yumush, window, cx| {31 entity_action(entity, move |yumush, window, cx| {
@@ -63,7 +64,7 @@ fn backup_row(info: &BackupInfo, pending: bool, entity: &Entity<Yumush>, palette
63 .flex_shrink_0()64 .flex_shrink_0()
64 .text_size(text(text::CAPTION))65 .text_size(text(text::CAPTION))
65 .text_color(palette.muted)66 .text_color(palette.muted)
66- .child(millis_time(info.created_ms, DATE)),67+ .child(millis_time(info.created_ms, crate::lang::w().common.date)),
67 )68 )
68 .child(69 .child(
69 div()70 div()
@@ -83,7 +84,7 @@ impl Yumush {
83 pub(super) fn backups_card(&self, entity: &Entity<Self>, palette: Palette) -> Div {84 pub(super) fn backups_card(&self, entity: &Entity<Self>, palette: Palette) -> Div {
84 let create = accent_button(85 let create = accent_button(
85 "create_backup",86 "create_backup",
86- "Create",87+ w().builder_backups.create,
87 palette,88 palette,
88 entity_action(entity, |yumush, window, cx| {89 entity_action(entity, |yumush, window, cx| {
89 yumush.create_backup(window, cx)90 yumush.create_backup(window, cx)
@@ -105,7 +106,7 @@ impl Yumush {
105 .justify_center()106 .justify_center()
106 .text_size(text(text::CAPTION))107 .text_size(text(text::CAPTION))
107 .text_color(palette.muted)108 .text_color(palette.muted)
108- .child("No backups")109+ .child(w().builder_backups.no_backups)
109 } else {110 } else {
110 div()111 div()
111 .flex()112 .flex()
@@ -118,7 +119,11 @@ impl Yumush {
118 };119 };
119 120
120 card(palette)121 card(palette)
121- .child(card_header("Backups", vec![create], palette))122+ .child(card_header(
123+ w().builder_backups.backups,
124+ vec![create],
125+ palette,
126+ ))
122 .child(body)127 .child(body)
123 }128 }
124 129
crates/client/src/gui/builder/communities.rsmodified+23 -12
@@ -24,6 +24,7 @@ use crate::gui::{
24 text,24 text,
25 widget::search_text,25 widget::search_text,
26 };26 };
27+use crate::lang::w;
27 28
28 impl Yumush {29 impl Yumush {
29 pub(super) fn set_builder_community_voice(30 pub(super) fn set_builder_community_voice(
@@ -309,7 +310,7 @@ impl Yumush {
309 .child(Input::new(&self.chat.builder_search)),310 .child(Input::new(&self.chat.builder_search)),
310 ),311 ),
311 )312 )
312- .child(rows_body(rows, "No communities", palette))313+ .child(rows_body(rows, w().builder_communities.empty, palette))
313 .into_any_element(),314 .into_any_element(),
314 ]315 ]
315 }316 }
@@ -355,7 +356,11 @@ impl Yumush {
355 )356 )
356 .child(plain_button(357 .child(plain_button(
357 format!("transfer_to_{}", member.user.id),358 format!("transfer_to_{}", member.user.id),
358- if pending { "Confirm" } else { "Transfer" },359+ if pending {
360+ w().builder_communities.confirm
361+ } else {
362+ w().builder_communities.transfer
363+ },
359 palette,364 palette,
360 entity_action(entity, move |yumush, window, cx| {365 entity_action(entity, move |yumush, window, cx| {
361 yumush.transfer_to(user_id, window, cx)366 yumush.transfer_to(user_id, window, cx)
@@ -384,9 +389,12 @@ impl Yumush {
384 .as_ref()389 .as_ref()
385 .is_some_and(|transfer| transfer.community_id == id);390 .is_some_and(|transfer| transfer.community_id == id);
386 let owner = summary.owner.as_ref().map_or(String::new(), |owner| {391 let owner = summary.owner.as_ref().map_or(String::new(), |owner| {
387- format!(" · owner {}", owner.username)392+ format!(" · {}", w().builder_communities.owner(&owner.username))
388 });393 });
389- let meta = format!("{} members{owner}", summary.members);394+ let meta = format!(
395+ "{}{owner}",
396+ w().builder_communities.members(summary.members)
397+ );
390 398
391 let row = div()399 let row = div()
392 .min_h(px(size::ROW))400 .min_h(px(size::ROW))
@@ -424,11 +432,14 @@ impl Yumush {
424 .child(meta),432 .child(meta),
425 ),433 ),
426 )434 )
427- .children((!voice_enabled).then(|| pill("Voice off", palette.muted, palette)))435+ .children(
436+ (!voice_enabled)
437+ .then(|| pill(w().builder_communities.voice_off, palette.muted, palette)),
438+ )
428 .child(icon_button(439 .child(icon_button(
429 format!("open_community_{id}"),440 format!("open_community_{id}"),
430 IconName::ArrowUpRight,441 IconName::ArrowUpRight,
431- "Open",442+ w().builder_communities.open,
432 palette.muted,443 palette.muted,
433 palette,444 palette,
434 entity_action(entity, move |yumush, window, cx| {445 entity_action(entity, move |yumush, window, cx| {
@@ -438,7 +449,7 @@ impl Yumush {
438 .child(icon_button(449 .child(icon_button(
439 format!("log_community_{id}"),450 format!("log_community_{id}"),
440 IconName::ScrollText,451 IconName::ScrollText,
441- "Log",452+ w().builder_communities.log,
442 palette.muted,453 palette.muted,
443 palette,454 palette,
444 entity_action(entity, move |yumush, window, cx| {455 entity_action(entity, move |yumush, window, cx| {
@@ -453,9 +464,9 @@ impl Yumush {
453 IconName::PhoneOff464 IconName::PhoneOff
454 },465 },
455 if voice_enabled {466 if voice_enabled {
456- "Voice on"467+ w().builder_communities.voice_on
457 } else {468 } else {
458- "Voice off"469+ w().builder_communities.voice_off
459 },470 },
460 palette.muted,471 palette.muted,
461 palette,472 palette,
@@ -466,7 +477,7 @@ impl Yumush {
466 .child(icon_button(477 .child(icon_button(
467 format!("transfer_community_{id}"),478 format!("transfer_community_{id}"),
468 IconName::ArrowRightLeft,479 IconName::ArrowRightLeft,
469- "Transfer",480+ w().builder_communities.transfer,
470 if expanded {481 if expanded {
471 palette.text482 palette.text
472 } else {483 } else {
@@ -482,9 +493,9 @@ impl Yumush {
482 format!("delete_community_{id}_{pending_delete}"),493 format!("delete_community_{id}_{pending_delete}"),
483 IconName::Trash,494 IconName::Trash,
484 if pending_delete {495 if pending_delete {
485- "Confirm delete"496+ w().builder_communities.confirm_delete
486 } else {497 } else {
487- "Delete"498+ w().builder_communities.delete
488 },499 },
489 if pending_delete {500 if pending_delete {
490 palette.on_accent501 palette.on_accent
crates/client/src/gui/builder/log.rsmodified+41 -53
@@ -17,7 +17,6 @@ use super::{
17 save_directory,17 save_directory,
18 ui::{accent_button, card, end_of_day_ms, fixed, list_row, pill, start_of_day_ms, toolbar},18 ui::{accent_button, card, end_of_day_ms, fixed, list_row, pill, start_of_day_ms, toolbar},
19 };19 };
20-use crate::gui::STAMP;
21 use crate::gui::{20 use crate::gui::{
22 Palette, Yumush,21 Palette, Yumush,
23 community_settings::user_name,22 community_settings::user_name,
@@ -26,69 +25,58 @@ use crate::gui::{
26 text,25 text,
27 widget::{field, search_text},26 widget::{field, search_text},
28 };27 };
28+use crate::lang::{Label as _, w};
29 29
30 fn builder_log_text(entry: &AdminLogEntry) -> String {30 fn builder_log_text(entry: &AdminLogEntry) -> String {
31 let actor = user_name(&entry.actor);31 let actor = user_name(&entry.actor);
32 let target = user_name(&entry.target);32 let target = user_name(&entry.target);
33 let community = entry.community.as_deref().unwrap_or_default();33 let community = entry.community.as_deref().unwrap_or_default();
34+ let words = &w().builder_log;
34 35
35 match &entry.action {36 match &entry.action {
36- AdminAction::RoleChanged { role } => format!("{actor} set {target} to {}", role.as_str()),37+ AdminAction::RoleChanged { role } => words.role_changed(actor, role.label(), target),
37- AdminAction::UserDeleted => format!("{actor} deleted {target}"),38+ AdminAction::UserDeleted => words.user_deleted(actor, target),
38- AdminAction::UserSuspended => format!("{actor} suspended {target}"),39+ AdminAction::UserSuspended => words.user_suspended(actor, target),
39- AdminAction::UserUnsuspended => format!("{actor} unsuspended {target}"),40+ AdminAction::UserUnsuspended => words.user_unsuspended(actor, target),
40- AdminAction::SessionsRevoked => format!("{actor} revoked sessions of {target}"),41+ AdminAction::SessionsRevoked => words.sessions_revoked(actor, target),
41- AdminAction::PasswordReset => format!("{actor} reset password of {target}"),42+ AdminAction::PasswordReset => words.password_reset(actor, target),
42- AdminAction::ProfileCleared => format!("{actor} cleared profile of {target}"),43+ AdminAction::ProfileCleared => words.profile_cleared(actor, target),
43- AdminAction::UserCreated => format!("{actor} created {target}"),44+ AdminAction::UserCreated => words.user_created(actor, target),
44- AdminAction::CommunityDeleted => format!("{actor} deleted {community}"),45+ AdminAction::CommunityDeleted => words.community_deleted(actor, community),
45- AdminAction::OwnershipTransferred => {46+ AdminAction::OwnershipTransferred => words.ownership_transferred(actor, community, target),
46- format!("{actor} transferred {community} to {target}")47+ AdminAction::SettingsChanged => words.settings_changed(actor),
47- }48+ AdminAction::UserRenamed { from } => words.user_renamed(actor, from, target),
48- AdminAction::SettingsChanged => format!("{actor} changed settings"),49+ AdminAction::UserTimedOut { minutes: 0 } => words.user_timeout_cleared(actor, target),
49- AdminAction::UserRenamed { from } => format!("{actor} renamed {from} to {target}"),50+ AdminAction::UserTimedOut { minutes } => words.user_timed_out(actor, minutes, target),
50- AdminAction::UserTimedOut { minutes: 0 } => format!("{actor} cleared timeout of {target}"),51+ AdminAction::UserBanned { .. } => words.user_banned(actor, target),
51- AdminAction::UserTimedOut { minutes } => {52+ AdminAction::BanRemoved => words.ban_removed(actor),
52- format!("{actor} timed out {target} for {minutes} min")53+ AdminAction::InviteCreated => words.invite_created(actor),
53- }54+ AdminAction::InviteDeleted => words.invite_deleted(actor),
54- AdminAction::UserBanned { .. } => format!("{actor} banned {target}"),
55- AdminAction::BanRemoved => format!("{actor} removed a ban"),
56- AdminAction::InviteCreated => format!("{actor} created an invite code"),
57- AdminAction::InviteDeleted => format!("{actor} deleted an invite code"),
58 AdminAction::ReportHandled { status } => {55 AdminAction::ReportHandled { status } => {
59- format!("{actor} marked a report of {target} as {}", status.as_str())56+ words.report_handled(actor, status.label(), target)
60- }
61- AdminAction::MessageDeleted => {
62- format!("{actor} deleted a message of {target} in {community}")
63- }
64- AdminAction::UserPurged { messages } => {
65- format!("{actor} purged {target}, {messages} messages")
66 }57 }
67- AdminAction::VoiceKicked => format!("{actor} kicked {target} from voice"),58+ AdminAction::MessageDeleted => words.message_deleted(actor, community, target),
68- AdminAction::VoiceMuted { muted: true } => format!("{actor} muted {target} in voice"),59+ AdminAction::UserPurged { messages } => words.user_purged(actor, messages, target),
69- AdminAction::VoiceMuted { muted: false } => format!("{actor} unmuted {target} in voice"),60+ AdminAction::VoiceKicked => words.voice_kicked(actor, target),
61+ AdminAction::VoiceMuted { muted: true } => words.voice_muted(actor, target),
62+ AdminAction::VoiceMuted { muted: false } => words.voice_unmuted(actor, target),
70 AdminAction::CommunityVoiceSet { enabled: true } => {63 AdminAction::CommunityVoiceSet { enabled: true } => {
71- format!("{actor} enabled voice in {community}")64+ words.community_voice_enabled(actor, community)
72 }65 }
73 AdminAction::CommunityVoiceSet { enabled: false } => {66 AdminAction::CommunityVoiceSet { enabled: false } => {
74- format!("{actor} disabled voice in {community}")67+ words.community_voice_disabled(actor, community)
75 }68 }
76 AdminAction::Community(action) => {69 AdminAction::Community(action) => {
77- crate::gui::community_settings::community_log_text(&actor, &target, action)70+ crate::gui::community_settings::community_log_text(actor, target, action)
78- }
79-
80- AdminAction::AttachmentDeleted => {
81- format!("{actor} deleted an attachment of {target} in {community}")
82- }
83- AdminAction::GhostEnabled => format!("{actor} enabled ghost mode"),
84- AdminAction::GhostDisabled => format!("{actor} disabled ghost mode"),
85- AdminAction::GhostVisit => format!("{actor} visited {community} as ghost"),
86- AdminAction::GhostVoice { seconds } => {
87- format!("{actor} listened in {community} as ghost for {seconds}s")
88 }71 }
89- AdminAction::BackupCreated { name } => format!("{actor} created backup {name}"),72+ AdminAction::AttachmentDeleted => words.attachment_deleted(actor, community, target),
90- AdminAction::BackupDeleted { name } => format!("{actor} deleted backup {name}"),73+ AdminAction::GhostEnabled => words.ghost_enabled(actor),
91- AdminAction::BackupDownloaded { name } => format!("{actor} exported backup {name}"),74+ AdminAction::GhostDisabled => words.ghost_disabled(actor),
75+ AdminAction::GhostVisit => words.ghost_visit(actor, community),
76+ AdminAction::GhostVoice { seconds } => words.ghost_voice(actor, community, seconds),
77+ AdminAction::BackupCreated { name } => words.backup_created(actor, name),
78+ AdminAction::BackupDeleted { name } => words.backup_deleted(actor, name),
79+ AdminAction::BackupDownloaded { name } => words.backup_downloaded(actor, name),
92 }80 }
93 }81 }
94 82
@@ -209,7 +197,7 @@ fn builder_log_row(entry: &AdminLogEntry, palette: Palette) -> Div {
209 div()197 div()
210 .text_size(text(text::CAPTION))198 .text_size(text(text::CAPTION))
211 .text_color(palette.muted)199 .text_color(palette.muted)
212- .child(millis_time(entry.created_at, STAMP)),200+ .child(millis_time(entry.created_at, crate::lang::w().common.stamp)),
213 ),201 ),
214 )202 )
215 .children(203 .children(
@@ -229,7 +217,7 @@ impl Yumush {
229 self.filter_user(&self.chat.builder_log_actor, cx),217 self.filter_user(&self.chat.builder_log_actor, cx),
230 self.filter_user(&self.chat.builder_log_target, cx),218 self.filter_user(&self.chat.builder_log_target, cx),
231 ) else {219 ) else {
232- window.push_notification(Notification::error("Unknown user"), cx);220+ window.push_notification(Notification::error(w().builder_log.unknown_user), cx);
233 return;221 return;
234 };222 };
235 let action = self223 let action = self
@@ -296,7 +284,7 @@ impl Yumush {
296 fixed(size::THUMB, field(palette, &self.chat.builder_log_to)),284 fixed(size::THUMB, field(palette, &self.chat.builder_log_to)),
297 accent_button(285 accent_button(
298 "apply_builder_log",286 "apply_builder_log",
299- "Apply",287+ w().builder_log.apply,
300 palette,288 palette,
301 entity_action(entity, |yumush, window, cx| {289 entity_action(entity, |yumush, window, cx| {
302 yumush.load_builder_logs(window, cx)290 yumush.load_builder_logs(window, cx)
@@ -322,7 +310,7 @@ impl Yumush {
322 .justify_center()310 .justify_center()
323 .text_size(text(text::CAPTION))311 .text_size(text(text::CAPTION))
324 .text_color(palette.muted)312 .text_color(palette.muted)
325- .child("No entries")313+ .child(w().builder_log.no_entries)
326 } else {314 } else {
327 div().flex().flex_col().children(rows)315 div().flex().flex_col().children(rows)
328 };316 };
crates/client/src/gui/builder/messages.rsmodified+15 -9
@@ -16,7 +16,6 @@ use gpui_kit::{
16 use super::ui::{16 use super::ui::{
17 accent_button, card, confirmed, delete_icon_button, end_of_day_ms, icon_button, start_of_day_ms,17 accent_button, card, confirmed, delete_icon_button, end_of_day_ms, icon_button, start_of_day_ms,
18 };18 };
19-use crate::gui::YEAR_STAMP;
20 use crate::gui::style::{size, space, stroke, text};19 use crate::gui::style::{size, space, stroke, text};
21 use crate::gui::{20 use crate::gui::{
22 Palette, Yumush,21 Palette, Yumush,
@@ -26,6 +25,7 @@ use crate::gui::{
26 text,25 text,
27 widget::{field, search_text},26 widget::{field, search_text},
28 };27 };
28+use crate::lang::w;
29 29
30 fn message_hit_row(30 fn message_hit_row(
31 hit: &MessageHit,31 hit: &MessageHit,
@@ -46,7 +46,7 @@ fn message_hit_row(
46 let open = icon_button(46 let open = icon_button(
47 format!("open_message_{}", hit.message.id),47 format!("open_message_{}", hit.message.id),
48 IconName::MessageSquare,48 IconName::MessageSquare,
49- "Open chat",49+ w().builder_messages.open_chat,
50 palette.muted,50 palette.muted,
51 palette,51 palette,
52 entity_action(entity, move |yumush, window, cx| {52 entity_action(entity, move |yumush, window, cx| {
@@ -67,9 +67,9 @@ fn message_hit_row(
67 format!("purge_message_user_{}_{purge_pending}", hit.message.id),67 format!("purge_message_user_{}_{purge_pending}", hit.message.id),
68 IconName::UserX,68 IconName::UserX,
69 if purge_pending {69 if purge_pending {
70- "Confirm purge"70+ w().builder_messages.confirm_purge
71 } else {71 } else {
72- "Purge user"72+ w().builder_messages.purge_user
73 },73 },
74 palette.danger,74 palette.danger,
75 palette,75 palette,
@@ -131,7 +131,10 @@ fn message_hit_row(
131 .flex_shrink_0()131 .flex_shrink_0()
132 .text_size(text(text::CAPTION))132 .text_size(text(text::CAPTION))
133 .text_color(palette.muted)133 .text_color(palette.muted)
134- .child(millis_time(hit.message.created_at, YEAR_STAMP)),134+ .child(millis_time(
135+ hit.message.created_at,
136+ crate::lang::w().common.year_stamp,
137+ )),
135 )138 )
136 .child(139 .child(
137 div()140 div()
@@ -209,7 +212,7 @@ impl Yumush {
209 )212 )
210 .child(accent_button(213 .child(accent_button(
211 "search_messages",214 "search_messages",
212- "Search",215+ w().builder_messages.search,
213 palette,216 palette,
214 entity_action(entity, |yumush, window, cx| {217 entity_action(entity, |yumush, window, cx| {
215 yumush.search_messages(window, cx)218 yumush.search_messages(window, cx)
@@ -236,7 +239,7 @@ impl Yumush {
236 .justify_center()239 .justify_center()
237 .text_size(text(text::CAPTION))240 .text_size(text(text::CAPTION))
238 .text_color(palette.muted)241 .text_color(palette.muted)
239- .child("No messages")242+ .child(w().builder_messages.no_messages)
240 } else {243 } else {
241 div()244 div()
242 .relative()245 .relative()
@@ -263,12 +266,15 @@ impl Yumush {
263 pub(super) fn search_messages(&mut self, window: &mut Window, cx: &mut Context<Self>) {266 pub(super) fn search_messages(&mut self, window: &mut Window, cx: &mut Context<Self>) {
264 let text = search_text(&self.chat.builder_message_text, cx);267 let text = search_text(&self.chat.builder_message_text, cx);
265 let Some(user_id) = self.filter_user(&self.chat.builder_message_user, cx) else {268 let Some(user_id) = self.filter_user(&self.chat.builder_message_user, cx) else {
266- window.push_notification(Notification::error("Unknown user"), cx);269+ window.push_notification(Notification::error(w().builder_messages.unknown_user), cx);
267 return;270 return;
268 };271 };
269 let Some(community_id) = self.filter_community(&self.chat.builder_message_community, cx)272 let Some(community_id) = self.filter_community(&self.chat.builder_message_community, cx)
270 else {273 else {
271- window.push_notification(Notification::error("Unknown community"), cx);274+ window.push_notification(
275+ Notification::error(w().builder_messages.unknown_community),
276+ cx,
277+ );
272 return;278 return;
273 };279 };
274 let after_ms = start_of_day_ms(&search_text(&self.chat.builder_message_from, cx));280 let after_ms = start_of_day_ms(&search_text(&self.chat.builder_message_from, cx));
crates/client/src/gui/builder/overview.rsmodified+28 -11
@@ -10,13 +10,14 @@ use std::time::Duration;
10 10
11 use super::ui::{card, card_header, stat_tile};11 use super::ui::{card, card_header, stat_tile};
12 use crate::gui::{12 use crate::gui::{
13- DAY, Palette, Yumush,13+ Palette, Yumush,
14 builder::BuilderTab,14 builder::BuilderTab,
15 chat::View,15 chat::View,
16 storage,16 storage,
17 style::{radius, size, space, text},17 style::{radius, size, space, text},
18 text, voice_stats,18 text, voice_stats,
19 };19 };
20+use crate::lang::w;
20 21
21 const CHART_HEIGHT: f32 = 80.;22 const CHART_HEIGHT: f32 = 80.;
22 const PANEL_HEIGHT: f32 = 140.;23 const PANEL_HEIGHT: f32 = 140.;
@@ -24,7 +25,13 @@ const SERVER_STATS_TICK: Duration = Duration::from_secs(1);
24 25
25 fn day_label(day: u64) -> String {26 fn day_label(day: u64) -> String {
26 Timestamp::from_millisecond((day * DAY_MILLIS) as i64)27 Timestamp::from_millisecond((day * DAY_MILLIS) as i64)
27- .map(|timestamp| timestamp.strftime(DAY).to_string())28+ .map(|timestamp| {
29+ let format = crate::gui::month_named(
30+ w().common.day,
31+ timestamp.to_zoned_datetime(jiff::tz::TimeZone::UTC).month(),
32+ );
33+ timestamp.strftime(&format).to_string()
34+ })
28 .unwrap_or_default()35 .unwrap_or_default()
29 }36 }
30 37
@@ -180,12 +187,18 @@ impl Yumush {
180 let messages = stats.iter().map(|stat| stat.messages).sum::<u64>();187 let messages = stats.iter().map(|stat| stat.messages).sum::<u64>();
181 188
182 let tiles = [189 let tiles = [
183- ("Users", overview.users.to_string()),190+ (w().builder_overview.users, overview.users.to_string()),
184- ("Builders", overview.builders.to_string()),191+ (w().builder_overview.builders, overview.builders.to_string()),
185- ("Communities", overview.communities.to_string()),192+ (
186- ("Online", overview.online.to_string()),193+ w().builder_overview.communities,
187- ("In voice", overview.voice.to_string()),194+ overview.communities.to_string(),
188- ("Storage", storage(overview.storage_bytes)),195+ ),
196+ (w().builder_overview.online, overview.online.to_string()),
197+ (w().builder_overview.in_voice, overview.voice.to_string()),
198+ (
199+ w().builder_overview.storage,
200+ storage(overview.storage_bytes),
201+ ),
189 ];202 ];
190 203
191 let mut rows: Vec<Div> = tiles204 let mut rows: Vec<Div> = tiles
@@ -197,14 +210,14 @@ impl Yumush {
197 .flex()210 .flex()
198 .gap(px(space::MD))211 .gap(px(space::MD))
199 .child(bar_chart(212 .child(bar_chart(
200- "Active users",213+ w().builder_overview.active_users,
201 stats,214 stats,
202 |stat| stat.active_users,215 |stat| stat.active_users,
203 active,216 active,
204 palette,217 palette,
205 ))218 ))
206 .child(bar_chart(219 .child(bar_chart(
207- "Messages",220+ w().builder_overview.messages,
208 stats,221 stats,
209 |stat| stat.messages,222 |stat| stat.messages,
210 messages,223 messages,
@@ -214,7 +227,11 @@ impl Yumush {
214 if let Some(stats) = &self.chat.server_stats {227 if let Some(stats) = &self.chat.server_stats {
215 rows.push(228 rows.push(
216 card(palette)229 card(palette)
217- .child(card_header("Server", Vec::new(), palette))230+ .child(card_header(
231+ w().builder_overview.server,
232+ Vec::new(),
233+ palette,
234+ ))
218 .child(div().p(px(space::LG)).child(voice_stats::stats_panel(235 .child(div().p(px(space::LG)).child(voice_stats::stats_panel(
219 stats,236 stats,
220 &|id| self.chat.name_of(id),237 &|id| self.chat.name_of(id),
crates/client/src/gui/builder/reports.rsmodified+19 -13
@@ -1,3 +1,4 @@
1+use crate::lang::{Label as _, w};
1 use common::model::Id;2 use common::model::Id;
2 use std::future::Future;3 use std::future::Future;
3 4
@@ -11,7 +12,6 @@ use gpui_kit::{
11 };12 };
12 13
13 use super::ui::{danger_button, list_card, pill, plain_button};14 use super::ui::{danger_button, list_card, pill, plain_button};
14-use crate::gui::STAMP;
15 use crate::{15 use crate::{
16 gui::{16 gui::{
17 Palette, Yumush, avatar, badge, clickable,17 Palette, Yumush, avatar, badge, clickable,
@@ -169,7 +169,7 @@ impl Yumush {
169 pub(super) fn report_filters(&self, entity: &Entity<Self>, palette: Palette) -> Div {169 pub(super) fn report_filters(&self, entity: &Entity<Self>, palette: Palette) -> Div {
170 div().flex().child(170 div().flex().child(
171 segment_track(palette).children(REPORT_FILTERS.map(|status| {171 segment_track(palette).children(REPORT_FILTERS.map(|status| {
172- let label = status.map_or("All", ReportStatus::label);172+ let label = status.map_or(w().builder_reports.all, ReportStatus::label);
173 segment(173 segment(
174 clickable(174 clickable(
175 label,175 label,
@@ -197,7 +197,7 @@ impl Yumush {
197 197
198 vec![198 vec![
199 self.report_filters(entity, palette).into_any_element(),199 self.report_filters(entity, palette).into_any_element(),
200- list_card(None, rows, "No reports", palette).into_any_element(),200+ list_card(None, rows, w().builder_reports.no_reports, palette).into_any_element(),
201 ]201 ]
202 }202 }
203 203
@@ -219,7 +219,7 @@ impl Yumush {
219 None => badge(219 None => badge(
220 palette,220 palette,
221 report.id,221 report.id,
222- "someone",222+ w().builder_reports.someone,
223 px(size::AVATAR),223 px(size::AVATAR),
224 text_fn(text::CAPTION),224 text_fn(text::CAPTION),
225 )225 )
@@ -260,7 +260,7 @@ impl Yumush {
260 .text_size(text_fn(text::CAPTION))260 .text_size(text_fn(text::CAPTION))
261 .text_color(palette.muted)261 .text_color(palette.muted)
262 .truncate()262 .truncate()
263- .child(format!("reported by {}", user_name(&report.reporter))),263+ .child(w().builder_reports.reported_by(user_name(&report.reporter))),
264 ));264 ));
265 let meta = div()265 let meta = div()
266 .flex_shrink_0()266 .flex_shrink_0()
@@ -268,15 +268,21 @@ impl Yumush {
268 .text_color(palette.muted)268 .text_color(palette.muted)
269 .child(format!(269 .child(format!(
270 "{} · {}",270 "{} · {}",
271- report.community.as_deref().unwrap_or("deleted community"),271+ report
272- millis_time(report.created_at, STAMP)272+ .community
273+ .as_deref()
274+ .unwrap_or(w().builder_reports.deleted_community),
275+ millis_time(report.created_at, crate::lang::w().common.stamp)
273 ));276 ));
274 let actions = self.report_actions(report, entity, palette);277 let actions = self.report_actions(report, entity, palette);
275 let handled = (report.status != ReportStatus::Open).then(|| {278 let handled = (report.status != ReportStatus::Open).then(|| {
276 div()279 div()
277 .text_size(text_fn(text::CAPTION))280 .text_size(text_fn(text::CAPTION))
278 .text_color(palette.muted)281 .text_color(palette.muted)
279- .child(format!("by {}", user_name(&report.handled_by)))282+ .child(
283+ w().builder_reports
284+ .handled_by(user_name(&report.handled_by)),
285+ )
280 });286 });
281 287
282 div()288 div()
@@ -341,7 +347,7 @@ impl Yumush {
341 let mut buttons = vec![347 let mut buttons = vec![
342 plain_button(348 plain_button(
343 format!("resolve_report_{}", report.id),349 format!("resolve_report_{}", report.id),
344- "Resolve",350+ w().builder_reports.resolve,
345 palette,351 palette,
346 entity_action(entity, move |yumush, window, cx| {352 entity_action(entity, move |yumush, window, cx| {
347 yumush.handle_report(resolve_id, ReportStatus::Resolved, window, cx)353 yumush.handle_report(resolve_id, ReportStatus::Resolved, window, cx)
@@ -350,7 +356,7 @@ impl Yumush {
350 .into_any_element(),356 .into_any_element(),
351 plain_button(357 plain_button(
352 format!("dismiss_report_{}", report.id),358 format!("dismiss_report_{}", report.id),
353- "Dismiss",359+ w().builder_reports.dismiss,
354 palette,360 palette,
355 entity_action(entity, move |yumush, window, cx| {361 entity_action(entity, move |yumush, window, cx| {
356 yumush.handle_report(dismiss_id, ReportStatus::Dismissed, window, cx)362 yumush.handle_report(dismiss_id, ReportStatus::Dismissed, window, cx)
@@ -362,7 +368,7 @@ impl Yumush {
362 buttons.push(368 buttons.push(
363 plain_button(369 plain_button(
364 format!("delete_report_message_{}", report.id),370 format!("delete_report_message_{}", report.id),
365- "Delete message",371+ w().builder_reports.delete_message,
366 palette,372 palette,
367 entity_action(entity, move |yumush, window, cx| {373 entity_action(entity, move |yumush, window, cx| {
368 yumush.delete_report_message(message_id, window, cx)374 yumush.delete_report_message(message_id, window, cx)
@@ -378,7 +384,7 @@ impl Yumush {
378 buttons.push(384 buttons.push(
379 plain_button(385 plain_button(
380 format!("timeout_report_{}", report.id),386 format!("timeout_report_{}", report.id),
381- "Timeout 1h",387+ w().builder_reports.timeout,
382 palette,388 palette,
383 entity_action(entity, move |yumush, window, cx| {389 entity_action(entity, move |yumush, window, cx| {
384 yumush.timeout_report_target(timeout_id, window, cx)390 yumush.timeout_report_target(timeout_id, window, cx)
@@ -389,7 +395,7 @@ impl Yumush {
389 buttons.push(395 buttons.push(
390 danger_button(396 danger_button(
391 format!("ban_report_{}", report.id),397 format!("ban_report_{}", report.id),
392- "Ban",398+ w().builder_reports.ban,
393 palette,399 palette,
394 entity_action(entity, move |yumush, window, cx| {400 entity_action(entity, move |yumush, window, cx| {
395 yumush.ban_report_target(ban_id, &ban_reason, window, cx)401 yumush.ban_report_target(ban_id, &ban_reason, window, cx)
crates/client/src/gui/builder/server.rsmodified+35 -28
@@ -7,6 +7,7 @@ use gpui_kit::{
7 7
8 use super::ui::{field_row, list_card, number, to_bytes, to_units};8 use super::ui::{field_row, list_card, number, to_bytes, to_units};
9 use crate::gui::{KB, MB, Palette, Yumush, notify_error, settings_page::segmented, widget::field};9 use crate::gui::{KB, MB, Palette, Yumush, notify_error, settings_page::segmented, widget::field};
10+use crate::lang::w;
10 11
11 fn input_text(input: &Entity<InputState>, cx: &App) -> String {12 fn input_text(input: &Entity<InputState>, cx: &App) -> String {
12 input.read(cx).text().to_string()13 input.read(cx).text().to_string()
@@ -123,7 +124,7 @@ impl Yumush {
123 124
124 pub(super) fn save_server_settings(&mut self, window: &mut Window, cx: &mut Context<Self>) {125 pub(super) fn save_server_settings(&mut self, window: &mut Window, cx: &mut Context<Self>) {
125 let Some(settings) = self.server_form(cx) else {126 let Some(settings) = self.server_form(cx) else {
126- window.push_notification(Notification::error("Invalid number"), cx);127+ window.push_notification(Notification::error(w().builder_server.invalid_number), cx);
127 return;128 return;
128 };129 };
129 let network = self.network.clone();130 let network = self.network.clone();
@@ -145,16 +146,19 @@ impl Yumush {
145 pub(super) fn server_body(&self, entity: &Entity<Self>, palette: Palette) -> Vec<AnyElement> {146 pub(super) fn server_body(&self, entity: &Entity<Self>, palette: Palette) -> Vec<AnyElement> {
146 let general = vec![147 let general = vec![
147 field_row(148 field_row(
148- "Name",149+ w().builder_server.name,
149 None,150 None,
150 field(palette, &self.chat.server_name),151 field(palette, &self.chat.server_name),
151 palette,152 palette,
152 ),153 ),
153 field_row(154 field_row(
154- "Registration",155+ w().builder_server.registration,
155 None,156 None,
156 segmented(157 segmented(
157- [(true, "Open"), (false, "Closed")],158+ [
159+ (true, w().builder_server.open),
160+ (false, w().builder_server.closed),
161+ ],
158 self.chat.server_registration_open,162 self.chat.server_registration_open,
159 entity,163 entity,
160 palette,164 palette,
@@ -163,10 +167,13 @@ impl Yumush {
163 palette,167 palette,
164 ),168 ),
165 field_row(169 field_row(
166- "Maintenance",170+ w().builder_server.maintenance,
167 None,171 None,
168 segmented(172 segmented(
169- [(false, "Off"), (true, "On")],173+ [
174+ (false, w().builder_server.off),
175+ (true, w().builder_server.on),
176+ ],
170 self.chat.server_maintenance,177 self.chat.server_maintenance,
171 entity,178 entity,
172 palette,179 palette,
@@ -175,7 +182,7 @@ impl Yumush {
175 palette,182 palette,
176 ),183 ),
177 field_row(184 field_row(
178- "Announcement",185+ w().builder_server.announcement,
179 None,186 None,
180 field(palette, &self.chat.server_announcement),187 field(palette, &self.chat.server_announcement),
181 palette,188 palette,
@@ -183,76 +190,76 @@ impl Yumush {
183 ];190 ];
184 let limits = vec![191 let limits = vec![
185 field_row(192 field_row(
186- "Max attachment (MB)",193+ w().builder_server.max_attachment,
187 None,194 None,
188 field(palette, &self.chat.server_limit),195 field(palette, &self.chat.server_limit),
189 palette,196 palette,
190 ),197 ),
191 field_row(198 field_row(
192- "Max avatar (KB)",199+ w().builder_server.max_avatar,
193 None,200 None,
194 field(palette, &self.chat.server_max_avatar),201 field(palette, &self.chat.server_max_avatar),
195 palette,202 palette,
196 ),203 ),
197 field_row(204 field_row(
198- "Max message length",205+ w().builder_server.max_message_length,
199 None,206 None,
200 field(palette, &self.chat.server_max_message_length),207 field(palette, &self.chat.server_max_message_length),
201 palette,208 palette,
202 ),209 ),
203 field_row(210 field_row(
204- "Communities per user",211+ w().builder_server.communities_per_user,
205- Some("0 = unlimited"),212+ Some(w().builder_server.zero_unlimited),
206 field(palette, &self.chat.server_max_communities),213 field(palette, &self.chat.server_max_communities),
207 palette,214 palette,
208 ),215 ),
209 ];216 ];
210 let storage = vec![217 let storage = vec![
211 field_row(218 field_row(
212- "User quota (MB)",219+ w().builder_server.user_quota,
213- Some("0 = unlimited"),220+ Some(w().builder_server.zero_unlimited),
214 field(palette, &self.chat.server_user_quota),221 field(palette, &self.chat.server_user_quota),
215 palette,222 palette,
216 ),223 ),
217 field_row(224 field_row(
218- "Community quota (MB)",225+ w().builder_server.community_quota,
219- Some("0 = unlimited"),226+ Some(w().builder_server.zero_unlimited),
220 field(palette, &self.chat.server_community_quota),227 field(palette, &self.chat.server_community_quota),
221 palette,228 palette,
222 ),229 ),
223 field_row(230 field_row(
224- "Message retention (days)",231+ w().builder_server.message_retention,
225- Some("0 = off"),232+ Some(w().builder_server.zero_off),
226 field(palette, &self.chat.server_message_retention),233 field(palette, &self.chat.server_message_retention),
227 palette,234 palette,
228 ),235 ),
229 field_row(236 field_row(
230- "Attachment retention (days)",237+ w().builder_server.attachment_retention,
231- Some("0 = off"),238+ Some(w().builder_server.zero_off),
232 field(palette, &self.chat.server_attachment_retention),239 field(palette, &self.chat.server_attachment_retention),
233 palette,240 palette,
234 ),241 ),
235 ];242 ];
236 let rate = vec![243 let rate = vec![
237 field_row(244 field_row(
238- "Messages / min",245+ w().builder_server.messages_per_minute,
239- Some("0 = off"),246+ Some(w().builder_server.zero_off),
240 field(palette, &self.chat.server_messages_per_minute),247 field(palette, &self.chat.server_messages_per_minute),
241 palette,248 palette,
242 ),249 ),
243 field_row(250 field_row(
244- "Logins / min",251+ w().builder_server.logins_per_minute,
245- Some("0 = off"),252+ Some(w().builder_server.zero_off),
246 field(palette, &self.chat.server_logins_per_minute),253 field(palette, &self.chat.server_logins_per_minute),
247 palette,254 palette,
248 ),255 ),
249 ];256 ];
250 257
251 vec![258 vec![
252- list_card(Some("General"), general, "", palette).into_any_element(),259+ list_card(Some(w().builder_server.general), general, "", palette).into_any_element(),
253- list_card(Some("Limits"), limits, "", palette).into_any_element(),260+ list_card(Some(w().builder_server.limits), limits, "", palette).into_any_element(),
254- list_card(Some("Storage"), storage, "", palette).into_any_element(),261+ list_card(Some(w().builder_server.storage), storage, "", palette).into_any_element(),
255- list_card(Some("Rate limits"), rate, "", palette).into_any_element(),262+ list_card(Some(w().builder_server.rate_limits), rate, "", palette).into_any_element(),
256 ]263 ]
257 }264 }
258 }265 }
crates/client/src/gui/builder/storage.rsmodified+40 -20
@@ -17,13 +17,14 @@ use super::ui::{
17 toolbar,17 toolbar,
18 };18 };
19 use crate::gui::{19 use crate::gui::{
20- DATE, Palette, Yumush,20+ Palette, Yumush,
21 community_settings::user_name,21 community_settings::user_name,
22 entity_action, millis_time, notify_error, storage,22 entity_action, millis_time, notify_error, storage,
23 style::{radius, size, space, text},23 style::{radius, size, space, text},
24 text,24 text,
25 widget::field,25 widget::field,
26 };26 };
27+use crate::lang::w;
27 28
28 fn share(bytes: u64, max: u64) -> f32 {29 fn share(bytes: u64, max: u64) -> f32 {
29 if max == 0 {30 if max == 0 {
@@ -137,7 +138,7 @@ fn attachment_row(
137 "{} · {} · {}",138 "{} · {} · {}",
138 user_name(&info.uploader),139 user_name(&info.uploader),
139 info.community,140 info.community,
140- millis_time(info.attachment.created_at, DATE)141+ millis_time(info.attachment.created_at, crate::lang::w().common.date)
141 )),142 )),
142 ),143 ),
143 )144 )
@@ -195,19 +196,31 @@ impl Yumush {
195 )196 )
196 })197 })
197 .collect();198 .collect();
198- let usage =199+ let usage = div()
199- div()200+ .flex()
200- .flex()201+ .gap(px(space::XL))
201- .gap(px(space::XL))202+ .child(
202- .child(203+ div().flex_1().min_w_0().child(
203- div()204+ list_card(
204- .flex_1()205+ Some(w().builder_storage.users),
205- .min_w_0()206+ users,
206- .child(list_card(Some("Users"), users, "No data", palette).h_full()),207+ w().builder_storage.no_data,
207- )208+ palette,
208- .child(div().flex_1().min_w_0().child(209+ )
209- list_card(Some("Communities"), communities, "No data", palette).h_full(),210+ .h_full(),
210- ));211+ ),
212+ )
213+ .child(
214+ div().flex_1().min_w_0().child(
215+ list_card(
216+ Some(w().builder_storage.communities),
217+ communities,
218+ w().builder_storage.no_data,
219+ palette,
220+ )
221+ .h_full(),
222+ ),
223+ );
211 224
212 let controls = toolbar(vec![225 let controls = toolbar(vec![
213 fixed(226 fixed(
@@ -220,7 +233,7 @@ impl Yumush {
220 ),233 ),
221 accent_button(234 accent_button(
222 "search_attachments",235 "search_attachments",
223- "Search",236+ w().builder_storage.search,
224 palette,237 palette,
225 entity_action(entity, |yumush, window, cx| {238 entity_action(entity, |yumush, window, cx| {
226 yumush.search_attachments(window, cx)239 yumush.search_attachments(window, cx)
@@ -245,7 +258,7 @@ impl Yumush {
245 .justify_center()258 .justify_center()
246 .text_size(text(text::CAPTION))259 .text_size(text(text::CAPTION))
247 .text_color(palette.muted)260 .text_color(palette.muted)
248- .child("No attachments")261+ .child(w().builder_storage.no_attachments)
249 } else {262 } else {
250 div()263 div()
251 .flex()264 .flex()
@@ -257,7 +270,11 @@ impl Yumush {
257 }))270 }))
258 };271 };
259 let attachments = card(palette)272 let attachments = card(palette)
260- .child(card_header("Attachments", vec![controls], palette))273+ .child(card_header(
274+ w().builder_storage.attachments,
275+ vec![controls],
276+ palette,
277+ ))
261 .child(body);278 .child(body);
262 279
263 vec![280 vec![
@@ -287,12 +304,15 @@ impl Yumush {
287 304
288 pub(super) fn search_attachments(&self, window: &mut Window, cx: &mut Context<Self>) {305 pub(super) fn search_attachments(&self, window: &mut Window, cx: &mut Context<Self>) {
289 let Some(user_id) = self.filter_user(&self.chat.builder_attachment_user, cx) else {306 let Some(user_id) = self.filter_user(&self.chat.builder_attachment_user, cx) else {
290- window.push_notification(Notification::error("Unknown user"), cx);307+ window.push_notification(Notification::error(w().builder_storage.unknown_user), cx);
291 return;308 return;
292 };309 };
293 let Some(community_id) = self.filter_community(&self.chat.builder_attachment_community, cx)310 let Some(community_id) = self.filter_community(&self.chat.builder_attachment_community, cx)
294 else {311 else {
295- window.push_notification(Notification::error("Unknown community"), cx);312+ window.push_notification(
313+ Notification::error(w().builder_storage.unknown_community),
314+ cx,
315+ );
296 return;316 return;
297 };317 };
298 let network = self.network.clone();318 let network = self.network.clone();
crates/client/src/gui/builder/ui.rsmodified+12 -3
@@ -1,5 +1,6 @@
1 use crate::gui::style::{radius, size, space, text};1 use crate::gui::style::{radius, size, space, text};
2 use crate::gui::{Palette, Tooltip as _, clickable, primary_button, text, widget};2 use crate::gui::{Palette, Tooltip as _, clickable, primary_button, text, widget};
3+use crate::lang::w;
3 use gpui_kit::{4 use gpui_kit::{
4 AnyElement, App, Div, FontWeight, Hsla, IntoElement, ParentElement, Stateful, Styled, Window,5 AnyElement, App, Div, FontWeight, Hsla, IntoElement, ParentElement, Stateful, Styled, Window,
5 assets::IconName, component::Icon, div, prelude::FluentBuilder as _, px,6 assets::IconName, component::Icon, div, prelude::FluentBuilder as _, px,
@@ -58,7 +59,11 @@ pub(super) fn delete_icon_button(
58 icon_button(59 icon_button(
59 format!("{id}_{pending}"),60 format!("{id}_{pending}"),
60 IconName::Trash,61 IconName::Trash,
61- if pending { "Confirm" } else { "Delete" },62+ if pending {
63+ w().builder_ui.confirm
64+ } else {
65+ w().builder_ui.delete
66+ },
62 palette.danger,67 palette.danger,
63 palette,68 palette,
64 action,69 action,
@@ -105,9 +110,13 @@ pub(super) fn confirm_button(
105 action_button(110 action_button(
106 format!("{id}_{pending}"),111 format!("{id}_{pending}"),
107 icon,112 icon,
108- if pending { "Confirm" } else { label },
109 if pending {113 if pending {
110- "Click again to confirm"114+ w().builder_ui.confirm
115+ } else {
116+ label
117+ },
118+ if pending {
119+ w().builder_ui.confirm_tip
111 } else {120 } else {
112 tip121 tip
113 },122 },
crates/client/src/gui/builder/users.rsmodified+94 -64
@@ -24,10 +24,10 @@ use gpui_kit::{
24 use super::ui::{24 use super::ui::{
25 accent_button, action_button, action_group, card, confirm_button, confirmed, pill, plain_button,25 accent_button, action_button, action_group, card, confirm_button, confirmed, pill, plain_button,
26 };26 };
27+use crate::lang::w;
27 use crate::{28 use crate::{
28 gui::{29 gui::{
29- DATE, DAY, Palette, Tooltip as _, Yumush, avatar, clickable, entity_action, millis_time,30+ Palette, Tooltip as _, Yumush, avatar, clickable, entity_action, millis_time, notify_error,
30- notify_error,
31 profile::user_link,31 profile::user_link,
32 style::{radius, size, space, text},32 style::{radius, size, space, text},
33 text,33 text,
@@ -41,15 +41,17 @@ const MINUTES_PER_DAY: u64 = DAY_MILLIS / MINUTE_MILLIS;
41 41
42 fn seen_text(last_seen: Option<u64>) -> String {42 fn seen_text(last_seen: Option<u64>) -> String {
43 let Some(last_seen) = last_seen else {43 let Some(last_seen) = last_seen else {
44- return "never".to_string();44+ return w().builder_users.seen_never.to_string();
45 };45 };
46 let minutes = now_ms().saturating_sub(last_seen) / MINUTE_MILLIS;46 let minutes = now_ms().saturating_sub(last_seen) / MINUTE_MILLIS;
47 47
48 match minutes {48 match minutes {
49- 0 => "now".to_string(),49+ 0 => w().builder_users.seen_now.to_string(),
50- 1..MINUTES_PER_HOUR => format!("{minutes}m ago"),50+ 1..MINUTES_PER_HOUR => w().builder_users.seen_minutes(minutes),
51- MINUTES_PER_HOUR..MINUTES_PER_DAY => format!("{}h ago", minutes / MINUTES_PER_HOUR),51+ MINUTES_PER_HOUR..MINUTES_PER_DAY => {
52- _ => millis_time(last_seen, DAY),52+ w().builder_users.seen_hours(minutes / MINUTES_PER_HOUR)
53+ }
54+ _ => millis_time(last_seen, crate::lang::w().common.day),
53 }55 }
54 }56 }
55 57
@@ -96,14 +98,7 @@ impl Yumush {
96 match network.call(SetRole { user_id, role }).await {98 match network.call(SetRole { user_id, role }).await {
97 Ok(user) => {99 Ok(user) => {
98 let _ = this.update(cx, |yumush, cx| {100 let _ = this.update(cx, |yumush, cx| {
99- let index = yumush101+ yumush.replace_builder_user(user);
100- .chat
101- .builder_users
102- .iter()
103- .position(|existing| existing.user.id == user.id);
104- if let Some(index) = index {
105- yumush.chat.builder_users[index].user = user;
106- }
107 cx.notify();102 cx.notify();
108 });103 });
109 }104 }
@@ -113,6 +108,17 @@ impl Yumush {
113 .detach();108 .detach();
114 }109 }
115 110
111+ fn replace_builder_user(&mut self, user: User) {
112+ let index = self
113+ .chat
114+ .builder_users
115+ .iter()
116+ .position(|existing| existing.user.id == user.id);
117+ if let Some(index) = index {
118+ self.chat.builder_users[index].user = user;
119+ }
120+ }
121+
116 pub(super) fn delete_builder_user(122 pub(super) fn delete_builder_user(
117 &mut self,123 &mut self,
118 user_id: Id,124 user_id: Id,
@@ -483,7 +489,7 @@ impl Yumush {
483 )489 )
484 .child(accent_button(490 .child(accent_button(
485 "create_user",491 "create_user",
486- "Create",492+ w().builder_users.create,
487 palette,493 palette,
488 entity_action(entity, |yumush, window, cx| {494 entity_action(entity, |yumush, window, cx| {
489 yumush.submit_new_user(window, cx)495 yumush.submit_new_user(window, cx)
@@ -497,7 +503,7 @@ impl Yumush {
497 .justify_center()503 .justify_center()
498 .text_size(text(text::CAPTION))504 .text_size(text(text::CAPTION))
499 .text_color(palette.muted)505 .text_color(palette.muted)
500- .child("No users".to_string())506+ .child(w().builder_users.no_users)
501 } else {507 } else {
502 div()508 div()
503 .flex()509 .flex()
@@ -532,7 +538,7 @@ impl Yumush {
532 )538 )
533 .child(plain_button(539 .child(plain_button(
534 format!("confirm_timeout_{user_id}"),540 format!("confirm_timeout_{user_id}"),
535- "Confirm",541+ w().builder_users.confirm,
536 palette,542 palette,
537 entity_action(entity, |yumush, window, cx| {543 entity_action(entity, |yumush, window, cx| {
538 yumush.confirm_builder_timeout(window, cx)544 yumush.confirm_builder_timeout(window, cx)
@@ -547,9 +553,9 @@ impl Yumush {
547 palette: Palette,553 palette: Palette,
548 ) -> Div {554 ) -> Div {
549 let ip_label = if self.chat.builder_ban_scope == BanScope::AccountAndIp {555 let ip_label = if self.chat.builder_ban_scope == BanScope::AccountAndIp {
550- "IP: on"556+ w().builder_users.ip_on
551 } else {557 } else {
552- "IP: off"558+ w().builder_users.ip_off
553 };559 };
554 560
555 div()561 div()
@@ -572,7 +578,7 @@ impl Yumush {
572 ))578 ))
573 .child(plain_button(579 .child(plain_button(
574 format!("confirm_ban_{user_id}"),580 format!("confirm_ban_{user_id}"),
575- "Confirm",581+ w().builder_users.confirm,
576 palette,582 palette,
577 entity_action(entity, |yumush, window, cx| {583 entity_action(entity, |yumush, window, cx| {
578 yumush.confirm_builder_ban(window, cx)584 yumush.confirm_builder_ban(window, cx)
@@ -612,8 +618,8 @@ impl Yumush {
612 let revoke_button = action_button(618 let revoke_button = action_button(
613 format!("revoke_session_{}", session.id),619 format!("revoke_session_{}", session.id),
614 IconName::LogOut,620 IconName::LogOut,
615- "Revoke",621+ w().builder_users.revoke,
616- "End this session",622+ w().builder_users.end_session,
617 palette.muted,623 palette.muted,
618 palette,624 palette,
619 entity_action(entity, move |yumush, window, cx| {625 entity_action(entity, move |yumush, window, cx| {
@@ -621,7 +627,7 @@ impl Yumush {
621 }),627 }),
622 );628 );
623 let device = if session.device.is_empty() {629 let device = if session.device.is_empty() {
624- "unknown device"630+ w().builder_users.unknown_device
625 } else {631 } else {
626 session.device.as_str()632 session.device.as_str()
627 };633 };
@@ -685,7 +691,7 @@ impl Yumush {
685 .when(ready, |row| {691 .when(ready, |row| {
686 row.child(plain_button(692 row.child(plain_button(
687 format!("confirm_rename_{user_id}"),693 format!("confirm_rename_{user_id}"),
688- "Confirm",694+ w().builder_users.confirm,
689 palette,695 palette,
690 entity_action(entity, |yumush, window, cx| {696 entity_action(entity, |yumush, window, cx| {
691 yumush.rename_builder_user(window, cx)697 yumush.rename_builder_user(window, cx)
@@ -718,7 +724,7 @@ impl Yumush {
718 .when(ready, |row| {724 .when(ready, |row| {
719 row.child(plain_button(725 row.child(plain_button(
720 format!("confirm_password_{user_id}"),726 format!("confirm_password_{user_id}"),
721- "Confirm",727+ w().builder_users.confirm,
722 palette,728 palette,
723 entity_action(entity, |yumush, window, cx| {729 entity_action(entity, |yumush, window, cx| {
724 yumush.reset_builder_password(window, cx)730 yumush.reset_builder_password(window, cx)
@@ -766,7 +772,7 @@ impl Yumush {
766 let timeout_id = user.id;772 let timeout_id = user.id;
767 let ban_id = user.id;773 let ban_id = user.id;
768 let purge_id = user.id;774 let purge_id = user.id;
769- let joined = millis_time(user.created_at, DATE);775+ let joined = millis_time(user.created_at, crate::lang::w().common.date);
770 let seen = seen_text(account.last_seen);776 let seen = seen_text(account.last_seen);
771 let next_role = if builder { Role::User } else { Role::Builder };777 let next_role = if builder { Role::User } else { Role::Builder };
772 778
@@ -779,14 +785,14 @@ impl Yumush {
779 IconName::Shield785 IconName::Shield
780 },786 },
781 if builder {787 if builder {
782- "Remove builder"788+ w().builder_users.remove_builder
783 } else {789 } else {
784- "Make builder"790+ w().builder_users.make_builder
785 },791 },
786 if builder {792 if builder {
787- "Revoke admin tools"793+ w().builder_users.revoke_admin
788 } else {794 } else {
789- "Grant admin tools"795+ w().builder_users.grant_admin
790 },796 },
791 tone,797 tone,
792 palette,798 palette,
@@ -798,11 +804,15 @@ impl Yumush {
798 let suspend_button = action_button(804 let suspend_button = action_button(
799 format!("suspend_user_{}_{suspended}", user.id),805 format!("suspend_user_{}_{suspended}", user.id),
800 IconName::CirclePause,806 IconName::CirclePause,
801- if suspended { "Unsuspend" } else { "Suspend" },
802 if suspended {807 if suspended {
803- "Allow sign in again"808+ w().builder_users.unsuspend
809+ } else {
810+ w().builder_users.suspend
811+ },
812+ if suspended {
813+ w().builder_users.allow_sign_in
804 } else {814 } else {
805- "Block sign in until lifted"815+ w().builder_users.block_until_lifted
806 },816 },
807 tone,817 tone,
808 palette,818 palette,
@@ -814,8 +824,8 @@ impl Yumush {
814 let sessions_button = action_button(824 let sessions_button = action_button(
815 format!("sessions_user_{}", user.id),825 format!("sessions_user_{}", user.id),
816 IconName::LogOut,826 IconName::LogOut,
817- "Sign out",827+ w().builder_users.sign_out,
818- "End every session",828+ w().builder_users.end_all_sessions,
819 tone,829 tone,
820 palette,830 palette,
821 entity_action(entity, move |yumush, window, cx| {831 entity_action(entity, move |yumush, window, cx| {
@@ -833,8 +843,8 @@ impl Yumush {
833 let stats_button = action_button(843 let stats_button = action_button(
834 format!("stats_user_{}", user.id),844 format!("stats_user_{}", user.id),
835 IconName::Activity,845 IconName::Activity,
836- "Stats",846+ w().builder_users.stats,
837- "Live connection and machine stats",847+ w().builder_users.stats_tip,
838 if stats_open.is_some() {848 if stats_open.is_some() {
839 palette.text849 palette.text
840 } else {850 } else {
@@ -849,8 +859,8 @@ impl Yumush {
849 let password_button = action_button(859 let password_button = action_button(
850 format!("password_user_{}", user.id),860 format!("password_user_{}", user.id),
851 IconName::KeyRound,861 IconName::KeyRound,
852- "Password",862+ w().builder_users.password,
853- "Set a new password",863+ w().builder_users.password_tip,
854 tone,864 tone,
855 palette,865 palette,
856 entity_action(entity, move |yumush, _, cx| {866 entity_action(entity, move |yumush, _, cx| {
@@ -865,7 +875,7 @@ impl Yumush {
865 yumush.toggle_builder_sessions(sessions_list_id, window, cx)875 yumush.toggle_builder_sessions(sessions_list_id, window, cx)
866 }),876 }),
867 )877 )
868- .tip("Manage")878+ .tip(w().builder_users.manage)
869 .size(px(size::CONTROL_SM))879 .size(px(size::CONTROL_SM))
870 .flex_shrink_0()880 .flex_shrink_0()
871 .flex()881 .flex()
@@ -879,8 +889,8 @@ impl Yumush {
879 let rename_button = action_button(889 let rename_button = action_button(
880 format!("rename_user_{}", user.id),890 format!("rename_user_{}", user.id),
881 IconName::Pencil,891 IconName::Pencil,
882- "Rename",892+ w().builder_users.rename,
883- "Change username",893+ w().builder_users.rename_tip,
884 tone,894 tone,
885 palette,895 palette,
886 entity_action(entity, move |yumush, _, cx| {896 entity_action(entity, move |yumush, _, cx| {
@@ -891,8 +901,8 @@ impl Yumush {
891 let timeout_button = action_button(901 let timeout_button = action_button(
892 format!("timeout_user_{}", user.id),902 format!("timeout_user_{}", user.id),
893 IconName::Timer,903 IconName::Timer,
894- "Timeout",904+ w().builder_users.timeout,
895- "Block sign in for a while",905+ w().builder_users.timeout_tip,
896 tone,906 tone,
897 palette,907 palette,
898 entity_action(entity, move |yumush, _, cx| {908 entity_action(entity, move |yumush, _, cx| {
@@ -903,8 +913,8 @@ impl Yumush {
903 let ban_button = action_button(913 let ban_button = action_button(
904 format!("ban_user_{}", user.id),914 format!("ban_user_{}", user.id),
905 IconName::Ban,915 IconName::Ban,
906- "Ban",916+ w().builder_users.ban,
907- "Ban username or IP from the server",917+ w().builder_users.ban_tip,
908 tone,918 tone,
909 palette,919 palette,
910 entity_action(entity, move |yumush, _, cx| {920 entity_action(entity, move |yumush, _, cx| {
@@ -915,8 +925,8 @@ impl Yumush {
915 let profile_button = action_button(925 let profile_button = action_button(
916 format!("profile_user_{}", user.id),926 format!("profile_user_{}", user.id),
917 IconName::Eraser,927 IconName::Eraser,
918- "Clear profile",928+ w().builder_users.clear_profile,
919- "Remove avatar and status",929+ w().builder_users.clear_profile_tip,
920 palette.danger,930 palette.danger,
921 palette,931 palette,
922 entity_action(entity, move |yumush, window, cx| {932 entity_action(entity, move |yumush, window, cx| {
@@ -927,8 +937,8 @@ impl Yumush {
927 let purge_button = confirm_button(937 let purge_button = confirm_button(
928 format!("purge_user_{}", user.id),938 format!("purge_user_{}", user.id),
929 IconName::MessageSquareX,939 IconName::MessageSquareX,
930- "Purge",940+ w().builder_users.purge,
931- "Delete all their messages",941+ w().builder_users.purge_tip,
932 pending_purge,942 pending_purge,
933 palette,943 palette,
934 entity_action(entity, move |yumush, window, cx| {944 entity_action(entity, move |yumush, window, cx| {
@@ -939,8 +949,8 @@ impl Yumush {
939 let delete_button = confirm_button(949 let delete_button = confirm_button(
940 format!("delete_user_{}", user.id),950 format!("delete_user_{}", user.id),
941 IconName::UserX,951 IconName::UserX,
942- "Delete",952+ w().builder_users.delete,
943- "Delete the account",953+ w().builder_users.delete_tip,
944 pending_delete,954 pending_delete,
945 palette,955 palette,
946 entity_action(entity, move |yumush, window, cx| {956 entity_action(entity, move |yumush, window, cx| {
@@ -990,17 +1000,33 @@ impl Yumush {
990 .text_color(palette.text)1000 .text_color(palette.text)
991 .child(user.username.clone()),1001 .child(user.username.clone()),
992 ))1002 ))
993- .when(builder, |this| {1003+ .when(user.role == Role::Builder, |this| {
994- this.child(status("Builder", palette.accent, palette))1004+ this.child(status(
1005+ w().builder_users.tag_builder,
1006+ palette.accent,
1007+ palette,
1008+ ))
995 })1009 })
996 .when(suspended, |this| {1010 .when(suspended, |this| {
997- this.child(status("Suspended", palette.danger, palette))1011+ this.child(status(
1012+ w().builder_users.tag_suspended,
1013+ palette.danger,
1014+ palette,
1015+ ))
998 })1016 })
999 .when(timed_out, |this| {1017 .when(timed_out, |this| {
1000- this.child(status("Timed out", palette.danger, palette))1018+ this.child(status(
1019+ w().builder_users.tag_timed_out,
1020+ palette.danger,
1021+ palette,
1022+ ))
1001 })1023 })
1002 .when(account.ghost, |this| {1024 .when(account.ghost, |this| {
1003- this.child(status("Ghost", palette.muted, palette))1025+ this.child(status(
1026+ w().builder_users.tag_ghost,
1027+ palette.muted,
1028+ palette,
1029+ ))
1004 }),1030 }),
1005 )1031 )
1006 .child(1032 .child(
@@ -1009,7 +1035,7 @@ impl Yumush {
1009 .truncate()1035 .truncate()
1010 .text_size(text(text::CAPTION))1036 .text_size(text(text::CAPTION))
1011 .text_color(palette.muted)1037 .text_color(palette.muted)
1012- .child(format!("joined {joined} · seen {seen}")),1038+ .child(w().builder_users.joined_seen(joined, seen)),
1013 ),1039 ),
1014 )1040 )
1015 .children(has_actions.then_some(toggle_button));1041 .children(has_actions.then_some(toggle_button));
@@ -1056,7 +1082,7 @@ impl Yumush {
1056 .border_t_1()1082 .border_t_1()
1057 .border_color(palette.border)1083 .border_color(palette.border)
1058 .children(action_group(1084 .children(action_group(
1059- "Account",1085+ w().builder_users.group_account,
1060 palette,1086 palette,
1061 account_actions.into_iter().flatten().collect(),1087 account_actions.into_iter().flatten().collect(),
1062 ))1088 ))
@@ -1067,20 +1093,24 @@ impl Yumush {
1067 rename_open.then(|| self.builder_rename_row(user.id, entity, palette, cx)),1093 rename_open.then(|| self.builder_rename_row(user.id, entity, palette, cx)),
1068 )1094 )
1069 .children(action_group(1095 .children(action_group(
1070- "Moderation",1096+ w().builder_users.group_moderation,
1071 palette,1097 palette,
1072 moderation_actions.into_iter().flatten().collect(),1098 moderation_actions.into_iter().flatten().collect(),
1073 ))1099 ))
1074 .children(timeout_open.then(|| self.builder_timeout_row(user.id, entity, palette)))1100 .children(timeout_open.then(|| self.builder_timeout_row(user.id, entity, palette)))
1075 .children(ban_open.then(|| self.builder_ban_row(user.id, entity, palette)))1101 .children(ban_open.then(|| self.builder_ban_row(user.id, entity, palette)))
1076 .children(action_group(1102 .children(action_group(
1077- "Danger",1103+ w().builder_users.group_danger,
1078 palette,1104 palette,
1079 danger_actions.into_iter().flatten().collect(),1105 danger_actions.into_iter().flatten().collect(),
1080 ))1106 ))
1081- .children(action_group("Sessions", palette, sessions))
1082 .children(action_group(1107 .children(action_group(
1083- "Friends",1108+ w().builder_users.group_sessions,
1109+ palette,
1110+ sessions,
1111+ ))
1112+ .children(action_group(
1113+ w().builder_users.group_friends,
1084 palette,1114 palette,
1085 self.chat1115 self.chat
1086 .builder_friends1116 .builder_friends
crates/client/src/gui/builder/voice.rsmodified+17 -8
@@ -18,6 +18,7 @@ use crate::{
18 style::{self, size, space},18 style::{self, size, space},
19 text,19 text,
20 },20 },
21+ lang::w,
21 net::{Fail, NetworkHandle},22 net::{Fail, NetworkHandle},
22 };23 };
23 24
@@ -82,7 +83,7 @@ impl Yumush {
82 83
83 if self.chat.builder_voice_rooms.is_empty() {84 if self.chat.builder_voice_rooms.is_empty() {
84 body.push(85 body.push(
85- list_card(None, Vec::new(), "No active voice rooms", palette).into_any_element(),86+ list_card(None, Vec::new(), w().builder_voice.no_rooms, palette).into_any_element(),
86 );87 );
87 }88 }
88 body.extend(self.chat.builder_voice_rooms.iter().map(|room| {89 body.extend(self.chat.builder_voice_rooms.iter().map(|room| {
@@ -116,7 +117,7 @@ impl Yumush {
116 icon_button(117 icon_button(
117 format!("room_join_{id}"),118 format!("room_join_{id}"),
118 IconName::Headphones,119 IconName::Headphones,
119- "Join",120+ w().builder_voice.join,
120 palette.ok,121 palette.ok,
121 palette,122 palette,
122 entity_action(entity, move |yumush, window, cx| {123 entity_action(entity, move |yumush, window, cx| {
@@ -135,7 +136,11 @@ impl Yumush {
135 } else {136 } else {
136 IconName::PhoneOff137 IconName::PhoneOff
137 },138 },
138- if enabled { "Voice on" } else { "Voice off" },139+ if enabled {
140+ w().builder_voice.voice_on
141+ } else {
142+ w().builder_voice.voice_off
143+ },
139 palette.muted,144 palette.muted,
140 palette,145 palette,
141 entity_action(entity, move |yumush, window, cx| {146 entity_action(entity, move |yumush, window, cx| {
@@ -162,7 +167,7 @@ impl Yumush {
162 167
163 card(palette)168 card(palette)
164 .child(card_header(&room.community, actions, palette))169 .child(card_header(&room.community, actions, palette))
165- .child(rows_body(rows, "No users", palette))170+ .child(rows_body(rows, w().builder_voice.no_users, palette))
166 }171 }
167 172
168 pub(super) fn voice_user_row(173 pub(super) fn voice_user_row(
@@ -210,8 +215,8 @@ impl Yumush {
210 ),215 ),
211 )),216 )),
212 )217 )
213- .children(muted.then(|| pill("Muted", palette.danger, palette)))218+ .children(muted.then(|| pill(w().builder_voice.muted, palette.danger, palette)))
214- .children(ghost.then(|| pill("Ghost", palette.muted, palette)))219+ .children(ghost.then(|| pill(w().builder_voice.ghost, palette.muted, palette)))
215 .child(icon_button(220 .child(icon_button(
216 format!("voice_mute_{id}_{muted}"),221 format!("voice_mute_{id}_{muted}"),
217 if muted {222 if muted {
@@ -219,7 +224,11 @@ impl Yumush {
219 } else {224 } else {
220 IconName::MicOff225 IconName::MicOff
221 },226 },
222- if muted { "Unmute" } else { "Mute" },227+ if muted {
228+ w().builder_voice.unmute
229+ } else {
230+ w().builder_voice.mute
231+ },
223 palette.muted,232 palette.muted,
224 palette,233 palette,
225 entity_action(entity, move |yumush, window, cx| {234 entity_action(entity, move |yumush, window, cx| {
@@ -229,7 +238,7 @@ impl Yumush {
229 .child(icon_button(238 .child(icon_button(
230 format!("voice_kick_{id}"),239 format!("voice_kick_{id}"),
231 IconName::UserX,240 IconName::UserX,
232- "Kick",241+ w().builder_voice.kick,
233 palette.danger,242 palette.danger,
234 palette,243 palette,
235 entity_action(entity, move |yumush, window, cx| {244 entity_action(entity, move |yumush, window, cx| {
crates/client/src/gui/call_bar.rsmodified+18 -9
@@ -11,6 +11,7 @@ use super::{
11 parts::{Ink, Text, Tone, Voice, band, icon_button, thread, voice_line, words},11 parts::{Ink, Text, Tone, Voice, band, icon_button, thread, voice_line, words},
12 style::{Tokens, size, space},12 style::{Tokens, size, space},
13 };13 };
14+use crate::lang::w;
14 15
15 pub type Action = Rc<dyn Fn(&mut Window, &mut App)>;16 pub type Action = Rc<dyn Fn(&mut Window, &mut App)>;
16 17
@@ -77,7 +78,11 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
77 } else {78 } else {
78 IconName::Mic79 IconName::Mic
79 },80 },
80- if bar.muted { "Unmute" } else { "Mute" },81+ if bar.muted {
82+ w().call_bar.unmute
83+ } else {
84+ w().call_bar.mute
85+ },
81 alarm(bar.muted),86 alarm(bar.muted),
82 t,87 t,
83 run(&actions.mute),88 run(&actions.mute),
@@ -90,7 +95,11 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
90 } else {95 } else {
91 IconName::Headphones96 IconName::Headphones
92 },97 },
93- if bar.deafened { "Undeafen" } else { "Deafen" },98+ if bar.deafened {
99+ w().call_bar.undeafen
100+ } else {
101+ w().call_bar.deafen
102+ },
94 alarm(bar.deafened),103 alarm(bar.deafened),
95 t,104 t,
96 run(&actions.deafen),105 run(&actions.deafen),
@@ -101,9 +110,9 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
101 format!("bar_camera_{}", bar.camera),110 format!("bar_camera_{}", bar.camera),
102 IconName::Video,111 IconName::Video,
103 if bar.camera {112 if bar.camera {
104- "Turn off camera"113+ w().call_bar.turn_off_camera
105 } else {114 } else {
106- "Turn on camera"115+ w().call_bar.turn_on_camera
107 },116 },
108 tone(bar.camera),117 tone(bar.camera),
109 t,118 t,
@@ -114,9 +123,9 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
114 format!("bar_screen_{}", bar.screen),123 format!("bar_screen_{}", bar.screen),
115 IconName::ScreenShare,124 IconName::ScreenShare,
116 if bar.screen {125 if bar.screen {
117- "Stop sharing"126+ w().call_bar.stop_sharing
118 } else {127 } else {
119- "Share screen"128+ w().call_bar.share_screen
120 },129 },
121 tone(bar.screen),130 tone(bar.screen),
122 t,131 t,
@@ -127,7 +136,7 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
127 .child(icon_button(136 .child(icon_button(
128 "bar_leave",137 "bar_leave",
129 IconName::PhoneOff,138 IconName::PhoneOff,
130- "Leave call",139+ w().call_bar.leave_call,
131 Tone::Danger,140 Tone::Danger,
132 t,141 t,
133 run(&actions.leave),142 run(&actions.leave),
@@ -150,7 +159,7 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
150 move |style| style.bg(hov)159 move |style| style.bg(hov)
151 })160 })
152 .cursor_pointer()161 .cursor_pointer()
153- .tip("Go to call")162+ .tip(w().call_bar.go_to_call)
154 .on_click({163 .on_click({
155 let go = run(&actions.go);164 let go = run(&actions.go);
156 move |_, window, cx| go(window, cx)165 move |_, window, cx| go(window, cx)
@@ -191,7 +200,7 @@ pub fn view(bar: CallBar, actions: CallActions, t: Tokens) -> Div {
191 move |style| style.bg(hov)200 move |style| style.bg(hov)
192 })201 })
193 .cursor_pointer()202 .cursor_pointer()
194- .tip("Connection stats")203+ .tip(w().call_bar.connection_stats)
195 .on_click(move |_, window, cx| stats(window, cx))204 .on_click(move |_, window, cx| stats(window, cx))
196 .child(205 .child(
197 div()206 div()
crates/client/src/gui/camera_view.rsmodified+15 -7
@@ -18,6 +18,7 @@ use super::{
18 surface::Surface,18 surface::Surface,
19 widget::spawn_warn,19 widget::spawn_warn,
20 };20 };
21+use crate::lang::w;
21 use crate::share::session::WatchQuality;22 use crate::share::session::WatchQuality;
22 23
23 const SLOTS: usize = 6;24 const SLOTS: usize = 6;
@@ -310,10 +311,13 @@ impl Yumush {
310 )311 )
311 }))312 }))
312 })313 })
313- .chain(314+ .chain((more > 0).then(|| {
314- (more > 0)315+ caption(
315- .then(|| caption(format!("{more} more"), voice_line(None, Voice::Quiet, t), t)),316+ w().camera_view.more(more),
316- )317+ voice_line(None, Voice::Quiet, t),
318+ t,
319+ )
320+ }))
317 .collect()321 .collect()
318 }322 }
319 323
@@ -485,7 +489,7 @@ fn stage_tile(
485 489
486 div()490 div()
487 .id(format!("stage_{user_id}_{kind:?}"))491 .id(format!("stage_{user_id}_{kind:?}"))
488- .tip("Watch")492+ .tip(w().camera_view.watch)
489 .cursor_pointer()493 .cursor_pointer()
490 .flex()494 .flex()
491 .flex_col()495 .flex_col()
@@ -543,7 +547,11 @@ fn more_tile(entity: &Entity<Yumush>, more: usize, palette: Palette) -> impl Int
543 .bg(t.raise())547 .bg(t.raise())
544 .child(words(format!("+{more}"), Text::Title, Ink::Paper, t)),548 .child(words(format!("+{more}"), Text::Title, Ink::Paper, t)),
545 )549 )
546- .child(caption("screens", voice_line(None, Voice::Quiet, t), t))550+ .child(caption(
551+ w().camera_view.screens,
552+ voice_line(None, Voice::Quiet, t),
553+ t,
554+ ))
547 }555 }
548 556
549 fn grid_cell(557 fn grid_cell(
@@ -575,7 +583,7 @@ fn grid_cell(
575 .flex_col()583 .flex_col()
576 .gap(px(space::SM))584 .gap(px(space::SM))
577 .cursor_pointer()585 .cursor_pointer()
578- .tip("Watch")586+ .tip(w().camera_view.watch)
579 .on_click(move |_, window, cx| {587 .on_click(move |_, window, cx| {
580 entity.update(cx, |yumush, cx| {588 entity.update(cx, |yumush, cx| {
581 yumush.toggle_viewer(user_id, kind, window, cx)589 yumush.toggle_viewer(user_id, kind, window, cx)
crates/client/src/gui/chat.rsmodified+193 -144
@@ -2,6 +2,7 @@ use super::style::{self, radius, size, space, stroke, text};
2 use super::text;2 use super::text;
3 use crate::gui::CLOCK;3 use crate::gui::CLOCK;
4 use crate::gui::glyph::Fill as _;4 use crate::gui::glyph::Fill as _;
5+use crate::lang::w;
5 use std::{6 use std::{
6 collections::{BTreeMap, HashMap, HashSet, VecDeque},7 collections::{BTreeMap, HashMap, HashSet, VecDeque},
7 sync::Arc,8 sync::Arc,
@@ -126,7 +127,6 @@ pub enum CardMenu {
126 Main,127 Main,
127 More,128 More,
128 Accounts,129 Accounts,
129- Presence,
130 Status,130 Status,
131 }131 }
132 132
@@ -310,7 +310,7 @@ impl Chat {
310 let mut state = TextareaState::new(window, cx)310 let mut state = TextareaState::new(window, cx)
311 .auto_grow(1, 10)311 .auto_grow(1, 10)
312 .submit_on_enter(true);312 .submit_on_enter(true);
313- state.set_placeholder("Message", window, cx);313+ state.set_placeholder(w().chat.message, window, cx);
314 state314 state
315 });315 });
316 cx.subscribe_in(316 cx.subscribe_in(
@@ -329,13 +329,14 @@ impl Chat {
329 )329 )
330 .detach();330 .detach();
331 331
332- let jump_input = new_input("Jump to…", window, cx);332+ let jump_input = new_input(w().jump.placeholder, window, cx);
333 cx.subscribe_in(333 cx.subscribe_in(
334 &jump_input,334 &jump_input,
335 window,335 window,
336 |this, _, event, window, cx| match event {336 |this, _, event, window, cx| match event {
337 InputEvent::Change => {337 InputEvent::Change => {
338 this.chat.goto.cursor = 0;338 this.chat.goto.cursor = 0;
339+ this.chat.goto.scroll.scroll_to_item(0);
339 cx.notify();340 cx.notify();
340 }341 }
341 InputEvent::PressEnter { .. } => this.jump_enter(window, cx),342 InputEvent::PressEnter { .. } => this.jump_enter(window, cx),
@@ -344,7 +345,7 @@ impl Chat {
344 )345 )
345 .detach();346 .detach();
346 347
347- let member_input = new_input("Find", window, cx);348+ let member_input = new_input(w().chat.find, window, cx);
348 cx.subscribe_in(&member_input, window, |_, _, event, _, cx| {349 cx.subscribe_in(&member_input, window, |_, _, event, _, cx| {
349 if matches!(event, InputEvent::Change) {350 if matches!(event, InputEvent::Change) {
350 cx.notify();351 cx.notify();
@@ -352,7 +353,7 @@ impl Chat {
352 })353 })
353 .detach();354 .detach();
354 355
355- let search_input = new_input("Find user", window, cx);356+ let search_input = new_input(w().chat.find_user, window, cx);
356 cx.subscribe_in(357 cx.subscribe_in(
357 &search_input,358 &search_input,
358 window,359 window,
@@ -364,7 +365,7 @@ impl Chat {
364 )365 )
365 .detach();366 .detach();
366 367
367- let community_search = new_input("Search messages", window, cx);368+ let community_search = new_input(w().chat.search_messages, window, cx);
368 cx.subscribe_in(&community_search, window, |this, _, event, window, cx| {369 cx.subscribe_in(&community_search, window, |this, _, event, window, cx| {
369 if matches!(event, InputEvent::PressEnter { .. }) {370 if matches!(event, InputEvent::PressEnter { .. }) {
370 this.search_community(window, cx);371 this.search_community(window, cx);
@@ -372,12 +373,12 @@ impl Chat {
372 })373 })
373 .detach();374 .detach();
374 375
375- let ban_search = new_input("Search...", window, cx);376+ let ban_search = new_input(w().chat.search, window, cx);
376- let log_search = new_input("Search...", window, cx);377+ let log_search = new_input(w().chat.search, window, cx);
377- let builder_search = new_input("Search...", window, cx);378+ let builder_search = new_input(w().chat.search, window, cx);
378- let builder_password = new_input("New password...", window, cx);379+ let builder_password = new_input(w().chat.new_password, window, cx);
379 builder_password.update(cx, |input, cx| input.set_masked(true, window, cx));380 builder_password.update(cx, |input, cx| input.set_masked(true, window, cx));
380- let new_password = new_input("Password...", window, cx);381+ let new_password = new_input(w().chat.password, window, cx);
381 new_password.update(cx, |input, cx| input.set_masked(true, window, cx));382 new_password.update(cx, |input, cx| input.set_masked(true, window, cx));
382 for search in [&ban_search, &log_search, &builder_search] {383 for search in [&ban_search, &log_search, &builder_search] {
383 cx.subscribe_in(search, window, |_, _, event, window, cx| {384 cx.subscribe_in(search, window, |_, _, event, window, cx| {
@@ -406,7 +407,7 @@ impl Chat {
406 invitations: vec![],407 invitations: vec![],
407 messages: vec![],408 messages: vec![],
408 pins: vec![],409 pins: vec![],
409- poll_question: new_input("Question", window, cx),410+ poll_question: new_input(w().chat.question, window, cx),
410 poll_options: vec![411 poll_options: vec![
411 composer::new_poll_option(window, cx),412 composer::new_poll_option(window, cx),
412 composer::new_poll_option(window, cx),413 composer::new_poll_option(window, cx),
@@ -440,14 +441,14 @@ impl Chat {
440 sidebar_toggled: None,441 sidebar_toggled: None,
441 view: View::Chat,442 view: View::Chat,
442 section: 0,443 section: 0,
443- username_input: editable_input("Username...", Yumush::save_username, window, cx),444+ username_input: editable_input(w().chat.username, Yumush::save_username, window, cx),
444 community_name_input: editable_input(445 community_name_input: editable_input(
445- "Community name...",446+ w().chat.community_name,
446 Yumush::save_community_name,447 Yumush::save_community_name,
447 window,448 window,
448 cx,449 cx,
449 ),450 ),
450- status_input: editable_input("Status...", Yumush::save_status, window, cx),451+ status_input: editable_input(w().chat.status, Yumush::save_status, window, cx),
451 avatars: HashMap::new(),452 avatars: HashMap::new(),
452 avatar_requests: HashSet::new(),453 avatar_requests: HashSet::new(),
453 users: HashMap::new(),454 users: HashMap::new(),
@@ -463,12 +464,12 @@ impl Chat {
463 builder_overview: None,464 builder_overview: None,
464 builder_logs: vec![],465 builder_logs: vec![],
465 builder_stats: vec![],466 builder_stats: vec![],
466- builder_log_actor: new_input("Actor...", window, cx),467+ builder_log_actor: new_input(w().chat.actor, window, cx),
467- builder_log_target: new_input("Target...", window, cx),468+ builder_log_target: new_input(w().chat.target, window, cx),
468 builder_log_action: cx.new(|cx| {469 builder_log_action: cx.new(|cx| {
469 SelectState::new(470 SelectState::new(
470 SearchableVec::new(471 SearchableVec::new(
471- std::iter::once("All")472+ std::iter::once(w().chat.all)
472 .chain(473 .chain(
473 AdminActionKind::ALL474 AdminActionKind::ALL
474 .into_iter()475 .into_iter()
@@ -481,19 +482,19 @@ impl Chat {
481 cx,482 cx,
482 )483 )
483 }),484 }),
484- builder_log_from: new_input("From YYYY-MM-DD", window, cx),485+ builder_log_from: new_input(w().chat.date_from, window, cx),
485- builder_log_to: new_input("To YYYY-MM-DD", window, cx),486+ builder_log_to: new_input(w().chat.date_to, window, cx),
486 builder_search,487 builder_search,
487 builder_communities: vec![],488 builder_communities: vec![],
488 pending_community_delete: None,489 pending_community_delete: None,
489- builder_message_text: new_input("Text...", window, cx),490+ builder_message_text: new_input(w().chat.text, window, cx),
490- builder_message_user: new_input("User...", window, cx),491+ builder_message_user: new_input(w().chat.user, window, cx),
491- builder_message_community: new_input("Community...", window, cx),492+ builder_message_community: new_input(w().chat.community, window, cx),
492- builder_message_from: new_input("From YYYY-MM-DD", window, cx),493+ builder_message_from: new_input(w().chat.date_from, window, cx),
493- builder_message_to: new_input("To YYYY-MM-DD", window, cx),494+ builder_message_to: new_input(w().chat.date_to, window, cx),
494 builder_messages: vec![],495 builder_messages: vec![],
495- builder_attachment_user: new_input("User...", window, cx),496+ builder_attachment_user: new_input(w().chat.user, window, cx),
496- builder_attachment_community: new_input("Community...", window, cx),497+ builder_attachment_community: new_input(w().chat.community, window, cx),
497 builder_usage_users: vec![],498 builder_usage_users: vec![],
498 builder_usage_communities: vec![],499 builder_usage_communities: vec![],
499 builder_attachments: vec![],500 builder_attachments: vec![],
@@ -502,42 +503,42 @@ impl Chat {
502 pending_builder_purge: None,503 pending_builder_purge: None,
503 transfer: None,504 transfer: None,
504 builder_password,505 builder_password,
505- server_name: new_input("Server name...", window, cx),506+ server_name: new_input(w().chat.server_name, window, cx),
506 server_limit: new_input("", window, cx),507 server_limit: new_input("", window, cx),
507 server_user_quota: new_input("", window, cx),508 server_user_quota: new_input("", window, cx),
508 server_community_quota: new_input("", window, cx),509 server_community_quota: new_input("", window, cx),
509 server_message_retention: new_input("", window, cx),510 server_message_retention: new_input("", window, cx),
510 server_attachment_retention: new_input("", window, cx),511 server_attachment_retention: new_input("", window, cx),
511- server_announcement: new_input("Announcement...", window, cx),512+ server_announcement: new_input(w().chat.announcement, window, cx),
512 server_max_communities: new_input("", window, cx),513 server_max_communities: new_input("", window, cx),
513- server_max_message_length: new_input("Max message length...", window, cx),514+ server_max_message_length: new_input(w().chat.max_message_length, window, cx),
514 server_max_avatar: new_input("", window, cx),515 server_max_avatar: new_input("", window, cx),
515 server_messages_per_minute: new_input("", window, cx),516 server_messages_per_minute: new_input("", window, cx),
516 server_logins_per_minute: new_input("", window, cx),517 server_logins_per_minute: new_input("", window, cx),
517 server_registration_open: true,518 server_registration_open: true,
518 server_maintenance: false,519 server_maintenance: false,
519 pending_builder_timeout: None,520 pending_builder_timeout: None,
520- builder_timeout: new_input("Minutes...", window, cx),521+ builder_timeout: new_input(w().chat.minutes, window, cx),
521 pending_builder_ban: None,522 pending_builder_ban: None,
522- builder_ban_reason: new_input("Reason...", window, cx),523+ builder_ban_reason: new_input(w().chat.reason, window, cx),
523 builder_ban_scope: BanScope::Account,524 builder_ban_scope: BanScope::Account,
524 builder_bans: vec![],525 builder_bans: vec![],
525 builder_invites: vec![],526 builder_invites: vec![],
526- invite_uses: new_input("Uses...", window, cx),527+ invite_uses: new_input(w().chat.uses, window, cx),
527- invite_hours: new_input("Hours", window, cx),528+ invite_hours: new_input(w().chat.hours, window, cx),
528 pending_invite_delete: None,529 pending_invite_delete: None,
529- new_username: new_input("Username...", window, cx),530+ new_username: new_input(w().chat.username, window, cx),
530 new_password,531 new_password,
531 pending_builder_password: None,532 pending_builder_password: None,
532 builder_sessions: None,533 builder_sessions: None,
533 builder_friends: Vec::new(),534 builder_friends: Vec::new(),
534 pending_builder_rename: None,535 pending_builder_rename: None,
535- builder_rename: new_input("New username...", window, cx),536+ builder_rename: new_input(w().chat.new_username, window, cx),
536 builder_reports: vec![],537 builder_reports: vec![],
537 report_filter: Some(ReportStatus::Open),538 report_filter: Some(ReportStatus::Open),
538 open_reports: 0,539 open_reports: 0,
539 report: None,540 report: None,
540- report_reason: new_input("Reason...", window, cx),541+ report_reason: new_input(w().chat.reason, window, cx),
541 voice: HashMap::new(),542 voice: HashMap::new(),
542 drafts: HashMap::new(),543 drafts: HashMap::new(),
543 voice_state: VoiceState::Off,544 voice_state: VoiceState::Off,
@@ -551,6 +552,7 @@ impl Chat {
551 open: false,552 open: false,
552 cursor: 0,553 cursor: 0,
553 input: jump_input,554 input: jump_input,
555+ scroll: ScrollHandle::new(),
554 },556 },
555 server_stats: None,557 server_stats: None,
556 server_stats_task: None,558 server_stats_task: None,
@@ -794,13 +796,13 @@ impl Chat {
794 .filter(|(_, at)| at.elapsed() < TYPING_TTL)796 .filter(|(_, at)| at.elapsed() < TYPING_TTL)
795 .map(|(user_id, _)| {797 .map(|(user_id, _)| {
796 self.author(*user_id)798 self.author(*user_id)
797- .map_or("Someone", |user| user.username.as_str())799+ .map_or(w().chat.someone, |user| user.username.as_str())
798 })800 })
799 .collect();801 .collect();
800 match names.as_slice() {802 match names.as_slice() {
801 [] => None,803 [] => None,
802- [name] => Some(format!("{name} is typing…")),804+ [name] => Some(w().chat.typing_one(name)),
803- names => Some(format!("{} people are typing…", names.len())),805+ names => Some(w().chat.typing_many(names.len())),
804 }806 }
805 }807 }
806 808
@@ -1333,7 +1335,7 @@ fn empty_state(palette: Palette) -> impl IntoElement {
1333 .text_size(text(text::CAPTION))1335 .text_size(text(text::CAPTION))
1334 .child(FIND_HINT),1336 .child(FIND_HINT),
1335 )1337 )
1336- .child("Find a user")1338+ .child(w().chat.find_user)
1337 }1339 }
1338 1340
1339 pub(super) fn create_community(1341 pub(super) fn create_community(
@@ -1506,6 +1508,7 @@ impl Yumush {
1506 let name = community.map(community_name).unwrap_or_default();1508 let name = community.map(community_name).unwrap_or_default();
1507 let group =1509 let group =
1508 community.is_some_and(|community| matches!(community.kind, CommunityKind::Group));1510 community.is_some_and(|community| matches!(community.kind, CommunityKind::Group));
1511+ let voice = self.voice_toggle(entity, palette);
1509 1512
1510 div()1513 div()
1511 .h(px(size::ROW + space::MD))1514 .h(px(size::ROW + space::MD))
@@ -1541,11 +1544,9 @@ impl Yumush {
1541 .children(1544 .children(
1542 community1545 community
1543 .is_some()1546 .is_some()
1544- .then(|| self.voice_stack(entity, palette))1547+ .then(|| self.stage_controls(entity, palette))
1545 .flatten(),1548 .flatten(),
1546 )1549 )
1547- .children(self.calling_hint(palette))
1548- .children(self.voice_button(entity, palette))
1549 .children(1550 .children(
1550 community1551 community
1551 .is_some_and(|community| self.chat.joined(community.id))1552 .is_some_and(|community| self.chat.joined(community.id))
@@ -1560,7 +1561,7 @@ impl Yumush {
1560 "members_button",1561 "members_button",
1561 palette,1562 palette,
1562 IconName::Users,1563 IconName::Users,
1563- "People",1564+ w().chat.people,
1564 entity_action(entity, |yumush, _, cx| {1565 entity_action(entity, |yumush, _, cx| {
1565 yumush.chat.members_open = !yumush.chat.members_open;1566 yumush.chat.members_open = !yumush.chat.members_open;
1566 cx.notify();1567 cx.notify();
@@ -1570,6 +1571,15 @@ impl Yumush {
1570 button.text_color(palette.text)1571 button.text_color(palette.text)
1571 })1572 })
1572 }))1573 }))
1574+ .children(self.calling_hint(palette))
1575+ .children(voice.is_some().then(|| {
1576+ div()
1577+ .w(px(stroke::LINE))
1578+ .h(px(size::CHIP))
1579+ .flex_none()
1580+ .bg(palette.tokens.thread())
1581+ }))
1582+ .children(voice)
1573 }1583 }
1574 1584
1575 fn message_area(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement {1585 fn message_area(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement {
@@ -1599,7 +1609,7 @@ impl Yumush {
1599 }1609 }
1600 Some(1610 Some(
1601 accent_bar(palette)1611 accent_bar(palette)
1602- .child(format!("{count} new messages"))1612+ .child(w().chat.new_messages(count))
1603 .child(1613 .child(
1604 div()1614 div()
1605 .flex()1615 .flex()
@@ -1873,7 +1883,7 @@ impl Yumush {
1873 clickable("send_button", palette, move |window, cx| {1883 clickable("send_button", palette, move |window, cx| {
1874 entity.update(cx, |yumush, cx| yumush.submit_composer(&input, window, cx))1884 entity.update(cx, |yumush, cx| yumush.submit_composer(&input, window, cx))
1875 })1885 })
1876- .tip("Send")1886+ .tip(w().chat.send)
1877 .size(px(size::CONTROL_SM))1887 .size(px(size::CONTROL_SM))
1878 .flex()1888 .flex()
1879 .items_center()1889 .items_center()
@@ -1898,6 +1908,12 @@ impl Yumush {
1898 self.stop_playing(cx);1908 self.stop_playing(cx);
1899 self.save_draft(cx);1909 self.save_draft(cx);
1900 self.chat.select(Some(community_id));1910 self.chat.select(Some(community_id));
1911+ if let Some(me) = &self.user
1912+ && self.settings.last_chats.get(&me.id) != Some(&community_id)
1913+ {
1914+ self.settings.last_chats.insert(me.id, community_id);
1915+ crate::settings::save(&self.settings);
1916+ }
1901 self.restore_draft(community_id, window, cx);1917 self.restore_draft(community_id, window, cx);
1902 self.chat.focus(window, cx);1918 self.chat.focus(window, cx);
1903 self.load_members(window, cx);1919 self.load_members(window, cx);
@@ -1978,12 +1994,16 @@ impl Yumush {
1978 yumush.request_social_avatars(cx);1994 yumush.request_social_avatars(cx);
1979 1995
1980 if yumush.chat.selected_community_id.is_none() {1996 if yumush.chat.selected_community_id.is_none() {
1981- let first = yumush1997+ let last = yumush
1982- .chat1998+ .user
1983- .communities1999+ .as_ref()
1984- .first()2000+ .and_then(|me| yumush.settings.last_chats.get(&me.id))
1985- .map(|community| community.id);2001+ .copied();
1986- if let Some(community_id) = first {2002+ let communities = &yumush.chat.communities;
2003+ let start = last
2004+ .filter(|last| communities.iter().any(|community| community.id == *last))
2005+ .or_else(|| communities.first().map(|community| community.id));
2006+ if let Some(community_id) = start {
1987 yumush.select_community(community_id, window, cx);2007 yumush.select_community(community_id, window, cx);
1988 }2008 }
1989 }2009 }
@@ -2451,7 +2471,7 @@ impl Yumush {
2451 let palette = super::palette(cx);2471 let palette = super::palette(cx);
2452 let speak = entity.clone();2472 let speak = entity.clone();
2453 2473
2454- dialog.title("Speak as ghost?").child(2474+ dialog.title(w().chat.ghost_title).child(
2455 div()2475 div()
2456 .flex()2476 .flex()
2457 .flex_col()2477 .flex_col()
@@ -2460,7 +2480,7 @@ impl Yumush {
2460 div()2480 div()
2461 .text_size(text(text::LABEL))2481 .text_size(text(text::LABEL))
2462 .text_color(palette.muted)2482 .text_color(palette.muted)
2463- .child("Everyone in the call will hear you."),2483+ .child(w().chat.ghost_hint),
2464 )2484 )
2465 .child(2485 .child(
2466 div()2486 div()
@@ -2477,7 +2497,7 @@ impl Yumush {
2477 .items_center()2497 .items_center()
2478 .rounded(px(radius::MD))2498 .rounded(px(radius::MD))
2479 .text_color(palette.muted)2499 .text_color(palette.muted)
2480- .child("Cancel"),2500+ .child(w().chat.cancel),
2481 )2501 )
2482 .child(2502 .child(
2483 primary_button(2503 primary_button(
@@ -2493,7 +2513,7 @@ impl Yumush {
2493 .flex()2513 .flex()
2494 .items_center()2514 .items_center()
2495 .rounded(px(radius::MD))2515 .rounded(px(radius::MD))
2496- .child("Speak"),2516+ .child(w().chat.speak),
2497 ),2517 ),
2498 ),2518 ),
2499 )2519 )
@@ -2675,7 +2695,7 @@ impl Yumush {
2675 }2695 }
2676 }2696 }
2677 2697
2678- fn voice_button(&self, entity: &Entity<Self>, palette: Palette) -> Option<impl IntoElement> {2698+ fn voice_toggle(&self, entity: &Entity<Self>, palette: Palette) -> Option<impl IntoElement> {
2679 let community_id = self.chat.selected_community_id?;2699 let community_id = self.chat.selected_community_id?;
2680 let direct = self.is_direct(community_id);2700 let direct = self.is_direct(community_id);
2681 let in_voice = self.chat.in_voice(community_id);2701 let in_voice = self.chat.in_voice(community_id);
@@ -2690,38 +2710,83 @@ impl Yumush {
2690 return None;2710 return None;
2691 }2711 }
2692 2712
2713+ let t = palette.tokens;
2714+ let users = self.voice_users(community_id);
2715+ let speaker = users
2716+ .iter()
2717+ .map(|user| user.id)
2718+ .find(|id| self.chat.waves.speaking.contains(id));
2719+ let (icon, label) = match (direct, in_voice) {
2720+ (true, false) => (IconName::Phone, w().chat.call),
2721+ (true, true) => (IconName::PhoneOff, w().chat.hang_up),
2722+ (false, false) => (IconName::Headphones, w().chat.join),
2723+ (false, true) => (IconName::Headphones, w().chat.leave),
2724+ };
2725+ let ink = if in_voice {
2726+ super::parts::Ink::Bad
2727+ } else if users.is_empty() {
2728+ super::parts::Ink::Dim
2729+ } else {
2730+ super::parts::Ink::Paper
2731+ };
2732+ let voice = match speaker {
2733+ Some(id) => super::parts::Voice::Live(t.person(id)),
2734+ None => super::parts::Voice::Quiet,
2735+ };
2736+ let bands = speaker.and_then(|id| self.chat.waves.voice(id));
2693 let entity = entity.clone();2737 let entity = entity.clone();
2694 let on_click = move |window: &mut Window, cx: &mut App| {2738 let on_click = move |window: &mut Window, cx: &mut App| {
2695 entity.update(cx, |yumush, cx| {2739 entity.update(cx, |yumush, cx| {
2696 yumush.toggle_voice(community_id, window, cx)2740 yumush.toggle_voice(community_id, window, cx)
2697 })2741 })
2698 };2742 };
2699- let (icon, tip) = match (direct, in_voice) {2743+ let hov = t.hov();
2700- (true, false) => (IconName::Phone, "Call"),
2701- (true, true) => (IconName::PhoneOff, "Hang up"),
2702- (false, false) => (IconName::Headphones, "Join voice"),
2703- (false, true) => (IconName::Headphones, "Leave voice"),
2704- };
2705- let id = format!("voice_button_{direct}_{in_voice}");
2706- let color = if in_voice {
2707- palette.danger
2708- } else {
2709- palette.muted
2710- };
2711 2744
2712 Some(2745 Some(
2713- clickable(id, palette, on_click)2746+ div()
2714- .text_color(color)2747+ .id(format!("voice_toggle_{direct}_{in_voice}"))
2715- .tip(tip)2748+ .h(px(size::CONTROL_SM))
2716- .size(px(size::CONTROL_SM))2749+ .px(px(space::MD))
2717 .flex()2750 .flex()
2718 .items_center()2751 .items_center()
2719- .justify_center()2752+ .gap(px(space::SM))
2720- .rounded_full()2753+ .rounded(px(radius::MD))
2721- .child(Icon::new(icon).size(px(size::ICON_SM))),2754+ .cursor_pointer()
2755+ .hover(move |style| style.bg(hov))
2756+ .text_color(ink.color(t))
2757+ .on_click(move |_, window, cx| on_click(window, cx))
2758+ .child(Icon::new(icon).size(px(size::ICON_SM)))
2759+ .when(!users.is_empty(), |this| {
2760+ this.child(
2761+ div()
2762+ .w(px(size::CONTROL * 1.5))
2763+ .h(px(space::LG))
2764+ .child(super::parts::voice_line(bands, voice, t)),
2765+ )
2766+ .children(users.iter().take(3).enumerate().map(|(index, user)| {
2767+ avatar(
2768+ palette,
2769+ user,
2770+ px(size::AVATAR),
2771+ super::text(super::style::text::CAPTION),
2772+ &self.chat.avatars,
2773+ )
2774+ .when(index > 0, |avatar| avatar.ml(px(-space::XS)))
2775+ }))
2776+ })
2777+ .child(super::parts::words(label, super::parts::Text::Ui, ink, t)),
2722 )2778 )
2723 }2779 }
2724 2780
2781+ fn voice_users(&self, community_id: Id) -> Vec<&User> {
2782+ self.chat
2783+ .voice_ids(community_id)
2784+ .iter()
2785+ .filter(|id| !(self.chat.ghost && self.is_me(**id)))
2786+ .filter_map(|id| self.chat.member(*id))
2787+ .collect()
2788+ }
2789+
2725 fn calling_hint(&self, palette: Palette) -> Option<Div> {2790 fn calling_hint(&self, palette: Palette) -> Option<Div> {
2726 let community = self.chat.selected_community()?;2791 let community = self.chat.selected_community()?;
2727 let direct = self.is_direct(community.id);2792 let direct = self.is_direct(community.id);
@@ -2736,7 +2801,7 @@ impl Yumush {
2736 div()2801 div()
2737 .text_color(palette.muted)2802 .text_color(palette.muted)
2738 .text_size(text(text::CAPTION))2803 .text_size(text(text::CAPTION))
2739- .child("Calling…")2804+ .child(w().chat.calling)
2740 })2805 })
2741 }2806 }
2742 2807
@@ -2752,7 +2817,7 @@ impl Yumush {
2752 .items_center()2817 .items_center()
2753 .gap(px(space::SM))2818 .gap(px(space::SM))
2754 .child(Icon::new(IconName::PhoneIncoming).size(px(size::ICON_SM)))2819 .child(Icon::new(IconName::PhoneIncoming).size(px(size::ICON_SM)))
2755- .child(format!("{} is calling", caller.username)),2820+ .child(w().chat.is_calling(&caller.username)),
2756 )2821 )
2757 .child(2822 .child(
2758 div()2823 div()
@@ -2770,7 +2835,7 @@ impl Yumush {
2770 .font_weight(FontWeight::MEDIUM)2835 .font_weight(FontWeight::MEDIUM)
2771 .px(px(space::SM))2836 .px(px(space::SM))
2772 .rounded(px(radius::SM))2837 .rounded(px(radius::SM))
2773- .child("Accept"),2838+ .child(w().chat.accept),
2774 )2839 )
2775 .child(2840 .child(
2776 clickable(2841 clickable(
@@ -2784,7 +2849,7 @@ impl Yumush {
2784 .font_weight(FontWeight::MEDIUM)2849 .font_weight(FontWeight::MEDIUM)
2785 .px(px(space::SM))2850 .px(px(space::SM))
2786 .rounded(px(radius::SM))2851 .rounded(px(radius::SM))
2787- .child("Decline"),2852+ .child(w().chat.decline),
2788 ),2853 ),
2789 ),2854 ),
2790 )2855 )
@@ -2861,61 +2926,42 @@ impl Yumush {
2861 });2926 });
2862 }2927 }
2863 2928
2864- fn voice_stack(&self, entity: &Entity<Self>, palette: Palette) -> Option<impl IntoElement> {2929+ fn stage_controls(&self, entity: &Entity<Self>, palette: Palette) -> Option<impl IntoElement> {
2865 let community_id = self.chat.selected_community_id?;2930 let community_id = self.chat.selected_community_id?;
2866- let users: Vec<&User> = self2931+ if self.voice_users(community_id).is_empty() || !self.in_stage_chat() {
2867- .chat
2868- .voice_ids(community_id)
2869- .iter()
2870- .filter(|id| !(self.chat.ghost && self.is_me(**id)))
2871- .filter_map(|id| self.chat.member(*id))
2872- .collect();
2873- if users.is_empty() {
2874 return None;2932 return None;
2875 }2933 }
2876 let current = self.chat.stage;2934 let current = self.chat.stage;
2877 2935
2878 Some(2936 Some(
2879 div()2937 div()
2938+ .ml(px(space::SM))
2880 .flex()2939 .flex()
2881 .items_center()2940 .items_center()
2882- .gap(px(space::SM))2941+ .gap(px(space::XXS))
2883- .when(!self.is_direct(community_id), |stack| {2942+ .child(stage_button(
2884- stack.child(2943+ entity,
2885- div()2944+ palette,
2886- .text_size(text(text::LABEL))2945+ Stage::Strip,
2887- .text_color(palette.muted)2946+ current == Stage::Strip,
2888- .child(format!("{} in call", users.len())),2947+ IconName::GalleryHorizontal,
2889- )2948+ "Strip",
2890- })2949+ w().chat.strip,
2891- .children(self.in_stage_chat().then(|| {2950+ ))
2892- div()2951+ .child(stage_button(
2893- .ml(px(space::SM))2952+ entity,
2894- .flex()2953+ palette,
2895- .items_center()2954+ Stage::Grid,
2896- .gap(px(space::XXS))2955+ current == Stage::Grid,
2897- .child(stage_button(2956+ IconName::LayoutGrid,
2898- entity,2957+ "Grid",
2899- palette,2958+ w().chat.grid,
2900- Stage::Strip,2959+ ))
2901- current == Stage::Strip,2960+ .child(stats_button(
2902- IconName::GalleryHorizontal,2961+ entity,
2903- "Strip",2962+ palette,
2904- ))2963+ self.chat.stats_at == Some(StatsAt::Header),
2905- .child(stage_button(2964+ )),
2906- entity,
2907- palette,
2908- Stage::Grid,
2909- current == Stage::Grid,
2910- IconName::LayoutGrid,
2911- "Grid",
2912- ))
2913- .child(stats_button(
2914- entity,
2915- palette,
2916- self.chat.stats_at == Some(StatsAt::Header),
2917- ))
2918- })),
2919 )2965 )
2920 }2966 }
2921 }2967 }
@@ -3065,9 +3111,9 @@ fn members_column(
3065 .border_l_1()3111 .border_l_1()
3066 .border_color(palette.border)3112 .border_color(palette.border)
3067 .child(super::sidebar::input_box(&chat.member_input, palette))3113 .child(super::sidebar::input_box(&chat.member_input, palette))
3068- .children(section("In call", in_call))3114+ .children(section(w().chat.in_call, in_call))
3069- .children(section("Online", online))3115+ .children(section(w().chat.online, online))
3070- .children(section("Offline", offline)),3116+ .children(section(w().chat.offline, offline)),
3071 )3117 )
3072 }3118 }
3073 3119
@@ -3112,7 +3158,7 @@ fn new_divider(palette: Palette) -> impl IntoElement {
3112 div()3158 div()
3113 .text_size(text(text::CAPTION))3159 .text_size(text(text::CAPTION))
3114 .text_color(palette.accent)3160 .text_color(palette.accent)
3115- .child("New"),3161+ .child(w().chat.new),
3116 )3162 )
3117 }3163 }
3118 3164
@@ -3163,7 +3209,7 @@ fn render_call(
3163 let mine = me.is_some_and(|me| me.id == message.user_id);3209 let mine = me.is_some_and(|me| me.id == message.user_id);
3164 let author = chat3210 let author = chat
3165 .author(message.user_id)3211 .author(message.user_id)
3166- .map_or("unknown", |user| user.username.as_str());3212+ .map_or(w().chat.unknown, |user| user.username.as_str());
3167 let message_id = message.id;3213 let message_id = message.id;
3168 let entity = entity.clone();3214 let entity = entity.clone();
3169 let toggle = match run {3215 let toggle = match run {
@@ -3171,7 +3217,7 @@ fn render_call(
3171 CallRun::Folded(calls) => Some(3217 CallRun::Folded(calls) => Some(
3172 div()3218 div()
3173 .hover(|style| style.underline())3219 .hover(|style| style.underline())
3174- .child(format!("\u{a0}· {calls} calls")),3220+ .child(format!("\u{a0}· {}", w().chat.calls(calls))),
3175 ),3221 ),
3176 CallRun::Open => Some(3222 CallRun::Open => Some(
3177 div()3223 div()
@@ -3204,18 +3250,20 @@ fn render_call(
3204 }3250 }
3205 3251
3206 pub(super) fn call_line(call: CallLog, author: &str, mine: bool, palette: Palette) -> Div {3252 pub(super) fn call_line(call: CallLog, author: &str, mine: bool, palette: Palette) -> Div {
3207- let who = if mine { "You" } else { author };3253+ let w = &w().chat;
3208 let (icon, color) = match call {3254 let (icon, color) = match call {
3209 CallLog::Started | CallLog::Ended { .. } => (IconName::Phone, palette.muted),3255 CallLog::Started | CallLog::Ended { .. } => (IconName::Phone, palette.muted),
3210 CallLog::Declined => (IconName::PhoneOff, palette.danger),3256 CallLog::Declined => (IconName::PhoneOff, palette.danger),
3211 CallLog::Missed => (IconName::PhoneMissed, palette.danger),3257 CallLog::Missed => (IconName::PhoneMissed, palette.danger),
3212 };3258 };
3213 let label = match call {3259 let label = match call {
3214- CallLog::Started => format!("{who} started a call"),3260+ CallLog::Started if mine => w.call_started_mine.to_string(),
3215- CallLog::Declined => format!("{who} declined the call"),3261+ CallLog::Started => w.call_started(author),
3216- CallLog::Missed if mine => "You called, no answer".to_string(),3262+ CallLog::Declined if mine => w.call_declined_mine.to_string(),
3217- CallLog::Missed => format!("Missed call from {author}"),3263+ CallLog::Declined => w.call_declined(author),
3218- CallLog::Ended { seconds } => format!("Call ended · {}", call_duration(seconds)),3264+ CallLog::Missed if mine => w.call_missed_mine.to_string(),
3265+ CallLog::Missed => w.call_missed(author),
3266+ CallLog::Ended { seconds } => w.call_ended(call_duration(seconds)),
3219 };3267 };
3220 div()3268 div()
3221 .relative()3269 .relative()
@@ -3258,7 +3306,7 @@ fn render_message(
3258 );3306 );
3259 }3307 }
3260 let author = chat.author(message.user_id);3308 let author = chat.author(message.user_id);
3261- let username = author.map_or("unknown", |user| user.username.as_str());3309+ let username = author.map_or(w().chat.unknown, |user| user.username.as_str());
3262 let name = div().flex().items_center().gap(px(space::SM)).child(3310 let name = div().flex().items_center().gap(px(space::SM)).child(
3263 div()3311 div()
3264 .id(format!("author_name_{}", message.id))3312 .id(format!("author_name_{}", message.id))
@@ -3376,7 +3424,7 @@ fn render_message(
3376 div()3424 div()
3377 .text_size(text(text::CAPTION))3425 .text_size(text(text::CAPTION))
3378 .text_color(palette.muted)3426 .text_color(palette.muted)
3379- .child("(edited)"),3427+ .child(w().chat.edited),
3380 )3428 )
3381 }),3429 }),
3382 )3430 )
@@ -3484,9 +3532,9 @@ fn stats_button(entity: &Entity<Yumush>, palette: Palette, open: bool) -> impl I
3484 }),3532 }),
3485 )3533 )
3486 .tip(if open {3534 .tip(if open {
3487- "Hide connection stats"3535+ w().chat.stats_hide
3488 } else {3536 } else {
3489- "Connection stats"3537+ w().chat.stats
3490 })3538 })
3491 .size(px(size::CONTROL_SM))3539 .size(px(size::CONTROL_SM))
3492 .flex()3540 .flex()
@@ -3505,6 +3553,7 @@ fn stage_button(
3505 active: bool,3553 active: bool,
3506 icon: IconName,3554 icon: IconName,
3507 name: &'static str,3555 name: &'static str,
3556+ label: &'static str,
3508 ) -> impl IntoElement {3557 ) -> impl IntoElement {
3509 clickable(3558 clickable(
3510 format!("stage_{name}_{active}"),3559 format!("stage_{name}_{active}"),
@@ -3514,7 +3563,7 @@ fn stage_button(
3514 yumush.set_stage(next, cx)3563 yumush.set_stage(next, cx)
3515 }),3564 }),
3516 )3565 )
3517- .tip(if active { "Hide" } else { name })3566+ .tip(if active { w().chat.hide } else { label })
3518 .size(px(size::CONTROL_SM))3567 .size(px(size::CONTROL_SM))
3519 .flex()3568 .flex()
3520 .items_center()3569 .items_center()
crates/client/src/gui/community_settings.rsmodified+91 -66
@@ -1,3 +1,4 @@
1+use crate::lang::{Label as _, w};
1 use common::model::Id;2 use common::model::Id;
2 use std::{collections::HashMap, sync::Arc};3 use std::{collections::HashMap, sync::Arc};
3 4
@@ -24,7 +25,7 @@ use gpui_kit::{
24 };25 };
25 26
26 use super::{27 use super::{
27- Palette, STAMP, Yumush, avatar,28+ Palette, Yumush, avatar,
28 chat::View,29 chat::View,
29 clickable, community_icon, entity_action, millis_time, notify_error,30 clickable, community_icon, entity_action, millis_time, notify_error,
30 profile::user_link,31 profile::user_link,
@@ -50,13 +51,22 @@ pub(super) enum LogSort {
50 Oldest,51 Oldest,
51 }52 }
52 53
53-const BAN_SORTS: [(BanSort, &str); 3] = [54+fn ban_sorts() -> [(BanSort, &'static str, &'static str); 3] {
54- (BanSort::Newest, "Newest"),55+ let w = &w().community_settings;
55- (BanSort::Oldest, "Oldest"),56+ [
56- (BanSort::Name, "Name"),57+ (BanSort::Newest, "newest", w.newest),
57-];58+ (BanSort::Oldest, "oldest", w.oldest),
59+ (BanSort::Name, "name", w.name),
60+ ]
61+}
58 62
59-const LOG_SORTS: [(LogSort, &str); 2] = [(LogSort::Newest, "Newest"), (LogSort::Oldest, "Oldest")];63+fn log_sorts() -> [(LogSort, &'static str, &'static str); 2] {
64+ let w = &w().community_settings;
65+ [
66+ (LogSort::Newest, "newest", w.newest),
67+ (LogSort::Oldest, "oldest", w.oldest),
68+ ]
69+}
60 70
61 fn apply_community(71 fn apply_community(
62 this: &WeakEntity<Yumush>,72 this: &WeakEntity<Yumush>,
@@ -92,7 +102,7 @@ impl Yumush {
92 102
93 if let Some(community) = community.filter(|_| permission::can_rename_community(actor)) {103 if let Some(community) = community.filter(|_| permission::can_rename_community(actor)) {
94 sections.push(Section(104 sections.push(Section(
95- "Profile",105+ w().community_settings.profile,
96 picture_card(106 picture_card(
97 Picture {107 Picture {
98 id: "community_picture_picker",108 id: "community_picture_picker",
@@ -117,12 +127,12 @@ impl Yumush {
117 }127 }
118 if permission::can_rename_community(actor) {128 if permission::can_rename_community(actor) {
119 sections.push(section(129 sections.push(section(
120- "General",130+ w().community_settings.general,
121 palette,131 palette,
122 vec![text_row(132 vec![text_row(
123 Editable {133 Editable {
124 id: "save_community_name_button",134 id: "save_community_name_button",
125- label: "Name",135+ label: w().community_settings.name,
126 input: &self.chat.community_name_input,136 input: &self.chat.community_name_input,
127 current: &name,137 current: &name,
128 save: Yumush::save_community_name,138 save: Yumush::save_community_name,
@@ -135,10 +145,10 @@ impl Yumush {
135 }145 }
136 if let Some(community) = community.filter(|_| permission::can_manage_voice(actor)) {146 if let Some(community) = community.filter(|_| permission::can_manage_voice(actor)) {
137 sections.push(section(147 sections.push(section(
138- "Voice",148+ w().community_settings.voice,
139 palette,149 palette,
140 vec![row(150 vec![row(
141- "Voice",151+ w().community_settings.voice,
142 voice_control(entity, community.id, community.voice_enabled, palette),152 voice_control(entity, community.id, community.voice_enabled, palette),
143 )],153 )],
144 ));154 ));
@@ -146,7 +156,7 @@ impl Yumush {
146 let mut moderation = Vec::new();156 let mut moderation = Vec::new();
147 if permission::can_unban(actor) {157 if permission::can_unban(actor) {
148 moderation.push(row(158 moderation.push(row(
149- "Bans",159+ w().community_settings.bans,
150 div()160 div()
151 .flex()161 .flex()
152 .items_center()162 .items_center()
@@ -167,23 +177,27 @@ impl Yumush {
167 }177 }
168 if permission::can_read_logs(actor) {178 if permission::can_read_logs(actor) {
169 moderation.push(row(179 moderation.push(row(
170- "Logs",180+ w().community_settings.logs,
171 view_control("view_logs_button", entity, palette, Yumush::open_logs),181 view_control("view_logs_button", entity, palette, Yumush::open_logs),
172 ));182 ));
173 }183 }
174 if !moderation.is_empty() {184 if !moderation.is_empty() {
175- sections.push(section("Moderation", palette, moderation));185+ sections.push(section(
186+ w().community_settings.moderation,
187+ palette,
188+ moderation,
189+ ));
176 }190 }
177 let mut danger = Vec::new();191 let mut danger = Vec::new();
178 if let Some(community) = community.filter(|_| permission::can_leave(actor)) {192 if let Some(community) = community.filter(|_| permission::can_leave(actor)) {
179 danger.push(row(193 danger.push(row(
180- "Leave community",194+ w().community_settings.leave_community,
181 leave_control(entity, community.id, palette),195 leave_control(entity, community.id, palette),
182 ));196 ));
183 }197 }
184 if permission::can_delete_community(actor) {198 if permission::can_delete_community(actor) {
185 danger.push(row(199 danger.push(row(
186- "Delete community",200+ w().community_settings.delete_community,
187 delete_control(201 delete_control(
188 "delete_community_button",202 "delete_community_button",
189 self.chat.delete_step,203 self.chat.delete_step,
@@ -360,20 +374,22 @@ impl Yumush {
360 .map(|ban| ban_row(ban, &entity, palette, &yumush.chat.avatars).into_any_element())374 .map(|ban| ban_row(ban, &entity, palette, &yumush.chat.avatars).into_any_element())
361 .collect();375 .collect();
362 376
363- dialog.title("Bans").child(moderation_body(377+ dialog
364- "bans_scroll",378+ .title(w().community_settings.bans)
365- &yumush.chat.ban_search,379+ .child(moderation_body(
366- sort_control(380+ "bans_scroll",
367- BAN_SORTS,381+ &yumush.chat.ban_search,
368- yumush.chat.ban_sort,382+ sort_control(
369- &entity,383+ ban_sorts(),
384+ yumush.chat.ban_sort,
385+ &entity,
386+ palette,
387+ Yumush::set_ban_sort,
388+ ),
389+ rows,
390+ w().community_settings.no_bans,
370 palette,391 palette,
371- Yumush::set_ban_sort,392+ ))
372- ),
373- rows,
374- "No bans",
375- palette,
376- ))
377 });393 });
378 }394 }
379 395
@@ -401,20 +417,22 @@ impl Yumush {
401 .map(|entry| log_row(entry, palette, &yumush.chat.avatars).into_any_element())417 .map(|entry| log_row(entry, palette, &yumush.chat.avatars).into_any_element())
402 .collect();418 .collect();
403 419
404- dialog.title("Logs").child(moderation_body(420+ dialog
405- "logs_scroll",421+ .title(w().community_settings.logs)
406- &yumush.chat.log_search,422+ .child(moderation_body(
407- sort_control(423+ "logs_scroll",
408- LOG_SORTS,424+ &yumush.chat.log_search,
409- yumush.chat.log_sort,425+ sort_control(
410- &entity,426+ log_sorts(),
427+ yumush.chat.log_sort,
428+ &entity,
429+ palette,
430+ Yumush::set_log_sort,
431+ ),
432+ rows,
433+ w().community_settings.no_logs,
411 palette,434 palette,
412- Yumush::set_log_sort,435+ ))
413- ),
414- rows,
415- "No logs",
416- palette,
417- ))
418 });436 });
419 }437 }
420 438
@@ -480,7 +498,11 @@ fn voice_control(
480 )498 )
481 .border_1()499 .border_1()
482 .border_color(palette.border)500 .border_color(palette.border)
483- .child(if enabled { "On" } else { "Off" })501+ .child(if enabled {
502+ w().community_settings.on
503+ } else {
504+ w().community_settings.off
505+ })
484 }506 }
485 507
486 fn view_control(508 fn view_control(
@@ -492,11 +514,11 @@ fn view_control(
492 small_button(id, palette, palette.text, entity_action(entity, open))514 small_button(id, palette, palette.text, entity_action(entity, open))
493 .border_1()515 .border_1()
494 .border_color(palette.border)516 .border_color(palette.border)
495- .child("View")517+ .child(w().community_settings.view)
496 }518 }
497 519
498 fn sort_control<T: Copy + PartialEq + 'static, const N: usize>(520 fn sort_control<T: Copy + PartialEq + 'static, const N: usize>(
499- options: [(T, &'static str); N],521+ options: [(T, &'static str, &'static str); N],
500 selected: T,522 selected: T,
501 entity: &Entity<Yumush>,523 entity: &Entity<Yumush>,
502 palette: Palette,524 palette: Palette,
@@ -511,11 +533,11 @@ fn sort_control<T: Copy + PartialEq + 'static, const N: usize>(
511 .border_1()533 .border_1()
512 .border_color(palette.border)534 .border_color(palette.border)
513 .bg(palette.field)535 .bg(palette.field)
514- .children(options.map(|(choice, label)| {536+ .children(options.map(|(choice, id, label)| {
515 let active = choice == selected;537 let active = choice == selected;
516 538
517 clickable(539 clickable(
518- label,540+ id,
519 palette,541 palette,
520 entity_action(entity, move |yumush, window, cx| {542 entity_action(entity, move |yumush, window, cx| {
521 select(yumush, choice, window, cx)543 select(yumush, choice, window, cx)
@@ -592,7 +614,9 @@ fn log_list<'a>(logs: &'a [LogEntry], query: &str, sort: LogSort) -> Vec<&'a Log
592 614
593 pub(super) fn user_name(user: &Option<User>) -> &str {615 pub(super) fn user_name(user: &Option<User>) -> &str {
594 user.as_ref()616 user.as_ref()
595- .map_or("someone", |user| user.username.as_str())617+ .map_or(w().community_settings.someone, |user| {
618+ user.username.as_str()
619+ })
596 }620 }
597 621
598 fn with_reason(text: String, reason: &Option<String>) -> String {622 fn with_reason(text: String, reason: &Option<String>) -> String {
@@ -604,28 +628,29 @@ fn with_reason(text: String, reason: &Option<String>) -> String {
604 628
605 fn log_text(entry: &LogEntry) -> String {629 fn log_text(entry: &LogEntry) -> String {
606 community_log_text(630 community_log_text(
607- &user_name(&entry.actor),631+ user_name(&entry.actor),
608- &user_name(&entry.target),632+ user_name(&entry.target),
609 &entry.action,633 &entry.action,
610 )634 )
611 }635 }
612 636
613 pub(super) fn community_log_text(actor: &str, target: &str, action: &LogAction) -> String {637 pub(super) fn community_log_text(actor: &str, target: &str, action: &LogAction) -> String {
638+ let w = &w().community_settings;
614 match action {639 match action {
615- LogAction::Created => format!("{actor} created the community"),640+ LogAction::Created => w.created(actor),
616- LogAction::Renamed { name } => format!("{actor} renamed to {name}"),641+ LogAction::Renamed { name } => w.renamed(actor, name),
617- LogAction::AvatarChanged => format!("{actor} changed the avatar"),642+ LogAction::AvatarChanged => w.avatar_changed(actor),
618- LogAction::AvatarRemoved => format!("{actor} removed the avatar"),643+ LogAction::AvatarRemoved => w.avatar_removed(actor),
619- LogAction::Invited => format!("{actor} invited {target}"),644+ LogAction::Invited => w.invited(actor, target),
620- LogAction::Joined => format!("{actor} joined"),645+ LogAction::Joined => w.joined_log(actor),
621- LogAction::Left => format!("{actor} left"),646+ LogAction::Left => w.left_log(actor),
622- LogAction::Kicked { reason } => with_reason(format!("{actor} kicked {target}"), reason),647+ LogAction::Kicked { reason } => with_reason(w.kicked(actor, target), reason),
623- LogAction::Banned { reason } => with_reason(format!("{actor} banned {target}"), reason),648+ LogAction::Banned { reason } => with_reason(w.banned(actor, target), reason),
624- LogAction::Unbanned => format!("{actor} unbanned {target}"),649+ LogAction::Unbanned => w.unbanned(actor, target),
625 LogAction::RankChanged { rank } => {650 LogAction::RankChanged { rank } => {
626- format!("{actor} changed rank of {target} to {}", rank.as_str())651+ w.rank_changed(actor, rank.label().to_lowercase(), target)
627 }652 }
628- LogAction::MessageDeleted => format!("{actor} deleted a message by {target}"),653+ LogAction::MessageDeleted => w.message_deleted(actor, target),
629 }654 }
630 }655 }
631 656
@@ -651,7 +676,7 @@ fn log_row(entry: &LogEntry, palette: Palette, avatars: &HashMap<Id, Arc<Image>>
651 .flex_shrink_0()676 .flex_shrink_0()
652 .text_size(text(text_token::CAPTION))677 .text_size(text(text_token::CAPTION))
653 .text_color(palette.muted)678 .text_color(palette.muted)
654- .child(millis_time(entry.created_at, STAMP)),679+ .child(millis_time(entry.created_at, crate::lang::w().common.stamp)),
655 )680 )
656 }681 }
657 682
@@ -670,7 +695,7 @@ fn leave_control(entity: &Entity<Yumush>, community_id: Id, palette: Palette) ->
670 )695 )
671 .border_1()696 .border_1()
672 .border_color(palette.border)697 .border_color(palette.border)
673- .child("Leave")698+ .child(w().community_settings.leave)
674 }699 }
675 700
676 fn ban_row(701 fn ban_row(
@@ -734,6 +759,6 @@ fn ban_row(
734 .items_center()759 .items_center()
735 .rounded(px(radius::MD))760 .rounded(px(radius::MD))
736 .text_color(palette.danger)761 .text_color(palette.danger)
737- .child("Unban"),762+ .child(w().community_settings.unban),
738 )763 )
739 }764 }
crates/client/src/gui/composer.rsmodified+25 -22
@@ -5,6 +5,7 @@ use crate::gui::glyph::Fill as _;
5 use common::model::Id;5 use common::model::Id;
6 use std::time::{Duration, Instant};6 use std::time::{Duration, Instant};
7 7
8+use crate::lang::w;
8 use crate::net::Fail;9 use crate::net::Fail;
9 use common::{10 use common::{
10 call::{CreateMessage, CreatePoll, Typing, UpdateMessage},11 call::{CreateMessage, CreatePoll, Typing, UpdateMessage},
@@ -103,7 +104,7 @@ pub fn selection_bar(ids: &[Id], entity: &Entity<Yumush>, palette: Palette) -> i
103 .border_1()104 .border_1()
104 .border_color(palette.border)105 .border_color(palette.border)
105 .bg(palette.field)106 .bg(palette.field)
106- .child(div().flex_1().child(format!("{count} selected")))107+ .child(div().flex_1().child(w().composer.selected(count)))
107 .child(108 .child(
108 primary_button("forward_selected", palette, move |window, cx| {109 primary_button("forward_selected", palette, move |window, cx| {
109 let selected = selected.clone();110 let selected = selected.clone();
@@ -115,7 +116,7 @@ pub fn selection_bar(ids: &[Id], entity: &Entity<Yumush>, palette: Palette) -> i
115 .items_center()116 .items_center()
116 .rounded(px(radius::MD))117 .rounded(px(radius::MD))
117 .text_size(text(text::CAPTION))118 .text_size(text(text::CAPTION))
118- .child("Forward"),119+ .child(w().composer.forward),
119 )120 )
120 .child(cancel_button(entity, palette))121 .child(cancel_button(entity, palette))
121 }122 }
@@ -146,14 +147,14 @@ fn reply_bar(
146 .find(|message| message.id == message_id);147 .find(|message| message.id == message_id);
147 let author = message148 let author = message
148 .and_then(|message| chat.author(message.user_id))149 .and_then(|message| chat.author(message.user_id))
149- .map_or("unknown", |user| user.username.as_str())150+ .map_or(w().composer.unknown_author, |user| user.username.as_str())
150 .to_string();151 .to_string();
151 let quote = message152 let quote = message
152 .map(super::message_actions::message_text)153 .map(super::message_actions::message_text)
153 .unwrap_or_default();154 .unwrap_or_default();
154 155
155 bar(palette)156 bar(palette)
156- .child("Replying to")157+ .child(w().composer.replying_to)
157 .child(158 .child(
158 div()159 div()
159 .font_weight(FontWeight::SEMIBOLD)160 .font_weight(FontWeight::SEMIBOLD)
@@ -168,13 +169,13 @@ fn slow_bar(seconds: u64, palette: Palette) -> impl IntoElement {
168 bar(palette)169 bar(palette)
169 .text_color(palette.danger)170 .text_color(palette.danger)
170 .child(Icon::new(IconName::Hourglass).size(px(size::ICON_SM)))171 .child(Icon::new(IconName::Hourglass).size(px(size::ICON_SM)))
171- .child(format!("Slow down, you can send again in {seconds}s"))172+ .child(w().composer.slow_down(seconds))
172 }173 }
173 174
174 fn edit_bar(entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement {175 fn edit_bar(entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement {
175 bar(palette)176 bar(palette)
176 .child(Icon::new(IconName::Pencil).size(px(size::ICON_SM)))177 .child(Icon::new(IconName::Pencil).size(px(size::ICON_SM)))
177- .child("Editing")178+ .child(w().composer.editing)
178 .child(div().flex_1())179 .child(div().flex_1())
179 .child(cancel_button(entity, palette))180 .child(cancel_button(entity, palette))
180 }181 }
@@ -186,7 +187,7 @@ fn cancel_button(entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement
186 "cancel_composer",187 "cancel_composer",
187 palette,188 palette,
188 IconName::Close,189 IconName::Close,
189- "Cancel",190+ w().composer.cancel,
190 move |window, cx| {191 move |window, cx| {
191 entity.update(cx, |yumush, cx| yumush.cancel_composer(window, cx));192 entity.update(cx, |yumush, cx| yumush.cancel_composer(window, cx));
192 },193 },
@@ -272,7 +273,7 @@ impl Yumush {
272 return;273 return;
273 }274 }
274 let Some(community_id) = self.chat.selected_community_id else {275 let Some(community_id) = self.chat.selected_community_id else {
275- window.push_notification(Notification::error("No Community Selected"), cx);276+ window.push_notification(Notification::error(w().composer.no_community), cx);
276 return;277 return;
277 };278 };
278 let network = self.network.clone();279 let network = self.network.clone();
@@ -651,7 +652,7 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
651 .child(plus_row(652 .child(plus_row(
652 "plus_file",653 "plus_file",
653 IconName::File,654 IconName::File,
654- "File",655+ w().composer.file,
655 palette,656 palette,
656 move |window, cx| {657 move |window, cx| {
657 popover.update(cx, |state, cx| state.dismiss(window, cx));658 popover.update(cx, |state, cx| state.dismiss(window, cx));
@@ -661,7 +662,7 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
661 .child(plus_row(662 .child(plus_row(
662 "plus_poll",663 "plus_poll",
663 IconName::ChartBar,664 IconName::ChartBar,
664- "Poll",665+ w().composer.poll,
665 palette,666 palette,
666 move |_, cx| {667 move |_, cx| {
667 poll.update(cx, |yumush, cx| {668 poll.update(cx, |yumush, cx| {
@@ -704,7 +705,7 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
704 format!("poll_remove_{index}"),705 format!("poll_remove_{index}"),
705 palette,706 palette,
706 IconName::Close,707 IconName::Close,
707- "Remove option",708+ w().composer.remove_option,
708 move |_, cx| {709 move |_, cx| {
709 remove.update(cx, |yumush, cx| {710 remove.update(cx, |yumush, cx| {
710 yumush.remove_poll_option(index, cx)711 yumush.remove_poll_option(index, cx)
@@ -721,7 +722,7 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
721 .gap(px(space::XS))722 .gap(px(space::XS))
722 .text_color(palette.muted)723 .text_color(palette.muted)
723 .child(Icon::new(IconName::Timer).size(px(size::ICON_SM)))724 .child(Icon::new(IconName::Timer).size(px(size::ICON_SM)))
724- .children(POLL_DURATIONS.map(|(label, seconds)| {725+ .children(poll_durations().map(|(label, seconds)| {
725 let set = duration_entity.clone();726 let set = duration_entity.clone();
726 let active = duration == seconds;727 let active = duration == seconds;
727 clickable(label, palette, move |_, cx| {728 clickable(label, palette, move |_, cx| {
@@ -750,7 +751,7 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
750 .gap(px(space::MD))751 .gap(px(space::MD))
751 .child(752 .child(
752 Checkbox::new("poll_multiple")753 Checkbox::new("poll_multiple")
753- .label("Multiple answers")754+ .label(w().composer.multiple_answers)
754 .checked(multiple)755 .checked(multiple)
755 .on_click(move |_, _, cx| {756 .on_click(move |_, _, cx| {
756 toggle.update(cx, |yumush, cx| {757 toggle.update(cx, |yumush, cx| {
@@ -761,7 +762,7 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
761 )762 )
762 .child(763 .child(
763 Checkbox::new("poll_public")764 Checkbox::new("poll_public")
764- .label("Show voters")765+ .label(w().composer.show_voters)
765 .checked(public)766 .checked(public)
766 .on_click(move |_, _, cx| {767 .on_click(move |_, _, cx| {
767 toggle_public768 toggle_public
@@ -781,25 +782,27 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
781 .items_center()782 .items_center()
782 .justify_center()783 .justify_center()
783 .rounded(px(radius::MD))784 .rounded(px(radius::MD))
784- .child("Create"),785+ .child(w().composer.create),
785 )786 )
786 .into_any_element()787 .into_any_element()
787 })788 })
788 }789 }
789 790
790-const POLL_DURATIONS: [(&str, Option<u32>); 4] = [791+fn poll_durations() -> [(&'static str, Option<u32>); 4] {
791- ("∞", None),792+ [
792- ("1h", Some(3600)),793+ ("∞", None),
793- ("1d", Some(86400)),794+ (w().composer.hour, Some(3600)),
794- ("1w", Some(604800)),795+ (w().composer.day, Some(86400)),
795-];796+ (w().composer.week, Some(604800)),
797+ ]
798+}
796 799
797 fn option_text(input: &Entity<InputState>, cx: &App) -> String {800 fn option_text(input: &Entity<InputState>, cx: &App) -> String {
798 input.read(cx).text().to_string().trim().to_owned()801 input.read(cx).text().to_string().trim().to_owned()
799 }802 }
800 803
801 pub(super) fn new_poll_option(window: &mut Window, cx: &mut Context<Yumush>) -> Entity<InputState> {804 pub(super) fn new_poll_option(window: &mut Window, cx: &mut Context<Yumush>) -> Entity<InputState> {
802- let input = new_input("Option", window, cx);805+ let input = new_input(w().composer.option, window, cx);
803 cx.subscribe_in(&input, window, |this, input, event, window, cx| {806 cx.subscribe_in(&input, window, |this, input, event, window, cx| {
804 if matches!(event, InputEvent::Change) {807 if matches!(event, InputEvent::Change) {
805 this.grow_poll_options(input, window, cx);808 this.grow_poll_options(input, window, cx);
crates/client/src/gui/forward.rsmodified+4 -3
@@ -1,4 +1,5 @@
1 use super::style::{radius, size, space, text};1 use super::style::{radius, size, space, text};
2+use crate::lang::w;
2 use common::call::ForwardMessages;3 use common::call::ForwardMessages;
3 use common::model::Id;4 use common::model::Id;
4 use gpui_kit::{5 use gpui_kit::{
@@ -35,7 +36,7 @@ impl Forward {
35 ) -> Self {36 ) -> Self {
36 let filter = cx.new(|cx| {37 let filter = cx.new(|cx| {
37 let mut state = InputState::new(window, cx);38 let mut state = InputState::new(window, cx);
38- state.set_placeholder("Filter", window, cx);39+ state.set_placeholder(w().forward.filter, window, cx);
39 state40 state
40 });41 });
41 cx.subscribe_in(&filter, window, |_, _, event, _, cx| {42 cx.subscribe_in(&filter, window, |_, _, event, _, cx| {
@@ -110,7 +111,7 @@ impl Render for Forward {
110 .child(compact_field(palette, &self.filter))111 .child(compact_field(palette, &self.filter))
111 .child(112 .child(
112 Checkbox::new("keep_authors")113 Checkbox::new("keep_authors")
113- .label("Keep authors")114+ .label(w().forward.keep_authors)
114 .checked(keep_authors)115 .checked(keep_authors)
115 .on_click(move |_, _, cx| {116 .on_click(move |_, _, cx| {
116 entity.update(cx, |this, cx| {117 entity.update(cx, |this, cx| {
@@ -147,7 +148,7 @@ impl Yumush {
147 148
148 window.open_dialog(cx, move |dialog, _, _| {149 window.open_dialog(cx, move |dialog, _, _| {
149 dialog150 dialog
150- .title("Forward")151+ .title(w().forward.forward)
151 .w(px(size::SHEET))152 .w(px(size::SHEET))
152 .child(forward.clone())153 .child(forward.clone())
153 });154 });
crates/client/src/gui/jump.rsmodified+451 -67
@@ -1,22 +1,28 @@
1-use common::model::{CommunityKind, Id};1+use crate::lang::{Label as _, w};
2+use common::model::{Community, CommunityKind, Id, Presence, User};
2 use gpui_kit::{3 use gpui_kit::{
3- Context, Div, Entity, InteractiveElement, KeyDownEvent, ParentElement,4+ Context, Div, Entity, FontWeight, InteractiveElement, KeyDownEvent, ParentElement,
4- StatefulInteractiveElement, Styled, Window, component::input::InputState, div,5+ ScrollHandle, StatefulInteractiveElement, Styled, Window,
5- prelude::FluentBuilder as _, px,6+ assets::IconName,
7+ component::{Icon, input::Input, input::InputState},
8+ div,
9+ prelude::FluentBuilder as _,
10+ px,
6 };11 };
7 12
8 use super::{13 use super::{
9- Palette, Yumush,14+ Palette, Yumush, avatar,
10 builder::BuilderTab,15 builder::BuilderTab,
11 chat::View,16 chat::View,
12- community_name,17+ community_icon, community_name,
13- parts::{Ink, Text, band, popover, words},18+ parts::{Ink, Text, band, words},
14- settings_page::SETTINGS,19+ presence_avatar,
15- style::{size, space},20+ settings_page::{SETTINGS_IDS, settings_titles},
16- widget::field,21+ style::{Theme, Tokens, my_hue, radius, size, space, stroke, text},
22+ widget::bare_input,
17 };23 };
18 24
19-const SHOWN: usize = 8;25+const ROWS: f32 = 8.;
20 26
21 #[derive(Clone, Copy, PartialEq)]27 #[derive(Clone, Copy, PartialEq)]
22 pub(super) enum Place {28 pub(super) enum Place {
@@ -26,16 +32,81 @@ pub(super) enum Place {
26 Friends,32 Friends,
27 Settings(usize),33 Settings(usize),
28 Builder(BuilderTab),34 Builder(BuilderTab),
35+ NewCommunity,
36+ Theme(Theme),
37+ Presence(Presence),
38+ Sidebar,
39+ Mute,
40+ Deafen,
41+ Share,
42+ Camera,
43+ LeaveCall,
44+ LogOut,
29 }45 }
30 46
31 pub(super) struct Jump {47 pub(super) struct Jump {
32 pub(super) open: bool,48 pub(super) open: bool,
33 pub(super) cursor: usize,49 pub(super) cursor: usize,
34 pub(super) input: Entity<InputState>,50 pub(super) input: Entity<InputState>,
51+ pub(super) scroll: ScrollHandle,
52+}
53+
54+enum Glyph {
55+ Icon(IconName),
56+ Person(User),
57+ Room(Community),
58+}
59+
60+struct Row {
61+ place: Place,
62+ label: String,
63+ glyph: Glyph,
64+ hint: Option<&'static str>,
65+}
66+
67+impl Row {
68+ fn new(place: Place, label: impl Into<String>, glyph: Glyph) -> Self {
69+ Self {
70+ place,
71+ label: label.into(),
72+ glyph,
73+ hint: None,
74+ }
75+ }
76+
77+ fn hinted(self, hint: &'static str) -> Self {
78+ Self {
79+ hint: Some(hint),
80+ ..self
81+ }
82+ }
83+}
84+
85+impl Place {
86+ fn key(self) -> String {
87+ match self {
88+ Place::Room(id) => format!("room:{id}"),
89+ Place::Person(id) => format!("person:{id}"),
90+ Place::Notes => "notes".into(),
91+ Place::Friends => "friends".into(),
92+ Place::Settings(index) => format!("settings:{}", SETTINGS_IDS[index]),
93+ Place::Builder(tab) => format!("builder:{}", tab.id()),
94+ Place::NewCommunity => "new_community".into(),
95+ Place::Theme(theme) => format!("theme:{}", theme.as_str()),
96+ Place::Presence(presence) => format!("presence:{}", presence.as_str()),
97+ Place::Sidebar => "sidebar".into(),
98+ Place::Mute => "mute".into(),
99+ Place::Deafen => "deafen".into(),
100+ Place::Share => "share".into(),
101+ Place::Camera => "camera".into(),
102+ Place::LeaveCall => "leave_call".into(),
103+ Place::LogOut => "log_out".into(),
104+ }
105+ }
35 }106 }
36 107
37 impl Yumush {108 impl Yumush {
38- fn places(&self, cx: &gpui_kit::App) -> Vec<(Place, String, &'static str)> {109+ fn places(&self, cx: &gpui_kit::App) -> Vec<Row> {
39 let query = self.chat.goto.input.read(cx).value().to_lowercase();110 let query = self.chat.goto.input.read(cx).value().to_lowercase();
40 let call = self.chat.voice_community();111 let call = self.chat.voice_community();
41 let unread = |id: Id| {112 let unread = |id: Id| {
@@ -52,15 +123,10 @@ impl Yumush {
52 .collect();123 .collect();
53 rooms.sort_by_key(|community| (Some(community.id) != call, !unread(community.id)));124 rooms.sort_by_key(|community| (Some(community.id) != call, !unread(community.id)));
54 let rooms = rooms.into_iter().map(|community| {125 let rooms = rooms.into_iter().map(|community| {
55- let hint = if community.kind.is_direct() {126+ Row::new(
56- "person"
57- } else {
58- "community"
59- };
60- (
61 Place::Room(community.id),127 Place::Room(community.id),
62 community_name(community).to_string(),128 community_name(community).to_string(),
63- hint,129+ Glyph::Room(community.clone()),
64 )130 )
65 });131 });
66 let directs: Vec<Id> = self132 let directs: Vec<Id> = self
@@ -84,37 +150,160 @@ impl Yumush {
84 && self.user.as_ref().is_none_or(|me| me.id != user.id)150 && self.user.as_ref().is_none_or(|me| me.id != user.id)
85 && seen.insert(user.id)151 && seen.insert(user.id)
86 })152 })
87- .map(|user| (Place::Person(user.id), user.username.to_string(), "person"))153+ .map(|user| {
154+ Row::new(
155+ Place::Person(user.id),
156+ user.username.to_string(),
157+ Glyph::Person(user.clone()),
158+ )
159+ })
88 .collect::<Vec<_>>();160 .collect::<Vec<_>>();
89 let pages = [161 let pages = [
90- (Place::Notes, "Notes".to_string(), "page"),162+ Row::new(
91- (Place::Friends, "Friends".to_string(), "page"),163+ Place::Notes,
164+ w().jump.notes.to_string(),
165+ Glyph::Icon(IconName::Bookmark),
166+ ),
167+ Row::new(
168+ Place::Friends,
169+ w().jump.friends.to_string(),
170+ Glyph::Icon(IconName::Users),
171+ ),
92 ]172 ]
93 .into_iter()173 .into_iter()
94 .chain(174 .chain(
95- SETTINGS175+ settings_titles()
96- .iter()176+ .into_iter()
97 .enumerate()177 .enumerate()
98- .map(|(index, title)| (Place::Settings(index), title.to_string(), "settings")),178+ .map(|(index, title)| {
179+ Row::new(
180+ Place::Settings(index),
181+ title.to_string(),
182+ Glyph::Icon(IconName::Settings2),
183+ )
184+ .hinted(w().jump.hint_settings)
185+ }),
99 )186 )
100 .chain(187 .chain(
101 BuilderTab::ALL188 BuilderTab::ALL
102 .into_iter()189 .into_iter()
103 .filter(|_| self.is_builder())190 .filter(|_| self.is_builder())
104- .map(|tab| (Place::Builder(tab), tab.label().to_string(), "builder")),191+ .map(|tab| {
192+ Row::new(
193+ Place::Builder(tab),
194+ tab.label().to_string(),
195+ Glyph::Icon(IconName::Shield),
196+ )
197+ }),
105 );198 );
106- rooms199+ let action = |place: Place, label: &str, icon: IconName| {
200+ Row::new(place, label.to_string(), Glyph::Icon(icon))
201+ };
202+ let call = self.chat.voice_flags().map(|(muted, deafened)| {
203+ [
204+ action(
205+ Place::Mute,
206+ if muted {
207+ w().jump.unmute
208+ } else {
209+ w().jump.mute
210+ },
211+ if muted {
212+ IconName::MicOff
213+ } else {
214+ IconName::Mic
215+ },
216+ ),
217+ action(
218+ Place::Deafen,
219+ if deafened {
220+ w().jump.undeafen
221+ } else {
222+ w().jump.deafen
223+ },
224+ if deafened {
225+ IconName::HeadphoneOff
226+ } else {
227+ IconName::Headphones
228+ },
229+ ),
230+ action(
231+ Place::Share,
232+ if self.network.sharing() {
233+ w().jump.stop_sharing
234+ } else {
235+ w().jump.share_screen
236+ },
237+ IconName::Monitor,
238+ ),
239+ action(
240+ Place::Camera,
241+ if self.network.camera_on() {
242+ w().jump.camera_off
243+ } else {
244+ w().jump.camera_on
245+ },
246+ IconName::Video,
247+ ),
248+ action(Place::LeaveCall, w().jump.leave_call, IconName::PhoneOff),
249+ ]
250+ });
251+ let actions = call
252+ .into_iter()
253+ .flatten()
254+ .chain([
255+ action(Place::NewCommunity, w().jump.new_community, IconName::Plus),
256+ action(
257+ Place::Sidebar,
258+ if self.chat.sidebar_collapsed {
259+ w().jump.expand_sidebar
260+ } else {
261+ w().jump.collapse_sidebar
262+ },
263+ IconName::PanelLeft,
264+ ),
265+ ])
266+ .chain(Theme::ALL.into_iter().map(|theme| {
267+ Row::new(
268+ Place::Theme(theme),
269+ theme.label().to_string(),
270+ Glyph::Icon(match theme {
271+ Theme::Gece => IconName::Moon,
272+ Theme::Gun => IconName::Sun,
273+ }),
274+ )
275+ .hinted(w().jump.hint_theme)
276+ }))
277+ .chain(Presence::ALL.into_iter().map(|presence| {
278+ Row::new(
279+ Place::Presence(presence),
280+ presence.label().to_string(),
281+ Glyph::Icon(IconName::Circle),
282+ )
283+ }))
284+ .chain([action(Place::LogOut, w().jump.log_out, IconName::LogOut)]);
285+ let mut found: Vec<_> = rooms
107 .chain(people)286 .chain(people)
108 .chain(pages)287 .chain(pages)
109- .filter(|(_, label, _)| label.to_lowercase().contains(&query))288+ .chain(actions)
110- .take(SHOWN)289+ .filter_map(|row| Some((rank(&row.label, &query)?, row)))
111- .collect()290+ .collect();
291+ let usage = &self.settings.jump_usage;
292+ found.sort_by_key(|(rank, row)| {
293+ (
294+ *rank,
295+ std::cmp::Reverse(usage.get(&row.place.key()).copied().unwrap_or(0)),
296+ )
297+ });
298+ found.into_iter().map(|(_, row)| row).collect()
112 }299 }
113 300
114 pub(super) fn open_jump(&mut self, window: &mut Window, cx: &mut Context<Self>) {301 pub(super) fn open_jump(&mut self, window: &mut Window, cx: &mut Context<Self>) {
115 self.chat.goto.open = true;302 self.chat.goto.open = true;
116 self.chat.goto.cursor = 0;303 self.chat.goto.cursor = 0;
304+ self.chat.goto.scroll.scroll_to_item(0);
117 self.chat.goto.input.update(cx, |input, cx| {305 self.chat.goto.input.update(cx, |input, cx| {
306+ input.set_placeholder(w().jump.placeholder, window, cx);
118 input.set_value("", window, cx);307 input.set_value("", window, cx);
119 input.focus(window, cx);308 input.focus(window, cx);
120 });309 });
@@ -132,6 +321,7 @@ impl Yumush {
132 if count > 0 {321 if count > 0 {
133 self.chat.goto.cursor =322 self.chat.goto.cursor =
134 (self.chat.goto.cursor as isize + step).rem_euclid(count as isize) as usize;323 (self.chat.goto.cursor as isize + step).rem_euclid(count as isize) as usize;
324+ self.chat.goto.scroll.scroll_to_item(self.chat.goto.cursor);
135 }325 }
136 cx.notify();326 cx.notify();
137 }327 }
@@ -140,13 +330,21 @@ impl Yumush {
140 let place = self330 let place = self
141 .places(cx)331 .places(cx)
142 .get(self.chat.goto.cursor)332 .get(self.chat.goto.cursor)
143- .map(|(place, ..)| *place);333+ .map(|row| row.place);
144- self.close_jump(window, cx);
145 if let Some(place) = place {334 if let Some(place) = place {
146- self.go_place(place, window, cx);335+ self.pick(place, window, cx);
336+ } else {
337+ self.close_jump(window, cx);
147 }338 }
148 }339 }
149 340
341+ fn pick(&mut self, place: Place, window: &mut Window, cx: &mut Context<Self>) {
342+ self.close_jump(window, cx);
343+ *self.settings.jump_usage.entry(place.key()).or_default() += 1;
344+ crate::settings::save(&self.settings);
345+ self.go_place(place, window, cx);
346+ }
347+
150 fn go_place(&mut self, place: Place, window: &mut Window, cx: &mut Context<Self>) {348 fn go_place(&mut self, place: Place, window: &mut Window, cx: &mut Context<Self>) {
151 match place {349 match place {
152 Place::Room(id) => {350 Place::Room(id) => {
@@ -167,18 +365,69 @@ impl Yumush {
167 self.show_view(View::Builder, window, cx);365 self.show_view(View::Builder, window, cx);
168 self.select_builder_tab(tab, window, cx);366 self.select_builder_tab(tab, window, cx);
169 }367 }
368+ Place::NewCommunity => self.new_community(window, cx),
369+ Place::Theme(theme) => self.set_theme(theme, cx),
370+ Place::Presence(presence) => self.set_presence(presence, window, cx),
371+ Place::Sidebar => self.toggle_sidebar(),
372+ Place::Mute => self.toggle_mute(window, cx),
373+ Place::Deafen => self.toggle_deafen(cx),
374+ Place::Share => self.toggle_share(window, cx),
375+ Place::Camera => self.toggle_camera(window, cx),
376+ Place::LeaveCall => self.end_voice(cx),
377+ Place::LogOut => self.logout(window, cx),
170 }378 }
171 cx.notify();379 cx.notify();
172 }380 }
173 381
382+ fn glyph(&self, glyph: Glyph, palette: Palette) -> Div {
383+ let t = palette.tokens;
384+ let face = match glyph {
385+ Glyph::Icon(icon) => div()
386+ .text_color(t.faint())
387+ .child(Icon::new(icon).size(px(size::ICON))),
388+ Glyph::Person(user) => presence_avatar(
389+ avatar(
390+ palette,
391+ &user,
392+ px(size::CHIP),
393+ t.text(text::CAPTION),
394+ &self.chat.avatars,
395+ ),
396+ self.presence_of(user.id),
397+ px(size::CHIP),
398+ palette,
399+ ),
400+ Glyph::Room(community) => community_icon(
401+ palette,
402+ &community,
403+ px(size::CHIP),
404+ t.text(text::CAPTION),
405+ &self.chat.avatars,
406+ ),
407+ };
408+ div()
409+ .flex_none()
410+ .size(px(size::CHIP))
411+ .flex()
412+ .items_center()
413+ .justify_center()
414+ .child(face)
415+ }
416+
174 pub(super) fn jump_box(&self, palette: Palette, cx: &mut Context<Self>) -> Option<Div> {417 pub(super) fn jump_box(&self, palette: Palette, cx: &mut Context<Self>) -> Option<Div> {
175 if !self.chat.goto.open {418 if !self.chat.goto.open {
176 return None;419 return None;
177 }420 }
178 let t = palette.tokens;421 let t = palette.tokens;
422+ let query = self.chat.goto.input.read(cx).value().trim().to_lowercase();
179 let places = self.places(cx);423 let places = self.places(cx);
180 let cursor = self.chat.goto.cursor.min(places.len().saturating_sub(1));424 let cursor = self.chat.goto.cursor.min(places.len().saturating_sub(1));
181 let entity = cx.entity();425 let entity = cx.entity();
426+ let rule = if query.is_empty() {
427+ t.thread()
428+ } else {
429+ t.hue(my_hue())
430+ };
182 Some(431 Some(
183 div()432 div()
184 .absolute()433 .absolute()
@@ -196,9 +445,16 @@ impl Yumush {
196 .on_click(cx.listener(|this, _, window, cx| this.close_jump(window, cx))),445 .on_click(cx.listener(|this, _, window, cx| this.close_jump(window, cx))),
197 )446 )
198 .child(447 .child(
199- popover(t)448+ div()
200 .w(px(size::SHEET + size::THUMB))449 .w(px(size::SHEET + size::THUMB))
201- .gap(px(space::XS))450+ .flex()
451+ .flex_col()
452+ .overflow_hidden()
453+ .bg(t.raise())
454+ .rounded(px(radius::LG))
455+ .border_1()
456+ .border_color(t.thread())
457+ .shadow_lg()
202 .occlude()458 .occlude()
203 .capture_action(cx.listener(459 .capture_action(cx.listener(
204 |this, _: &gpui_kit::component::input::Escape, window, cx| {460 |this, _: &gpui_kit::component::input::Escape, window, cx| {
@@ -214,41 +470,169 @@ impl Yumush {
214 }470 }
215 cx.stop_propagation();471 cx.stop_propagation();
216 }))472 }))
217- .child(field(palette, &self.chat.goto.input))473+ .child(
218- .children(places.into_iter().enumerate().map(474+ band(space::MD)
219- |(index, (place, label, hint))| {475+ .py(px(space::MD))
220- let entity = entity.clone();476+ .px(px(space::LG))
221- band(space::SM)477+ .child(
222- .id(("jump_row", index))478+ div()
223- .h(px(size::CONTROL_SM))
224- .px(px(space::SM))
225- .cursor_pointer()
226- .when(index == cursor, |row| row.bg(palette.hover))
227- .on_click(move |_, window, cx| {
228- entity.update(cx, |yumush, cx| {
229- yumush.close_jump(window, cx);
230- yumush.go_place(place, window, cx);
231- })
232- })
233- .child(
234- words(
235- label,
236- Text::Ui,
237- if index == cursor {
238- Ink::Paper
239- } else {
240- Ink::Dim
241- },
242- t,
243- )
244 .flex_1()479 .flex_1()
245 .min_w_0()480 .min_w_0()
246- .truncate(),481+ .text_size(t.text(text::BODY))
247- )482+ .child(bare_input(
248- .child(words(hint, Text::Caption, Ink::Faint, t))483+ palette,
249- },484+ Input::new(&self.chat.goto.input)
250- )),485+ .token(super::glyph::token),
486+ )),
487+ )
488+ .child(words(w().jump.esc, Text::Caption, Ink::Faint, t)),
489+ )
490+ .child(div().w_full().h(px(stroke::LINE)).flex_none().bg(rule))
491+ .child(
492+ div()
493+ .id("jump_list")
494+ .p(px(space::SM))
495+ .max_h(px((size::CONTROL_SM + space::SM) * ROWS + space::SM * 2.))
496+ .overflow_y_scroll()
497+ .track_scroll(&self.chat.goto.scroll)
498+ .flex()
499+ .flex_col()
500+ .gap(px(space::SM))
501+ .children(places.into_iter().enumerate().map(|(index, row)| {
502+ let entity = entity.clone();
503+ let selected = index == cursor;
504+ let place = row.place;
505+ band(space::SM)
506+ .id(("jump_row", index))
507+ .h(px(size::CONTROL_SM))
508+ .px(px(space::SM))
509+ .rounded(px(radius::MD))
510+ .cursor_pointer()
511+ .when(selected, |line| line.bg(t.hov()))
512+ .on_click(move |_, window, cx| {
513+ entity.update(cx, |yumush, cx| {
514+ yumush.pick(place, window, cx)
515+ })
516+ })
517+ .child(self.glyph(row.glyph, palette))
518+ .child(label_line(&row.label, &query, selected, t))
519+ .when_some(row.hint, |line, hint| {
520+ line.child(words(hint, Text::Caption, Ink::Faint, t))
521+ })
522+ .when(selected, |line| {
523+ line.child(
524+ div().flex_none().text_color(t.faint()).child(
525+ Icon::new(IconName::CornerDownLeft)
526+ .size(px(size::ICON_SM)),
527+ ),
528+ )
529+ })
530+ })),
531+ ),
251 ),532 ),
252 )533 )
253 }534 }
254 }535 }
536+
537+fn matched(label: &str, query: &str) -> Option<(usize, usize)> {
538+ if query.is_empty() {
539+ return None;
540+ }
541+ label.char_indices().find_map(|(start, _)| {
542+ label[start..]
543+ .char_indices()
544+ .map(|(offset, letter)| start + offset + letter.len_utf8())
545+ .find(|&end| label[start..end].to_lowercase() == query)
546+ .map(|end| (start, end))
547+ })
548+}
549+
550+fn label_line(label: &str, query: &str, selected: bool, t: Tokens) -> Div {
551+ let (before, hit, after) = match matched(label, query) {
552+ Some((start, end)) => (&label[..start], &label[start..end], &label[end..]),
553+ None => (label, "", ""),
554+ };
555+ let tone = |ink: Ink| if selected { Ink::Paper } else { ink };
556+ let weight = if selected {
557+ FontWeight::MEDIUM
558+ } else {
559+ FontWeight::NORMAL
560+ };
561+ div().flex().flex_1().min_w_0().overflow_hidden().children(
562+ [(before, Ink::Dim), (hit, Ink::Paper), (after, Ink::Dim)]
563+ .into_iter()
564+ .filter(|(piece, _)| !piece.is_empty())
565+ .map(|(piece, ink)| words(piece, Text::Ui, tone(ink), t).font_weight(weight)),
566+ )
567+}
568+
569+fn rank(label: &str, query: &str) -> Option<usize> {
570+ let label = label.to_lowercase();
571+ let query = query.trim().to_lowercase();
572+ let query = query.as_str();
573+ if label.starts_with(query) {
574+ return Some(0);
575+ }
576+ let words = || label.split_whitespace();
577+ if words().any(|word| word.starts_with(query)) {
578+ return Some(1);
579+ }
580+ if label.contains(query) {
581+ return Some(2);
582+ }
583+ let mut rest = label.chars();
584+ if query
585+ .chars()
586+ .filter(|letter| !letter.is_whitespace())
587+ .all(|letter| rest.any(|other| other == letter))
588+ {
589+ return Some(3);
590+ }
591+ let query: Vec<char> = query.chars().collect();
592+ let allowed = if query.len() <= 4 { 1 } else { 2 };
593+ let mut best = usize::MAX;
594+ for word in std::iter::once(label.as_str()).chain(words()) {
595+ let word: Vec<char> = word.chars().collect();
596+ for end in query.len().saturating_sub(1)..=(query.len() + 1).min(word.len()) {
597+ best = best.min(typos(&query, &word[..end]));
598+ }
599+ }
600+ (query.len() > 1 && best <= allowed).then_some(3 + best)
601+}
602+
603+fn typos(a: &[char], b: &[char]) -> usize {
604+ let mut rows = vec![(0..=b.len()).collect::<Vec<_>>(); a.len() + 1];
605+ for (i, row) in rows.iter_mut().enumerate() {
606+ row[0] = i;
607+ }
608+ for i in 1..=a.len() {
609+ for j in 1..=b.len() {
610+ let swap = usize::from(a[i - 1] != b[j - 1]);
611+ let mut best = (rows[i - 1][j] + 1)
612+ .min(rows[i][j - 1] + 1)
613+ .min(rows[i - 1][j - 1] + swap);
614+ if i > 1 && j > 1 && a[i - 1] == b[j - 2] && a[i - 2] == b[j - 1] {
615+ best = best.min(rows[i - 2][j - 2] + 1);
616+ }
617+ rows[i][j] = best;
618+ }
619+ }
620+ rows[a.len()][b.len()]
621+}
622+
623+#[cfg(test)]
624+mod tests {
625+ use super::rank;
626+
627+ #[test]
628+ fn forgives_typos() {
629+ assert_eq!(rank("New community", "new"), Some(0));
630+ assert_eq!(rank("New community", "comm"), Some(1));
631+ assert!(rank("New community", "nwcm").is_some());
632+ assert!(rank("New community", "comunity").is_some());
633+ assert!(rank("Settings", "settigns").is_some());
634+ assert!(rank("Log out", "lgo").is_some());
635+ assert!(rank("Friends", "zz").is_none());
636+ assert!(rank("Mute", "xyz").is_none());
637+ }
638+}
crates/client/src/gui/media_view.rsmodified+8 -3
@@ -1,5 +1,6 @@
1 use super::style::{radius, size, space, text};1 use super::style::{radius, size, space, text};
2 use super::text;2 use super::text;
3+use crate::lang::w;
3 use common::model::Id;4 use common::model::Id;
4 use std::{5 use std::{
5 collections::{HashMap, HashSet},6 collections::{HashMap, HashSet},
@@ -668,7 +669,7 @@ fn file_view(
668 .child(icon_button(669 .child(icon_button(
669 format!("save_{}", attachment.id),670 format!("save_{}", attachment.id),
670 IconName::ArrowDown,671 IconName::ArrowDown,
671- "Save",672+ w().media_view.save,
672 palette,673 palette,
673 on_attachment(entity, attachment, |yumush, attachment, window, cx| {674 on_attachment(entity, attachment, |yumush, attachment, window, cx| {
674 yumush.save_attachment(attachment, window, cx)675 yumush.save_attachment(attachment, window, cx)
@@ -695,7 +696,11 @@ fn player_view(
695 } else {696 } else {
696 IconName::Play697 IconName::Play
697 },698 },
698- if playing { "Pause" } else { "Play" },699+ if playing {
700+ w().media_view.pause
701+ } else {
702+ w().media_view.play
703+ },
699 palette,704 palette,
700 on_attachment(entity, attachment, |yumush, attachment, window, cx| {705 on_attachment(entity, attachment, |yumush, attachment, window, cx| {
701 yumush.play(attachment, window, cx)706 yumush.play(attachment, window, cx)
@@ -914,7 +919,7 @@ pub fn pending_row(
914 })919 })
915 },920 },
916 )921 )
917- .tip("Remove")922+ .tip(w().media_view.remove)
918 .size(px(size::CHIP))923 .size(px(size::CHIP))
919 .flex()924 .flex()
920 .items_center()925 .items_center()
crates/client/src/gui/message_actions.rsmodified+27 -10
@@ -1,4 +1,5 @@
1 use super::text;1 use super::text;
2+use crate::lang::w;
2 use common::model::Id;3 use common::model::Id;
3 use common::{4 use common::{
4 call::{Pin, React, ReportMessage, ReportUser},5 call::{Pin, React, ReportMessage, ReportUser},
@@ -129,7 +130,7 @@ pub fn react_popover(
129 130
130 pub fn quote_text(body: &str, attachments: u32) -> String {131 pub fn quote_text(body: &str, attachments: u32) -> String {
131 if body.is_empty() {132 if body.is_empty() {
132- format!("{attachments} attachments")133+ w().message_actions.attachments(attachments)
133 } else {134 } else {
134 body.to_string()135 body.to_string()
135 }136 }
@@ -348,7 +349,8 @@ pub fn actions(
348 entity,349 entity,
349 palette,350 palette,
350 id,351 id,
351- "Reply",352+ "reply",
353+ w().message_actions.reply,
352 IconName::Reply,354 IconName::Reply,
353 |yumush, id, window, cx| yumush.reply(id, window, cx),355 |yumush, id, window, cx| yumush.reply(id, window, cx),
354 ))356 ))
@@ -358,7 +360,8 @@ pub fn actions(
358 entity,360 entity,
359 palette,361 palette,
360 id,362 id,
361- "Edit",363+ "edit",
364+ w().message_actions.edit,
362 IconName::Pencil,365 IconName::Pencil,
363 |yumush, id, window, cx| yumush.edit(id, window, cx),366 |yumush, id, window, cx| yumush.edit(id, window, cx),
364 )367 )
@@ -367,7 +370,8 @@ pub fn actions(
367 entity,370 entity,
368 palette,371 palette,
369 id,372 id,
370- "Forward",373+ "forward",
374+ w().message_actions.forward,
371 IconName::Forward,375 IconName::Forward,
372 |yumush, id, window, cx| yumush.open_forward(vec![id], window, cx),376 |yumush, id, window, cx| yumush.open_forward(vec![id], window, cx),
373 ))377 ))
@@ -375,7 +379,8 @@ pub fn actions(
375 entity,379 entity,
376 palette,380 palette,
377 id,381 id,
378- "Select",382+ "select",
383+ w().message_actions.select,
379 IconName::ListChecks,384 IconName::ListChecks,
380 |yumush, id, window, cx| yumush.start_select(id, window, cx),385 |yumush, id, window, cx| yumush.start_select(id, window, cx),
381 ))386 ))
@@ -384,7 +389,12 @@ pub fn actions(
384 entity,389 entity,
385 palette,390 palette,
386 id,391 id,
387- if message.pinned { "Unpin" } else { "Pin" },392+ "pin",
393+ if message.pinned {
394+ w().message_actions.unpin
395+ } else {
396+ w().message_actions.pin
397+ },
388 if message.pinned {398 if message.pinned {
389 IconName::PinOff399 IconName::PinOff
390 } else {400 } else {
@@ -398,7 +408,8 @@ pub fn actions(
398 entity,408 entity,
399 palette,409 palette,
400 id,410 id,
401- "Report",411+ "report",
412+ w().message_actions.report,
402 IconName::TriangleAlert,413 IconName::TriangleAlert,
403 |yumush, id, window, cx| yumush.start_report(ReportTarget::Message(id), window, cx),414 |yumush, id, window, cx| yumush.start_report(ReportTarget::Message(id), window, cx),
404 )415 )
@@ -408,7 +419,12 @@ pub fn actions(
408 entity,419 entity,
409 palette,420 palette,
410 id,421 id,
411- if armed { "Confirm" } else { "Delete" },422+ "delete",
423+ if armed {
424+ w().message_actions.confirm
425+ } else {
426+ w().message_actions.delete
427+ },
412 IconName::Trash,428 IconName::Trash,
413 |yumush, id, window, cx| yumush.request_message_delete(id, window, cx),429 |yumush, id, window, cx| yumush.request_message_delete(id, window, cx),
414 )430 )
@@ -439,7 +455,7 @@ pub fn report_bar(
439 .flex()455 .flex()
440 .items_center()456 .items_center()
441 .rounded(px(radius::MD))457 .rounded(px(radius::MD))
442- .child("Send"),458+ .child(w().message_actions.send),
443 )459 )
444 }460 }
445 461
@@ -535,6 +551,7 @@ fn action(
535 entity: &Entity<Yumush>,551 entity: &Entity<Yumush>,
536 palette: Palette,552 palette: Palette,
537 message_id: Id,553 message_id: Id,
554+ name: &'static str,
538 tip: &'static str,555 tip: &'static str,
539 icon: IconName,556 icon: IconName,
540 run: fn(&mut Yumush, Id, &mut Window, &mut Context<Yumush>),557 run: fn(&mut Yumush, Id, &mut Window, &mut Context<Yumush>),
@@ -542,7 +559,7 @@ fn action(
542 let entity = entity.clone();559 let entity = entity.clone();
543 560
544 icon_button(561 icon_button(
545- format!("{tip}_{message_id}"),562+ format!("{name}_{message_id}"),
546 palette,563 palette,
547 icon,564 icon,
548 tip,565 tip,
crates/client/src/gui/poll.rsmodified+13 -12
@@ -1,3 +1,4 @@
1+use crate::lang::w;
1 use common::call::{ClosePoll, MyVotes, Vote};2 use common::call::{ClosePoll, MyVotes, Vote};
2 use common::model::Id;3 use common::model::Id;
3 use common::model::{Message, Poll, Rank, User};4 use common::model::{Message, Poll, Rank, User};
@@ -160,11 +161,11 @@ pub fn is_closed(poll: &Poll) -> bool {
160 fn remaining(end: u64) -> String {161 fn remaining(end: u64) -> String {
161 let left = end.saturating_sub(now_ms());162 let left = end.saturating_sub(now_ms());
162 if left >= DAY_MILLIS {163 if left >= DAY_MILLIS {
163- format!("{}d", left / DAY_MILLIS)164+ w().poll.days_left(left / DAY_MILLIS)
164 } else if left >= HOUR_MILLIS {165 } else if left >= HOUR_MILLIS {
165- format!("{}h", left / HOUR_MILLIS)166+ w().poll.hours_left(left / HOUR_MILLIS)
166 } else {167 } else {
167- format!("{}m", (left / MINUTE_MILLIS).max(1))168+ w().poll.minutes_left((left / MINUTE_MILLIS).max(1))
168 }169 }
169 }170 }
170 171
@@ -347,7 +348,7 @@ pub fn poll_card(
347 format!("poll_close_{close_id}"),348 format!("poll_close_{close_id}"),
348 palette,349 palette,
349 IconName::CircleStop,350 IconName::CircleStop,
350- "End poll",351+ w().poll.end_poll,
351 move |window, cx| {352 move |window, cx| {
352 close_entity353 close_entity
353 .update(cx, |yumush, cx| yumush.close_poll(close_id, window, cx));354 .update(cx, |yumush, cx| yumush.close_poll(close_id, window, cx));
@@ -357,9 +358,9 @@ pub fn poll_card(
357 );358 );
358 359
359 let (visibility, visibility_tip) = if poll.public {360 let (visibility, visibility_tip) = if poll.public {
360- (IconName::Eye, "Voters visible")361+ (IconName::Eye, w().poll.voters_visible)
361 } else {362 } else {
362- (IconName::EyeOff, "Anonymous")363+ (IconName::EyeOff, w().poll.anonymous)
363 };364 };
364 365
365 div()366 div()
@@ -403,7 +404,7 @@ pub fn poll_card(
403 status_icon(404 status_icon(
404 format!("poll_multiple_{key}"),405 format!("poll_multiple_{key}"),
405 IconName::ListChecks,406 IconName::ListChecks,
406- "Multiple choice",407+ w().poll.multiple_choice,
407 palette,408 palette,
408 )409 )
409 }))410 }))
@@ -411,7 +412,7 @@ pub fn poll_card(
411 status_icon(412 status_icon(
412 format!("poll_closed_{key}"),413 format!("poll_closed_{key}"),
413 IconName::Lock,414 IconName::Lock,
414- "Closed",415+ w().poll.closed,
415 palette,416 palette,
416 )417 )
417 })),418 })),
@@ -487,7 +488,7 @@ impl Yumush {
487 div()488 div()
488 .flex_shrink_0()489 .flex_shrink_0()
489 .text_color(palette.muted)490 .text_color(palette.muted)
490- .child(format!("{} votes", voter_count(poll))),491+ .child(w().poll.votes(voter_count(poll))),
491 )492 )
492 .child(493 .child(
493 div().flex_shrink_0().text_color(palette.muted).child(494 div().flex_shrink_0().text_color(palette.muted).child(
@@ -510,7 +511,7 @@ impl Yumush {
510 .child(page_button(511 .child(page_button(
511 "poll_page_back",512 "poll_page_back",
512 IconName::ChevronLeft,513 IconName::ChevronLeft,
513- "Previous",514+ w().poll.previous,
514 count - 1,515 count - 1,
515 entity,516 entity,
516 palette,517 palette,
@@ -519,7 +520,7 @@ impl Yumush {
519 .child(page_button(520 .child(page_button(
520 "poll_page_next",521 "poll_page_next",
521 IconName::ChevronRight,522 IconName::ChevronRight,
522- "Next",523+ w().poll.next,
523 1,524 1,
524 entity,525 entity,
525 palette,526 palette,
@@ -529,7 +530,7 @@ impl Yumush {
529 "poll_banner_jump",530 "poll_banner_jump",
530 palette,531 palette,
531 IconName::ArrowUpRight,532 IconName::ArrowUpRight,
532- "Jump to message",533+ w().poll.jump_to_message,
533 move |window, cx| {534 move |window, cx| {
534 jump.update(cx, |yumush, cx| {535 jump.update(cx, |yumush, cx| {
535 yumush.go_to_message(message_id, window, cx)536 yumush.go_to_message(message_id, window, cx)
crates/client/src/gui/profile.rsmodified+235 -154
@@ -1,4 +1,5 @@
1 use crate::gui::glyph::Fill as _;1 use crate::gui::glyph::Fill as _;
2+use crate::lang::{Label as _, w};
2 use common::model::Id;3 use common::model::Id;
3 use gpui_kit::prelude::FluentBuilder as _;4 use gpui_kit::prelude::FluentBuilder as _;
4 use std::collections::VecDeque;5 use std::collections::VecDeque;
@@ -30,8 +31,8 @@ use super::social::Relation;
30 use super::style::{radius, size, space, stroke, text};31 use super::style::{radius, size, space, stroke, text};
31 use super::widget::spawn_done;32 use super::widget::spawn_done;
32 use super::{33 use super::{
33- DAY_YEAR, Palette, Tooltip as _, Trigger, Yumush, avatar, clickable, entity_action,34+ Palette, Tooltip as _, Trigger, Yumush, avatar, clickable, entity_action, input_dialog,
34- input_dialog, millis_time, notify_error, palette, presence_color, rank_tag, text,35+ millis_time, notify_error, palette, text,
35 };36 };
36 37
37 const ACCOUNTS_MAX_H: f32 = 180.;38 const ACCOUNTS_MAX_H: f32 = 180.;
@@ -44,9 +45,10 @@ enum Removal {
44 45
45 impl Removal {46 impl Removal {
46 fn title(self) -> &'static str {47 fn title(self) -> &'static str {
48+ let w = &w().profile;
47 match self {49 match self {
48- Removal::Kick => "Kick",50+ Removal::Kick => w.kick,
49- Removal::Ban => "Ban",51+ Removal::Ban => w.ban,
50 }52 }
51 }53 }
52 }54 }
@@ -121,7 +123,7 @@ pub(super) fn profile_popover(
121 .map(|volume| (volume.slider.clone(), yumush.user_volume(user.id))),123 .map(|volume| (volume.slider.clone(), yumush.user_volume(user.id))),
122 call: yumush.call_of(user.id).map(|community| {124 call: yumush.call_of(user.id).map(|community| {
123 if community.kind.is_direct() {125 if community.kind.is_direct() {
124- "a call".to_string()126+ w().profile.a_call.to_string()
125 } else {127 } else {
126 community.name.clone()128 community.name.clone()
127 }129 }
@@ -166,7 +168,7 @@ impl Card {
166 let mut rows = vec![168 let mut rows = vec![
167 menu_row(169 menu_row(
168 "profile_message",170 "profile_message",
169- "Message",171+ w().profile.message,
170 menu_icon(IconName::MessageSquare),172 menu_icon(IconName::MessageSquare),
171 palette.text,173 palette.text,
172 palette,174 palette,
@@ -177,7 +179,7 @@ impl Card {
177 .into_any_element(),179 .into_any_element(),
178 menu_row(180 menu_row(
179 "profile_call",181 "profile_call",
180- "Call",182+ w().profile.call,
181 menu_icon(IconName::Phone),183 menu_icon(IconName::Phone),
182 palette.text,184 palette.text,
183 palette,185 palette,
@@ -192,7 +194,7 @@ impl Card {
192 rows.push(194 rows.push(
193 menu_row(195 menu_row(
194 "profile_report",196 "profile_report",
195- "Report",197+ w().profile.report,
196 menu_icon(IconName::TriangleAlert),198 menu_icon(IconName::TriangleAlert),
197 palette.danger,199 palette.danger,
198 palette,200 palette,
@@ -235,51 +237,98 @@ impl Card {
235 .as_ref()237 .as_ref()
236 .is_some_and(|viewer| viewer.id == self.user.id);238 .is_some_and(|viewer| viewer.id == self.user.id);
237 let t = palette.tokens;239 let t = palette.tokens;
238- let rows = if is_self {240+ let actions = if is_self {
239- self_rows(241+ div()
240- &self.others,242+ .flex()
241- self.card_menu,243+ .flex_col()
242- self.presence,244+ .gap(px(space::XS))
243- entity,245+ .children(self_rows(
244- &popover,246+ &self.others,
245- palette,247+ self.card_menu,
246- )248+ entity,
249+ &popover,
250+ palette,
251+ ))
252+ .into_any_element()
247 } else {253 } else {
248 let mut rows = self.social_rows(entity, &popover, palette);254 let mut rows = self.social_rows(entity, &popover, palette);
249 rows.extend(self.moderation_rows(entity, &popover, palette));255 rows.extend(self.moderation_rows(entity, &popover, palette));
250 if self.card_menu == CardMenu::More || rows.len() < 3 {256 if self.card_menu == CardMenu::More || rows.len() < 3 {
251- rows257+ div()
258+ .flex()
259+ .flex_col()
260+ .gap(px(space::XS))
261+ .children(rows)
262+ .into_any_element()
252 } else {263 } else {
253 let first = rows.remove(0);264 let first = rows.remove(0);
254 let second = rows.remove(0);265 let second = rows.remove(0);
255- vec![266+ band(space::XS)
256- band(space::XS)267+ .child(first)
257- .child(first)268+ .child(second)
258- .child(second)269+ .child(div().flex_1())
259- .child(div().flex_1())270+ .child(icon_button(
260- .child(icon_button(271+ "profile_more",
261- "profile_more",272+ IconName::Ellipsis,
262- IconName::Ellipsis,273+ w().profile.more,
263- "More",274+ Tone::Idle,
264- Tone::Idle,275+ t,
265- t,276+ card_menu_action(entity, CardMenu::More),
266- card_menu_action(entity, CardMenu::More),277+ ))
267- ))278+ .into_any_element()
268- .into_any_element(),
269- ]
270 }279 }
271 };280 };
272- let doing = match (&self.call, is_self) {281+ let location = match &self.call {
273- (Some(room), _) => format!("in {room}"),282+ Some(room) => w().profile.in_room(room),
274- (None, true) => String::new(),283+ None => self.presence.label().to_lowercase(),
275- (None, false) => self.presence.label().to_lowercase(),
276 };284 };
277- let joined = format!("joined {}", millis_time(self.user.created_at, DAY_YEAR));285+ let place = match self.target {
278- let about = if doing.is_empty() {286+ Some(Rank::Builder) => band(space::XXS)
279- joined287+ .child(
288+ Icon::new(IconName::Shield)
289+ .size(px(size::ICON_SM))
290+ .text_color(palette.accent),
291+ )
292+ .child(
293+ words(Rank::Builder.label(), Text::Caption, Ink::Faint, t)
294+ .text_color(palette.accent),
295+ )
296+ .into_any_element(),
297+ Some(rank @ (Rank::Moderator | Rank::Admin | Rank::Owner)) => {
298+ words(rank.label(), Text::Caption, Ink::Faint, t).into_any_element()
299+ }
300+ _ => words(location, Text::Caption, Ink::Faint, t).into_any_element(),
301+ };
302+ let tint = match self.presence {
303+ Presence::Offline => t.off(),
304+ _ => t.person(self.user.id),
305+ };
306+ let line = if self.call.is_some() {
307+ div()
308+ .h(px(space::LG))
309+ .child(voice_line(
310+ self.wave.as_ref(),
311+ if self.speaking {
312+ Voice::Live(t.person(self.user.id))
313+ } else {
314+ Voice::Quiet
315+ },
316+ t,
317+ ))
318+ .into_any_element()
280 } else {319 } else {
281- format!("{doing} · {joined}")320+ div()
321+ .w_full()
322+ .h(px(stroke::LINE))
323+ .bg(tint)
324+ .into_any_element()
282 };325 };
326+ let caption = band(space::SM).justify_between().child(place).child(words(
327+ millis_time(self.user.created_at, crate::lang::w().common.day_year),
328+ Text::Caption,
329+ Ink::Faint,
330+ t,
331+ ));
283 332
284 super::parts::popover(t)333 super::parts::popover(t)
285 .w(px(size::POPOVER))334 .w(px(size::POPOVER))
@@ -308,6 +357,24 @@ impl Card {
308 move |_, window, cx| {357 move |_, window, cx| {
309 popover.update(cx, |state, cx| state.dismiss(window, cx));358 popover.update(cx, |state, cx| state.dismiss(window, cx));
310 }359 }
360+ })
361+ .map(|picture| {
362+ if is_self {
363+ div().relative().flex_shrink_0().child(picture).child(
364+ div()
365+ .absolute()
366+ .right(px(-space::XXS))
367+ .bottom(px(-space::XXS))
368+ .child(presence_menu(self.presence, entity, palette)),
369+ )
370+ } else {
371+ super::presence_avatar(
372+ picture,
373+ self.presence,
374+ px(size::AVATAR_LG),
375+ palette,
376+ )
377+ }
311 }),378 }),
312 )379 )
313 .child(380 .child(
@@ -315,7 +382,7 @@ impl Card {
315 .flex_1()382 .flex_1()
316 .min_w_0()383 .min_w_0()
317 .child(384 .child(
318- band(space::SM)385+ band(space::XS)
319 .child(386 .child(
320 words(387 words(
321 self.user.username.clone(),388 self.user.username.clone(),
@@ -323,9 +390,13 @@ impl Card {
323 Ink::Paper,390 Ink::Paper,
324 t,391 t,
325 )392 )
326- .font_weight(FontWeight::MEDIUM),393+ .font_weight(FontWeight::MEDIUM)
394+ .min_w_0()
395+ .truncate(),
327 )396 )
328- .children(rank_tag(self.target, palette)),397+ .when(is_self, |name| {
398+ name.child(account_toggle(self.card_menu, entity, palette))
399+ }),
329 )400 )
330 .map(|names| {401 .map(|names| {
331 if !is_self {402 if !is_self {
@@ -391,48 +462,38 @@ impl Card {
391 }),462 }),
392 ),463 ),
393 )464 )
394- .children(self.call.is_some().then(|| {465+ .when(!is_self, |card| {
395- div().h(px(space::MD)).child(voice_line(466+ card.child(stack(space::XS).child(line).child(caption))
396- self.wave.as_ref(),467+ })
397- if self.speaking {
398- Voice::Live(t.person(self.user.id))
399- } else {
400- Voice::Quiet
401- },
402- t,
403- ))
404- }))
405- .child(words(about, Text::Caption, Ink::Faint, t))
406 .children(self.volume.clone().map(|(slider, volume)| {468 .children(self.volume.clone().map(|(slider, volume)| {
407- band(space::MD)
408- .child(words("Volume", Text::Label, Ink::Paper, t).flex_none())
409- .child(super::parts::slider(&slider, t))
410- .child(
411- words(format!("{volume:.0}%"), Text::Caption, Ink::Dim, t)
412- .w(px(size::CONTROL))
413- .text_right(),
414- )
415- }))
416- .children(self.volume.as_ref().map(|(_, volume)| {
417 let user_id = self.user.id;469 let user_id = self.user.id;
418- band(space::MD)470+ band(space::SM)
419- .child(words("Mute", Text::Label, Ink::Paper, t))471+ .child(icon_button(
420- .child(div().flex_1())
421- .child(super::parts::toggle(
422 "profile_mute",472 "profile_mute",
423- *volume == 0.,473+ if volume == 0. {
474+ IconName::VolumeX
475+ } else {
476+ IconName::Volume2
477+ },
478+ w().profile.mute,
479+ Tone::Idle,
424 t,480 t,
425 entity_action(entity, move |yumush, window, cx| {481 entity_action(entity, move |yumush, window, cx| {
426 yumush.toggle_user_mute(user_id, window, cx)482 yumush.toggle_user_mute(user_id, window, cx)
427 }),483 }),
428 ))484 ))
485+ .child(super::parts::slider(&slider, t))
486+ .child(
487+ words(format!("{volume:.0}%"), Text::Caption, Ink::Dim, t)
488+ .w(px(size::CONTROL))
489+ .text_right(),
490+ )
429 }))491 }))
430 .children(492 .children(
431 self.reporting493 self.reporting
432 .then(|| report_bar(&self.reason, entity, palette)),494 .then(|| report_bar(&self.reason, entity, palette)),
433 )495 )
434- .children((!rows.is_empty()).then(|| div().h(px(stroke::LINE)).bg(palette.border)))496+ .child(actions)
435- .child(div().flex().flex_col().gap(px(space::XS)).children(rows))
436 }497 }
437 498
438 fn moderation_rows(499 fn moderation_rows(
@@ -448,7 +509,7 @@ impl Card {
448 509
449 for rank in [Rank::Member, Rank::Moderator, Rank::Admin] {510 for rank in [Rank::Member, Rank::Moderator, Rank::Admin] {
450 if target != Some(rank) && permission::can_set_rank(actor, target, rank) {511 if target != Some(rank) && permission::can_set_rank(actor, target, rank) {
451- let label = format!("Make {}", rank.label().to_lowercase());512+ let label = w().profile.make_rank(rank.label().to_lowercase());
452 rows.push(513 rows.push(
453 menu_row(514 menu_row(
454 label.clone(),515 label.clone(),
@@ -471,7 +532,7 @@ impl Card {
471 rows.push(532 rows.push(
472 menu_row(533 menu_row(
473 "kick",534 "kick",
474- "Kick",535+ w().profile.kick,
475 menu_icon(IconName::Close),536 menu_icon(IconName::Close),
476 palette.danger,537 palette.danger,
477 palette,538 palette,
@@ -484,7 +545,7 @@ impl Card {
484 rows.push(545 rows.push(
485 menu_row(546 menu_row(
486 "ban",547 "ban",
487- "Ban",548+ w().profile.ban,
488 menu_icon(IconName::Ban),549 menu_icon(IconName::Ban),
489 palette.danger,550 palette.danger,
490 palette,551 palette,
@@ -502,9 +563,9 @@ impl Card {
502 .is_some_and(|viewer| permission::can_delete_user(viewer.role, false, self.user.role));563 .is_some_and(|viewer| permission::can_delete_user(viewer.role, false, self.user.role));
503 if deletable {564 if deletable {
504 let label = if self.confirming {565 let label = if self.confirming {
505- "Confirm"566+ w().profile.confirm
506 } else {567 } else {
507- "Delete user"568+ w().profile.delete_user
508 };569 };
509 570
510 rows.push(571 rows.push(
@@ -527,46 +588,27 @@ impl Card {
527 fn self_rows(588 fn self_rows(
528 others: &[(Id, String)],589 others: &[(Id, String)],
529 card_menu: CardMenu,590 card_menu: CardMenu,
530- presence: Presence,
531 entity: &Entity<Yumush>,591 entity: &Entity<Yumush>,
532 popover: &Entity<PopoverState>,592 popover: &Entity<PopoverState>,
533 palette: Palette,593 palette: Palette,
534 ) -> Vec<AnyElement> {594 ) -> Vec<AnyElement> {
535 match card_menu {595 match card_menu {
596+ CardMenu::Accounts => accounts_rows(others, entity, popover, palette),
536 CardMenu::Main | CardMenu::More | CardMenu::Status => {597 CardMenu::Main | CardMenu::More | CardMenu::Status => {
537- main_self_rows(presence, entity, popover, palette)598+ main_self_rows(entity, popover, palette)
538 }599 }
539- CardMenu::Accounts => accounts_rows(others, entity, popover, palette),
540- CardMenu::Presence => presence_rows(entity, palette),
541 }600 }
542 }601 }
543 602
544 fn main_self_rows(603 fn main_self_rows(
545- presence: Presence,
546 entity: &Entity<Yumush>,604 entity: &Entity<Yumush>,
547 popover: &Entity<PopoverState>,605 popover: &Entity<PopoverState>,
548 palette: Palette,606 palette: Palette,
549 ) -> Vec<AnyElement> {607 ) -> Vec<AnyElement> {
550 vec![608 vec![
551- drill_row(menu_row(
552- "profile_presence",
553- presence.label(),
554- presence_dot(presence, palette),
555- palette.text,
556- palette,
557- card_menu_action(entity, CardMenu::Presence),
558- )),
559- drill_row(menu_row(
560- "profile_accounts",
561- "Accounts",
562- menu_icon(IconName::CircleUser),
563- palette.text,
564- palette,
565- card_menu_action(entity, CardMenu::Accounts),
566- )),
567 menu_row(609 menu_row(
568 "profile_settings",610 "profile_settings",
569- "Settings",611+ w().profile.settings,
570 menu_icon(IconName::Settings),612 menu_icon(IconName::Settings),
571 palette.text,613 palette.text,
572 palette,614 palette,
@@ -577,7 +619,7 @@ fn main_self_rows(
577 .into_any_element(),619 .into_any_element(),
578 menu_row(620 menu_row(
579 "profile_logout",621 "profile_logout",
580- "Log out",622+ w().profile.log_out,
581 menu_icon(IconName::LogOut),623 menu_icon(IconName::LogOut),
582 palette.danger,624 palette.danger,
583 palette,625 palette,
@@ -609,15 +651,6 @@ fn accounts_rows(
609 });651 });
610 652
611 vec![653 vec![
612- menu_row(
613- "profile_accounts_back",
614- "Accounts",
615- menu_icon(IconName::ArrowLeft),
616- palette.muted,
617- palette,
618- card_menu_action(entity, CardMenu::Main),
619- )
620- .into_any_element(),
621 div()654 div()
622 .id("profile_accounts")655 .id("profile_accounts")
623 .max_h(px(ACCOUNTS_MAX_H))656 .max_h(px(ACCOUNTS_MAX_H))
@@ -628,7 +661,7 @@ fn accounts_rows(
628 .into_any_element(),661 .into_any_element(),
629 menu_row(662 menu_row(
630 "profile_add_account",663 "profile_add_account",
631- "Add account",664+ w().profile.add_account,
632 menu_icon(IconName::UserPlus),665 menu_icon(IconName::UserPlus),
633 palette.text,666 palette.text,
634 palette,667 palette,
@@ -640,34 +673,36 @@ fn accounts_rows(
640 ]673 ]
641 }674 }
642 675
643-fn presence_rows(entity: &Entity<Yumush>, palette: Palette) -> Vec<AnyElement> {676+fn account_toggle(
644- let mut rows = vec![677+ card_menu: CardMenu,
645- menu_row(678+ entity: &Entity<Yumush>,
646- "profile_presence_back",679+ palette: Palette,
647- "Status",680+) -> impl IntoElement {
648- menu_icon(IconName::ArrowLeft),681+ let open = card_menu == CardMenu::Accounts;
649- palette.muted,682+ clickable(
650- palette,683+ "profile_accounts",
651- card_menu_action(entity, CardMenu::Main),684+ palette,
652- )685+ card_menu_action(
653- .into_any_element(),686+ entity,
654- ];687+ if open {
655-688+ CardMenu::Main
656- rows.extend(Presence::ALL.into_iter().map(|presence| {689+ } else {
657- menu_row(690+ CardMenu::Accounts
658- format!("presence_{}", presence.as_str()),691+ },
659- presence.label(),692+ ),
660- presence_dot(presence, palette),693+ )
661- palette.text,694+ .tip(w().profile.accounts)
662- palette,695+ .rounded(px(radius::SM))
663- entity_action(entity, move |yumush, window, cx| {696+ .flex_shrink_0()
664- yumush.set_presence(presence, window, cx)697+ .child(
665- }),698+ Icon::new(if open {
666- )699+ IconName::ChevronUp
667- .into_any_element()700+ } else {
668- }));701+ IconName::ChevronDown
669-702+ })
670- rows703+ .size(px(size::ICON_SM))
704+ .text_color(palette.muted),
705+ )
671 }706 }
672 707
673 fn edit_status(entity: &Entity<Yumush>, status: &str, palette: Palette) -> impl IntoElement {708 fn edit_status(entity: &Entity<Yumush>, status: &str, palette: Palette) -> impl IntoElement {
@@ -684,7 +719,7 @@ fn edit_status(entity: &Entity<Yumush>, status: &str, palette: Palette) -> impl
684 cx.notify();719 cx.notify();
685 }),720 }),
686 )721 )
687- .tip("Edit status")722+ .tip(w().profile.edit_status)
688 .flex_none()723 .flex_none()
689 .p(px(space::XXS))724 .p(px(space::XXS))
690 .rounded(px(radius::SM))725 .rounded(px(radius::SM))
@@ -705,13 +740,6 @@ fn card_menu_action(
705 })740 })
706 }741 }
707 742
708-fn presence_dot(presence: Presence, palette: Palette) -> Div {
709- div()
710- .size(px(space::SM))
711- .rounded_full()
712- .bg(presence_color(presence, palette))
713-}
714-
715 fn yumush_action(743 fn yumush_action(
716 entity: &Entity<Yumush>,744 entity: &Entity<Yumush>,
717 popover: &Entity<PopoverState>,745 popover: &Entity<PopoverState>,
@@ -751,6 +779,65 @@ fn menu_icon(icon: IconName) -> Icon {
751 Icon::new(icon).size(px(size::ICON_SM))779 Icon::new(icon).size(px(size::ICON_SM))
752 }780 }
753 781
782+fn presence_dot(presence: Presence, palette: Palette) -> Div {
783+ div()
784+ .size(px(space::LG))
785+ .rounded_full()
786+ .border_2()
787+ .border_color(palette.tokens.raise())
788+ .bg(super::presence_color(presence, palette))
789+}
790+
791+fn presence_menu(current: Presence, entity: &Entity<Yumush>, palette: Palette) -> Popover {
792+ let entity = entity.clone();
793+ Popover::new("presence_menu")
794+ .anchor(Anchor::TopLeft)
795+ .appearance(false)
796+ .trigger(Trigger::new(
797+ clickable("presence_dot", palette, |_, _| {})
798+ .rounded_full()
799+ .child(presence_dot(current, palette)),
800+ ))
801+ .content(move |_, _, cx| {
802+ let popover = cx.entity();
803+ super::parts::popover(palette.tokens)
804+ .p(px(space::XS))
805+ .children(Presence::ALL.into_iter().map(|presence| {
806+ let popover = popover.clone();
807+ menu_row(
808+ ("presence", presence as usize),
809+ presence.label(),
810+ div()
811+ .size(px(size::ICON_SM))
812+ .flex()
813+ .items_center()
814+ .justify_center()
815+ .child(
816+ div()
817+ .size(px(space::SM))
818+ .rounded_full()
819+ .bg(super::presence_color(presence, palette)),
820+ ),
821+ if presence == current {
822+ palette.text
823+ } else {
824+ palette.muted
825+ },
826+ palette,
827+ {
828+ let entity = entity.clone();
829+ move |window, cx| {
830+ popover.update(cx, |state, cx| state.dismiss(window, cx));
831+ entity.update(cx, |yumush, cx| {
832+ yumush.set_presence(presence, window, cx)
833+ });
834+ }
835+ },
836+ )
837+ }))
838+ })
839+}
840+
754 fn menu_row(841 fn menu_row(
755 id: impl Into<ElementId>,842 id: impl Into<ElementId>,
756 label: impl Into<SharedString>,843 label: impl Into<SharedString>,
@@ -771,12 +858,6 @@ fn menu_row(
771 .child(label.into())858 .child(label.into())
772 }859 }
773 860
774-fn drill_row(row: Stateful<Div>) -> AnyElement {
775- row.child(div().flex_1())
776- .child(menu_icon(IconName::ChevronRight))
777- .into_any_element()
778-}
779-
780 impl Yumush {861 impl Yumush {
781 fn open_removal(862 fn open_removal(
782 &self,863 &self,
@@ -791,7 +872,7 @@ impl Yumush {
791 input_dialog(872 input_dialog(
792 removal.title(),873 removal.title(),
793 removal.title(),874 removal.title(),
794- "Reason (optional)",875+ w().profile.reason_optional,
795 window,876 window,
796 cx,877 cx,
797 move |this, text, window, cx| {878 move |this, text, window, cx| {
crates/client/src/gui/settings_page.rsmodified+64 -34
@@ -1,3 +1,4 @@
1+use crate::lang::{self, Label as _, Lang, w};
1 use std::future::Future;2 use std::future::Future;
2 3
3 use crate::net::Fail;4 use crate::net::Fail;
@@ -22,7 +23,7 @@ use super::{
22 chat::DeleteStep,23 chat::DeleteStep,
23 chat::View,24 chat::View,
24 clickable, notify_error, parts, primary_button,25 clickable, notify_error, parts, primary_button,
25- share_view::{AudioMode, CODECS, FPS, RESOLUTIONS, share_modes},26+ share_view::{AudioMode, FPS, RESOLUTIONS, codecs, share_modes},
26 text,27 text,
27 widget::field,28 widget::field,
28 };29 };
@@ -32,7 +33,12 @@ use crate::{
32 share::encode::capabilities,33 share::encode::capabilities,
33 };34 };
34 35
35-pub(super) const SETTINGS: [&str; 4] = ["Profile", "Voice", "Camera & share", "Appearance"];36+pub(super) const SETTINGS_IDS: [&str; 4] = ["profile", "voice", "camera_share", "appearance"];
37+
38+pub(super) fn settings_titles() -> [&'static str; 4] {
39+ let w = &w().settings_page;
40+ [w.profile, w.voice, w.camera_share, w.appearance]
41+}
36 42
37 impl Yumush {43 impl Yumush {
38 pub(super) fn settings_page(44 pub(super) fn settings_page(
@@ -46,7 +52,7 @@ impl Yumush {
46 let presence_entity = entity.clone();52 let presence_entity = entity.clone();
47 let logout_entity = entity.clone();53 let logout_entity = entity.clone();
48 sections.push(Section(54 sections.push(Section(
49- SETTINGS[0],55+ settings_titles()[0],
50 div()56 div()
51 .flex()57 .flex()
52 .flex_col()58 .flex_col()
@@ -71,7 +77,7 @@ impl Yumush {
71 palette,77 palette,
72 ))78 ))
73 .child(titled(79 .child(titled(
74- "Identity",80+ w().settings_page.identity,
75 palette,81 palette,
76 rows_column(82 rows_column(
77 palette,83 palette,
@@ -79,7 +85,7 @@ impl Yumush {
79 text_row(85 text_row(
80 Editable {86 Editable {
81 id: "save_username_button",87 id: "save_username_button",
82- label: "Name",88+ label: w().settings_page.name,
83 input: &self.chat.username_input,89 input: &self.chat.username_input,
84 current: &user.username,90 current: &user.username,
85 save: Yumush::save_username,91 save: Yumush::save_username,
@@ -91,7 +97,7 @@ impl Yumush {
91 text_row(97 text_row(
92 Editable {98 Editable {
93 id: "save_status_button",99 id: "save_status_button",
94- label: "Status",100+ label: w().settings_page.status,
95 input: &self.chat.status_input,101 input: &self.chat.status_input,
96 current: &user.status,102 current: &user.status,
97 save: Yumush::save_status,103 save: Yumush::save_status,
@@ -101,7 +107,7 @@ impl Yumush {
101 cx,107 cx,
102 ),108 ),
103 row(109 row(
104- "Presence",110+ w().settings_page.presence,
105 parts::options(111 parts::options(
106 "presence",112 "presence",
107 Presence::ALL.map(|presence| (presence, presence.label())),113 Presence::ALL.map(|presence| (presence, presence.label())),
@@ -118,12 +124,12 @@ impl Yumush {
118 ),124 ),
119 ))125 ))
120 .child(titled(126 .child(titled(
121- "Account",127+ w().settings_page.account,
122 palette,128 palette,
123 rows_column(129 rows_column(
124 palette,130 palette,
125 vec![row(131 vec![row(
126- "Log out",132+ w().settings_page.log_out,
127 small_button(133 small_button(
128 "logout_button",134 "logout_button",
129 palette,135 palette,
@@ -133,7 +139,7 @@ impl Yumush {
133 .update(cx, |yumush, cx| yumush.logout(window, cx))139 .update(cx, |yumush, cx| yumush.logout(window, cx))
134 },140 },
135 )141 )
136- .child("Log out"),142+ .child(w().settings_page.log_out),
137 )],143 )],
138 ),144 ),
139 ))145 ))
@@ -141,14 +147,17 @@ impl Yumush {
141 ));147 ));
142 }148 }
143 sections.push(section(149 sections.push(section(
144- SETTINGS[1],150+ settings_titles()[1],
145 palette,151 palette,
146 self.voice_rows(entity, palette, cx),152 self.voice_rows(entity, palette, cx),
147 ));153 ));
148- sections.push(Section(SETTINGS[2], camera_share(self, entity, palette)));154+ sections.push(Section(
155+ settings_titles()[2],
156+ camera_share(self, entity, palette),
157+ ));
149 let mut appearance = vec![158 let mut appearance = vec![
150 row(159 row(
151- "Theme",160+ w().settings_page.theme,
152 segmented(161 segmented(
153 Theme::ALL.map(|choice| (choice, choice.label())),162 Theme::ALL.map(|choice| (choice, choice.label())),
154 self.settings.theme,163 self.settings.theme,
@@ -158,7 +167,7 @@ impl Yumush {
158 ),167 ),
159 ),168 ),
160 row(169 row(
161- "Font size",170+ w().settings_page.font_size,
162 segmented(171 segmented(
163 FontSize::ALL.map(|size| (size, size.label())),172 FontSize::ALL.map(|size| (size, size.label())),
164 self.settings.font_size,173 self.settings.font_size,
@@ -168,7 +177,17 @@ impl Yumush {
168 ),177 ),
169 ),178 ),
170 row(179 row(
171- "Close to tray",180+ w().settings_page.language,
181+ segmented(
182+ Lang::ALL.map(|lang| (lang, lang.words().common.language)),
183+ self.settings.language,
184+ entity,
185+ palette,
186+ Yumush::set_language,
187+ ),
188+ ),
189+ row(
190+ w().settings_page.close_to_tray,
172 super::parts::toggle(191 super::parts::toggle(
173 "close_to_tray_switch",192 "close_to_tray_switch",
174 self.settings.close_to_tray,193 self.settings.close_to_tray,
@@ -187,16 +206,16 @@ impl Yumush {
187 ];206 ];
188 if let Some(user) = self.user.as_ref() {207 if let Some(user) = self.user.as_ref() {
189 appearance.push(row(208 appearance.push(row(
190- "Your hue",209+ w().settings_page.your_hue,
191 hue_picker(Some(style::hue_of(user.id)), entity, palette),210 hue_picker(Some(style::hue_of(user.id)), entity, palette),
192 ));211 ));
193 }212 }
194- sections.push(section(SETTINGS[3], palette, appearance));213+ sections.push(section(settings_titles()[3], palette, appearance));
195 if self.user.is_some() {214 if self.user.is_some() {
196 sections.push(danger_section(215 sections.push(danger_section(
197 palette,216 palette,
198 vec![row(217 vec![row(
199- "Delete account",218+ w().settings_page.delete_account,
200 delete_control(219 delete_control(
201 "delete_account_button",220 "delete_account_button",
202 self.chat.delete_step,221 self.chat.delete_step,
@@ -212,7 +231,7 @@ impl Yumush {
212 "settings_scroll",231 "settings_scroll",
213 entity,232 entity,
214 palette,233 palette,
215- "Settings",234+ w().settings_page.title,
216 sections,235 sections,
217 self.chat.section,236 self.chat.section,
218 )237 )
@@ -332,6 +351,13 @@ impl Yumush {
332 self.commit_settings(cx);351 self.commit_settings(cx);
333 }352 }
334 353
354+ pub(super) fn set_language(&mut self, language: Lang, cx: &mut Context<Self>) {
355+ self.settings.language = language;
356+ lang::set(language);
357+ self.commit_settings(cx);
358+ cx.refresh_windows();
359+ }
360+
335 pub(super) fn commit_settings(&mut self, cx: &mut Context<Self>) {361 pub(super) fn commit_settings(&mut self, cx: &mut Context<Self>) {
336 settings::save(&self.settings);362 settings::save(&self.settings);
337 self.network.set_voice_settings(&self.settings.voice);363 self.network.set_voice_settings(&self.settings.voice);
@@ -388,12 +414,12 @@ fn camera_share(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> A
388 .flex_col()414 .flex_col()
389 .gap(px(space::XL))415 .gap(px(space::XL))
390 .child(titled(416 .child(titled(
391- "Camera",417+ w().settings_page.camera,
392 palette,418 palette,
393 rows_column(palette, camera_rows(yumush, entity, palette)),419 rows_column(palette, camera_rows(yumush, entity, palette)),
394 ))420 ))
395 .child(titled(421 .child(titled(
396- "Screen share",422+ w().settings_page.screen_share,
397 palette,423 palette,
398 rows_column(palette, screen_rows(yumush, entity, palette)),424 rows_column(palette, screen_rows(yumush, entity, palette)),
399 ))425 ))
@@ -407,7 +433,7 @@ fn camera_rows(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> Ve
407 let (resolutions, fps) = share::options(&modes, top.resolution, max_height);433 let (resolutions, fps) = share::options(&modes, top.resolution, max_height);
408 vec![434 vec![
409 row(435 row(
410- "Quality",436+ w().settings_page.quality,
411 parts::options(437 parts::options(
412 "camera_quality",438 "camera_quality",
413 RESOLUTIONS439 RESOLUTIONS
@@ -419,7 +445,7 @@ fn camera_rows(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> Ve
419 ),445 ),
420 ),446 ),
421 row(447 row(
422- "Frame rate",448+ w().settings_page.frame_rate,
423 parts::options(449 parts::options(
424 "camera_fps",450 "camera_fps",
425 FPS.into_iter().filter(|(value, _)| fps.contains(value)),451 FPS.into_iter().filter(|(value, _)| fps.contains(value)),
@@ -441,7 +467,7 @@ fn screen_rows(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> Ve
441 let audio_entity = entity.clone();467 let audio_entity = entity.clone();
442 vec![468 vec![
443 row(469 row(
444- "Quality",470+ w().settings_page.quality,
445 parts::options(471 parts::options(
446 "screen_quality",472 "screen_quality",
447 RESOLUTIONS473 RESOLUTIONS
@@ -453,7 +479,7 @@ fn screen_rows(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> Ve
453 ),479 ),
454 ),480 ),
455 row(481 row(
456- "Frame rate",482+ w().settings_page.frame_rate,
457 parts::options(483 parts::options(
458 "screen_fps",484 "screen_fps",
459 FPS.into_iter().filter(|(value, _)| fps.contains(value)),485 FPS.into_iter().filter(|(value, _)| fps.contains(value)),
@@ -463,10 +489,10 @@ fn screen_rows(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> Ve
463 ),489 ),
464 ),490 ),
465 row(491 row(
466- "Codec",492+ w().settings_page.codec,
467 parts::options(493 parts::options(
468 "share_codec",494 "share_codec",
469- CODECS.into_iter().filter(|(codec, _)| match codec {495+ codecs().into_iter().filter(|(codec, _)| match codec {
470 ShareCodec::Auto => true,496 ShareCodec::Auto => true,
471 ShareCodec::Only(codec) => capabilities().encode.contains(codec),497 ShareCodec::Only(codec) => capabilities().encode.contains(codec),
472 }),498 }),
@@ -476,7 +502,7 @@ fn screen_rows(yumush: &Yumush, entity: &Entity<Yumush>, palette: Palette) -> Ve
476 ),502 ),
477 ),503 ),
478 row(504 row(
479- "Share audio",505+ w().settings_page.share_audio,
480 parts::toggle(506 parts::toggle(
481 "share_audio_switch",507 "share_audio_switch",
482 audio_on,508 audio_on,
@@ -552,7 +578,7 @@ pub(super) fn header(
552 clickable("settings_back_button", palette, move |window, cx| {578 clickable("settings_back_button", palette, move |window, cx| {
553 entity.update(cx, |yumush, cx| yumush.show_view(View::Chat, window, cx));579 entity.update(cx, |yumush, cx| yumush.show_view(View::Chat, window, cx));
554 })580 })
555- .tip("Back")581+ .tip(w().settings_page.back)
556 .h(px(size::CONTROL_SM))582 .h(px(size::CONTROL_SM))
557 .px(px(space::SM))583 .px(px(space::SM))
558 .rounded(px(radius::MD))584 .rounded(px(radius::MD))
@@ -645,7 +671,7 @@ pub(super) fn section(title: &'static str, palette: Palette, rows: Vec<Div>) ->
645 }671 }
646 672
647 pub(super) fn danger_section(palette: Palette, rows: Vec<Div>) -> Section {673 pub(super) fn danger_section(palette: Palette, rows: Vec<Div>) -> Section {
648- Section("Danger zone", rows_column(palette, rows))674+ Section(w().settings_page.danger_zone, rows_column(palette, rows))
649 }675 }
650 676
651 fn titled(title: &'static str, palette: Palette, rows: impl IntoElement) -> Div {677 fn titled(title: &'static str, palette: Palette, rows: impl IntoElement) -> Div {
@@ -714,7 +740,7 @@ pub(super) fn text_row(
714 .items_center()740 .items_center()
715 .rounded(px(radius::MD))741 .rounded(px(radius::MD))
716 .font_weight(FontWeight::MEDIUM)742 .font_weight(FontWeight::MEDIUM)
717- .child("Save"),743+ .child(w().settings_page.save),
718 )744 )
719 }),745 }),
720 )746 )
@@ -755,7 +781,7 @@ pub(super) fn picture_card(picture: Picture, entity: &Entity<Yumush>, palette: P
755 .on_click(move |_, window, cx| {781 .on_click(move |_, window, cx| {
756 picture_entity.update(cx, |yumush, cx| upload(yumush, window, cx));782 picture_entity.update(cx, |yumush, cx| upload(yumush, window, cx));
757 })783 })
758- .tip("Change picture")784+ .tip(w().settings_page.change_picture)
759 .child(image),785 .child(image),
760 )786 )
761 .child(787 .child(
@@ -794,7 +820,7 @@ pub(super) fn picture_card(picture: Picture, entity: &Entity<Yumush>, palette: P
794 remove_entity.update(cx, |yumush, cx| remove(yumush, window, cx));820 remove_entity.update(cx, |yumush, cx| remove(yumush, window, cx));
795 },821 },
796 )822 )
797- .child("Remove")823+ .child(w().settings_page.remove)
798 }))824 }))
799 }825 }
800 826
@@ -832,7 +858,11 @@ pub(super) fn delete_control(
832 .when(confirming, |this| {858 .when(confirming, |this| {
833 this.bg(palette.danger).text_color(palette.on_accent)859 this.bg(palette.danger).text_color(palette.on_accent)
834 })860 })
835- .child(if confirming { "Confirm" } else { "Delete" })861+ .child(if confirming {
862+ w().settings_page.confirm
863+ } else {
864+ w().settings_page.delete
865+ })
836 }866 }
837 867
838 pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div {868 pub(super) fn row(label: &'static str, control: impl IntoElement) -> Div {
crates/client/src/gui/share_view.rsmodified+39 -30
@@ -6,6 +6,7 @@ use std::{
6 6
7 use common::share::{Codec, Fps, Kind, Mode, Quality, Resolution, clamp, options};7 use common::share::{Codec, Fps, Kind, Mode, Quality, Resolution, clamp, options};
8 8
9+use crate::lang::w;
9 use crate::share::Target;10 use crate::share::Target;
10 11
11 const FULL_VOLUME: f32 = 100.;12 const FULL_VOLUME: f32 = 100.;
@@ -81,12 +82,14 @@ pub(super) const RESOLUTIONS: [(Resolution, &str); 6] = [
81 ];82 ];
82 pub(super) const FPS: [(Fps, &str); 3] = [(Fps::F15, "15"), (Fps::F30, "30"), (Fps::F60, "60")];83 pub(super) const FPS: [(Fps, &str); 3] = [(Fps::F15, "15"), (Fps::F30, "30"), (Fps::F60, "60")];
83 84
84-pub(super) const CODECS: [(ShareCodec, &str); 4] = [85+pub(super) fn codecs() -> [(ShareCodec, &'static str); 4] {
85- (ShareCodec::Auto, "Auto"),86+ [
86- (ShareCodec::Only(Codec::Av1), "AV1"),87+ (ShareCodec::Auto, w().share_view.auto),
87- (ShareCodec::Only(Codec::H265), "H265"),88+ (ShareCodec::Only(Codec::Av1), "AV1"),
88- (ShareCodec::Only(Codec::H264), "H264"),89+ (ShareCodec::Only(Codec::H265), "H265"),
89-];90+ (ShareCodec::Only(Codec::H264), "H264"),
91+ ]
92+}
90 93
91 #[derive(Clone, Copy, PartialEq, Eq)]94 #[derive(Clone, Copy, PartialEq, Eq)]
92 pub(super) enum AudioMode {95 pub(super) enum AudioMode {
@@ -96,11 +99,13 @@ pub(super) enum AudioMode {
96 }99 }
97 100
98 impl AudioMode {101 impl AudioMode {
99- const ALL: [(Self, &'static str); 3] = [102+ fn all() -> [(Self, &'static str); 3] {
100- (Self::Off, "Off"),103+ [
101- (Self::Everything, "All"),104+ (Self::Off, w().share_view.off),
102- (Self::App, "Pick"),105+ (Self::Everything, w().share_view.all),
103- ];106+ (Self::App, w().share_view.pick),
107+ ]
108+ }
104 109
105 fn of(audio: &ShareAudio) -> Self {110 fn of(audio: &ShareAudio) -> Self {
106 match audio {111 match audio {
@@ -194,7 +199,7 @@ impl Yumush {
194 .rounded(px(radius::MD))199 .rounded(px(radius::MD))
195 .child(div().flex_1().min_w_0().truncate().child(name.clone()))200 .child(div().flex_1().min_w_0().truncate().child(name.clone()))
196 });201 });
197- dialog.title("Share").w(px(size::SHEET)).child(202+ dialog.title(w().share_view.share).w(px(size::SHEET)).child(
198 div()203 div()
199 .id("share_targets")204 .id("share_targets")
200 .max_h(px(size::POPOVER))205 .max_h(px(size::POPOVER))
@@ -556,12 +561,12 @@ impl Yumush {
556 Kind::Screen => (561 Kind::Screen => (
557 "screen_settings",562 "screen_settings",
558 "screen_settings_button",563 "screen_settings_button",
559- "Screen settings",564+ w().share_view.screen_settings,
560 ),565 ),
561 Kind::Camera => (566 Kind::Camera => (
562 "camera_settings",567 "camera_settings",
563 "camera_settings_button",568 "camera_settings_button",
564- "Camera settings",569+ w().share_view.camera_settings,
565 ),570 ),
566 };571 };
567 572
@@ -746,7 +751,7 @@ impl Yumush {
746 .flex()751 .flex()
747 .justify_center()752 .justify_center()
748 .child(scrim(palette.tokens).child(parts::words(753 .child(scrim(palette.tokens).child(parts::words(
749- "Esc to leave fullscreen",754+ w().share_view.esc_exit,
750 parts::Text::Label,755 parts::Text::Label,
751 parts::Ink::Dim,756 parts::Ink::Dim,
752 palette.tokens,757 palette.tokens,
@@ -758,9 +763,9 @@ impl Yumush {
758 763
759 fn viewer_pane(&self, viewer: &Viewer, entity: &Entity<Self>, palette: Palette) -> Div {764 fn viewer_pane(&self, viewer: &Viewer, entity: &Entity<Self>, palette: Palette) -> Div {
760 let (fullscreen_icon, fullscreen_tip) = if viewer.fullscreen {765 let (fullscreen_icon, fullscreen_tip) = if viewer.fullscreen {
761- (IconName::Minimize, "Exit fullscreen")766+ (IconName::Minimize, w().share_view.exit_fullscreen)
762 } else {767 } else {
763- (IconName::Maximize, "Fullscreen")768+ (IconName::Maximize, w().share_view.fullscreen)
764 };769 };
765 let audio = viewer.kind == Kind::Screen;770 let audio = viewer.kind == Kind::Screen;
766 let t = palette.tokens;771 let t = palette.tokens;
@@ -812,7 +817,7 @@ impl Yumush {
812 parts::icon_button(817 parts::icon_button(
813 "viewer_stats_button",818 "viewer_stats_button",
814 IconName::ChartBar,819 IconName::ChartBar,
815- "Stream stats",820+ w().share_view.stream_stats,
816 if viewer.stats { Tone::On } else { Tone::Idle },821 if viewer.stats { Tone::On } else { Tone::Idle },
817 t,822 t,
818 move |_, cx| {823 move |_, cx| {
@@ -865,7 +870,11 @@ impl Yumush {
865 } else {870 } else {
866 IconName::Volume2871 IconName::Volume2
867 },872 },
868- if muted { "Unmute" } else { "Mute" },873+ if muted {
874+ w().share_view.unmute
875+ } else {
876+ w().share_view.mute
877+ },
869 entity_action(entity, |yumush, window, cx| {878 entity_action(entity, |yumush, window, cx| {
870 yumush.toggle_share_mute(window, cx)879 yumush.toggle_share_mute(window, cx)
871 }),880 }),
@@ -887,7 +896,7 @@ impl Yumush {
887 "share_close".to_string(),896 "share_close".to_string(),
888 palette,897 palette,
889 IconName::X,898 IconName::X,
890- "Close",899+ w().share_view.close,
891 entity_action(entity, |yumush, _, cx| yumush.close_viewer(cx)),900 entity_action(entity, |yumush, _, cx| yumush.close_viewer(cx)),
892 )),901 )),
893 ),902 ),
@@ -903,7 +912,7 @@ fn settings_card(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) ->
903 Kind::Camera => card.child(camera_devices(entity, yumush, palette)),912 Kind::Camera => card.child(camera_devices(entity, yumush, palette)),
904 Kind::Screen => card913 Kind::Screen => card
905 .child(div().px(px(space::SM)).child(segmented(914 .child(div().px(px(space::SM)).child(segmented(
906- AudioMode::ALL,915+ AudioMode::all(),
907 AudioMode::of(&settings.audio),916 AudioMode::of(&settings.audio),
908 entity,917 entity,
909 palette,918 palette,
@@ -929,7 +938,7 @@ fn camera_devices(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) ->
929 return div()938 return div()
930 .px(px(space::SM))939 .px(px(space::SM))
931 .text_color(palette.muted)940 .text_color(palette.muted)
932- .child("No camera");941+ .child(w().share_view.no_camera);
933 }942 }
934 div().flex().flex_col().gap(px(space::XXS)).children(943 div().flex().flex_col().gap(px(space::XXS)).children(
935 yumush944 yumush
@@ -983,7 +992,7 @@ fn quality_toggle(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) ->
983 "{} · {} fps · {}",992 "{} · {} fps · {}",
984 label(&RESOLUTIONS, top.resolution),993 label(&RESOLUTIONS, top.resolution),
985 label(&FPS, top.fps),994 label(&FPS, top.fps),
986- label(&CODECS, yumush.settings.share.codec),995+ label(&codecs(), yumush.settings.share.codec),
987 );996 );
988 let entity = entity.clone();997 let entity = entity.clone();
989 row_style(clickable("share_quality", palette, move |_, cx| {998 row_style(clickable("share_quality", palette, move |_, cx| {
@@ -1014,7 +1023,7 @@ fn quality_rows(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> [
1014 let t = palette.tokens;1023 let t = palette.tokens;
1015 [1024 [
1016 super::parts::quick_row(1025 super::parts::quick_row(
1017- "Resolution",1026+ w().share_view.resolution,
1018 segmented(1027 segmented(
1019 RESOLUTIONS1028 RESOLUTIONS
1020 .into_iter()1029 .into_iter()
@@ -1038,9 +1047,9 @@ fn quality_rows(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> [
1038 t,1047 t,
1039 ),1048 ),
1040 super::parts::quick_row(1049 super::parts::quick_row(
1041- "Codec",1050+ w().share_view.codec,
1042 segmented(1051 segmented(
1043- CODECS.into_iter().filter(|(codec, _)| match codec {1052+ codecs().into_iter().filter(|(codec, _)| match codec {
1044 ShareCodec::Auto => true,1053 ShareCodec::Auto => true,
1045 ShareCodec::Only(codec) => capabilities().encode.contains(codec),1054 ShareCodec::Only(codec) => capabilities().encode.contains(codec),
1046 }),1055 }),
@@ -1081,7 +1090,7 @@ fn audio_list(entity: &Entity<Yumush>, yumush: &Yumush, palette: Palette) -> Opt
1081 apps.into_iter()1090 apps.into_iter()
1082 .map(|app| include_row(entity, settings, app, palette)),1091 .map(|app| include_row(entity, settings, app, palette)),
1083 );1092 );
1084- field("Sound from", app_list(rows), palette).into_any_element()1093+ field(w().share_view.sound_from, app_list(rows), palette).into_any_element()
1085 })1094 })
1086 }1095 }
1087 audio => {1096 audio => {
@@ -1105,9 +1114,9 @@ fn pick_list(
1105 palette: Palette,1114 palette: Palette,
1106 ) -> Div {1115 ) -> Div {
1107 let groups = [1116 let groups = [
1108- (AudioKind::App, "Apps"),1117+ (AudioKind::App, w().share_view.apps),
1109- (AudioKind::Output, "Outputs"),1118+ (AudioKind::Output, w().share_view.outputs),
1110- (AudioKind::Input, "Inputs"),1119+ (AudioKind::Input, w().share_view.inputs),
1111 ];1120 ];
1112 1121
1113 div()1122 div()
crates/client/src/gui/sidebar.rsmodified+367 -210
@@ -1,15 +1,17 @@
1 use super::text;1 use super::text;
2+use crate::lang::w;
2 use crate::marks::Mark;3 use crate::marks::Mark;
3 use common::model::Id;4 use common::model::Id;
4 use common::{5 use common::{
5- model::{Community, CommunityKind, Invitation, Role, Unread, User},6+ model::{Community, CommunityKind, Invitation, Unread, User},
6 permission,7 permission,
7 share::Kind,8 share::Kind,
8 validate::validate_community_name,9 validate::validate_community_name,
9 };10 };
10 use gpui_kit::{11 use gpui_kit::{
11- Anchor, AnimationExt, AnyElement, App, Context, Div, Entity, FontWeight, InteractiveElement,12+ Anchor, AnimationExt, AnyElement, App, Context, Div, Entity, FontWeight, Hsla,
12- IntoElement, ParentElement, StatefulInteractiveElement, Styled, Window,13+ InteractiveElement, IntoElement, ParentElement, PathBuilder, StatefulInteractiveElement,
14+ Styled, Window,
13 assets::IconName,15 assets::IconName,
14 component::{16 component::{
15 Icon,17 Icon,
@@ -40,30 +42,50 @@ fn slide() -> gpui_kit::Animation {
40 42
41 impl Yumush {43 impl Yumush {
42 pub(super) fn sidebar(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement {44 pub(super) fn sidebar(&self, entity: &Entity<Self>, palette: Palette) -> impl IntoElement {
43- let collapsed = self.chat.sidebar_collapsed;45+ let content = if self.chat.sidebar_collapsed && !self.sliding() {
44- let (from, to, id) = if collapsed {
45- (size::SIDEBAR, size::RAIL, "sidebar_collapsing")
46- } else {
47- (size::RAIL, size::SIDEBAR, "sidebar_expanding")
48- };
49- let content = if collapsed {
50 self.collapsed_sidebar(entity, palette).into_any_element()46 self.collapsed_sidebar(entity, palette).into_any_element()
51 } else {47 } else {
52 self.expanded_sidebar(entity, palette)48 self.expanded_sidebar(entity, palette)
53 };49 };
54 50
55- let sidebar = div()51+ self.folding(
56- .h_full()52+ "sidebar",
57- .flex_shrink_0()53+ div()
58- .overflow_hidden()54+ .h_full()
59- .child(content);55+ .flex_shrink_0()
60- match self.chat.sidebar_toggled {56+ .overflow_hidden()
61- Some(at) if at.elapsed() < SLIDE => sidebar57+ .child(content),
62- .with_animation(id, slide(), move |sidebar, delta| {58+ |sidebar, f| sidebar.w(px(lerp(size::SIDEBAR, size::RAIL, f))),
63- sidebar.w(px(from + (to - from) * delta))59+ )
60+ }
61+
62+ pub(super) fn toggle_sidebar(&mut self) {
63+ self.chat.sidebar_collapsed = !self.chat.sidebar_collapsed;
64+ self.chat.sidebar_toggled = Some(std::time::Instant::now());
65+ }
66+
67+ fn sliding(&self) -> bool {
68+ self.chat
69+ .sidebar_toggled
70+ .is_some_and(|at| at.elapsed() < SLIDE)
71+ }
72+
73+ fn folding<E: IntoElement + 'static>(
74+ &self,
75+ id: &'static str,
76+ element: E,
77+ style: impl Fn(E, f32) -> E + 'static,
78+ ) -> AnyElement {
79+ let collapsed = self.chat.sidebar_collapsed;
80+ let fold = move |delta: f32| if collapsed { delta } else { 1. - delta };
81+ if self.sliding() {
82+ element
83+ .with_animation((id, collapsed as u64), slide(), move |element, delta| {
84+ style(element, fold(delta))
64 })85 })
65- .into_any_element(),86+ .into_any_element()
66- _ => sidebar.w(px(to)).into_any_element(),87+ } else {
88+ style(element, fold(1.)).into_any_element()
67 }89 }
68 }90 }
69 91
@@ -71,6 +93,7 @@ impl Yumush {
71 div()93 div()
72 .h_full()94 .h_full()
73 .w(px(size::RAIL))95 .w(px(size::RAIL))
96+ .pl(px(RAIL_SHIFT))
74 .flex()97 .flex()
75 .flex_col()98 .flex_col()
76 .items_center()99 .items_center()
@@ -82,8 +105,11 @@ impl Yumush {
82 .flex_col()105 .flex_col()
83 .items_center()106 .items_center()
84 .gap(px(space::MD))107 .gap(px(space::MD))
85- .child(logo_mark(palette).size(px(size::CONTROL)))108+ .child(self.logo_toggle(
86- .child(self.collapse_button(entity, palette)),109+ entity,
110+ palette,
111+ logo_mark(palette).size(px(size::CONTROL)),
112+ )),
87 )113 )
88 .child(114 .child(
89 div()115 div()
@@ -118,52 +144,79 @@ impl Yumush {
118 .h(px(size::CONTROL))144 .h(px(size::CONTROL))
119 .flex()145 .flex()
120 .items_center()146 .items_center()
121- .gap(px(space::XXS))147+ .gap(px(space::XS))
148+ .child(self.folding(
149+ "logo",
150+ div().relative().child(self.logo_toggle(
151+ entity,
152+ palette,
153+ self.folding(
154+ "logo_mark",
155+ logo_mark(palette).when(towing(self.wordmark_flipped), |mark| {
156+ mark.path(crate::logo::NEEDLE)
157+ }),
158+ |mark, f| mark.size(px(lerp(size::CHIP, size::CONTROL, f))),
159+ ),
160+ )),
161+ |logo, f| {
162+ logo.left(px(
163+ f * (RAIL_CENTER - space::LG - size::CONTROL / 2. - space::XXS)
164+ ))
165+ .top(px(f * (space::MD + space::XXS - space::LG)))
166+ },
167+ ))
122 .child(168 .child(
123- div()169+ self.folding(
124- .id("wordmark")170+ "wordmark_fold",
125- .flex_1()171+ div()
126- .px(px(space::SM))172+ .id("wordmark")
127- .text_size(text(text::TITLE))173+ .flex_1()
128- .font_weight(FontWeight::SEMIBOLD)174+ .text_size(text(text::TITLE))
129- .text_color(palette.text)175+ .line_height(gpui_kit::relative(LEADING))
130- .cursor_pointer()176+ .font_weight(FontWeight::SEMIBOLD)
131- .on_click({177+ .text_color(palette.text)
132- let entity = entity.clone();178+ .cursor_pointer()
133- move |_, _, cx| {179+ .on_click({
134- entity.update(cx, |yumush, cx| {180+ let entity = entity.clone();
135- yumush.wordmark_flips += 1;181+ move |_, window, cx| {
136- yumush.wordmark_flipped = Some(std::time::Instant::now());182+ entity.update(cx, |yumush, cx| yumush.open_jump(window, cx))
137- cx.notify();183+ }
138- })184+ })
139- }185+ .flex()
140- })186+ .items_center()
141- .flex()187+ .child("yumu")
142- .items_center()188+ .child(wordmark_tail(
143- .child(logo_mark(palette).mr(px(space::XXS)))189+ self.wordmark_flips,
144- .child("yumu")190+ self.wordmark_flipped,
145- .child(wordmark_tail(self.wordmark_flips, self.wordmark_flipped)),191+ palette,
192+ )),
193+ |word, f| {
194+ word.relative()
195+ .left(px(-space::XXL * f))
196+ .opacity((1. - 2. * f).max(0.))
197+ },
198+ ),
146 )199 )
147- .child(self.collapse_button(entity, palette))200+ .child(self.folding(
148- .child(icon_button(201+ "friends_fold",
149- "new_community_button",202+ div().child(self.friends_button(entity, friends_alert, palette)),
150- palette,203+ fade,
151- IconName::Plus,204+ )),
152- "New community",
153- new_community(entity),
154- ))
155- .child(self.friends_button(entity, friends_alert, palette)),
156 )205 )
157 .child(206 .child(
158- div()207+ self.folding(
159- .id("sidebar_list")208+ "list_fold",
160- .flex_1()209+ div()
161- .min_h_0()210+ .id("sidebar_list")
162- .overflow_y_scroll()211+ .flex_1()
163- .flex()212+ .min_h_0()
164- .flex_col()213+ .overflow_y_scroll()
165- .gap(px(space::MD))214+ .flex()
166- .children(self.sections(entity, palette)),215+ .flex_col()
216+ .gap(px(space::MD))
217+ .children(self.sections(entity, palette)),
218+ |list, f| fade(list, f).flex_1().min_h_0(),
219+ ),
167 )220 )
168 .children(self.account_row(entity, palette))221 .children(self.account_row(entity, palette))
169 .into_any_element()222 .into_any_element()
@@ -192,7 +245,7 @@ impl Yumush {
192 let fold = entity.clone();245 let fold = entity.clone();
193 div()246 div()
194 .id(format!("voice_chip_{community_id}"))247 .id(format!("voice_chip_{community_id}"))
195- .tip("In call")248+ .tip(w().sidebar.in_call)
196 .flex_1()249 .flex_1()
197 .flex()250 .flex()
198 .items_center()251 .items_center()
@@ -361,7 +414,7 @@ impl Yumush {
361 palette,414 palette,
362 go_to_call(entity, community),415 go_to_call(entity, community),
363 )416 )
364- .tip("Go to call")417+ .tip(w().sidebar.go_to_call)
365 .size(px(size::CONTROL_SM))418 .size(px(size::CONTROL_SM))
366 .flex()419 .flex()
367 .items_center()420 .items_center()
@@ -388,28 +441,46 @@ impl Yumush {
388 self.select_community(community_id, window, cx);441 self.select_community(community_id, window, cx);
389 }442 }
390 443
391- fn collapse_button(&self, entity: &Entity<Self>, palette: Palette) -> AnyElement {444+ pub(super) fn new_community(&mut self, window: &mut Window, cx: &mut Context<Self>) {
392- let (icon, tip) = if self.chat.sidebar_collapsed {445+ input_dialog(
393- (IconName::PanelLeftOpen, "Expand")446+ w().sidebar.new_community,
447+ w().sidebar.create,
448+ w().sidebar.name_placeholder,
449+ window,
450+ cx,
451+ |this, name, window, cx| {
452+ let name = name.trim().to_string();
453+ if validate_community_name(&name).is_ok() {
454+ create_community(this, name, window, cx);
455+ }
456+ },
457+ );
458+ }
459+
460+ fn logo_toggle(
461+ &self,
462+ entity: &Entity<Self>,
463+ palette: Palette,
464+ mark: impl IntoElement,
465+ ) -> AnyElement {
466+ let tip = if self.chat.sidebar_collapsed {
467+ w().sidebar.expand
394 } else {468 } else {
395- (IconName::PanelLeftClose, "Collapse")469+ w().sidebar.collapse
396 };470 };
397-471+ clickable(
398- icon_button(472+ "sidebar_toggle",
399- if self.chat.sidebar_collapsed {
400- "sidebar_expand"
401- } else {
402- "sidebar_collapse"
403- },
404 palette,473 palette,
405- icon,
406- tip,
407 entity_action(entity, |yumush, _, cx| {474 entity_action(entity, |yumush, _, cx| {
408- yumush.chat.sidebar_collapsed = !yumush.chat.sidebar_collapsed;475+ yumush.toggle_sidebar();
409- yumush.chat.sidebar_toggled = Some(std::time::Instant::now());
410 cx.notify();476 cx.notify();
411 }),477 }),
412 )478 )
479+ .tip(tip)
480+ .flex_none()
481+ .p(px(space::XXS))
482+ .rounded(px(radius::MD))
483+ .child(mark)
413 .into_any_element()484 .into_any_element()
414 }485 }
415 486
@@ -421,8 +492,9 @@ impl Yumush {
421 cx.notify();492 cx.notify();
422 }493 }
423 494
424- pub(super) fn close_friends(&mut self, cx: &mut Context<Self>) {495+ pub(super) fn close_friends(&mut self, window: &mut Window, cx: &mut Context<Self>) {
425 self.chat.friends_open = false;496 self.chat.friends_open = false;
497+ window.focus(&self.focus, cx);
426 cx.notify();498 cx.notify();
427 }499 }
428 500
@@ -477,7 +549,7 @@ impl Yumush {
477 if open {549 if open {
478 yumush.open_friends(window, cx)550 yumush.open_friends(window, cx)
479 } else {551 } else {
480- yumush.close_friends(cx)552+ yumush.close_friends(window, cx)
481 }553 }
482 })554 })
483 })555 })
@@ -531,14 +603,14 @@ impl Yumush {
531 )603 )
532 .on_click(move |_, window, cx| {604 .on_click(move |_, window, cx| {
533 open.update(cx, |yumush, cx| {605 open.update(cx, |yumush, cx| {
534- yumush.close_friends(cx);606+ yumush.close_friends(window, cx);
535 yumush.open_direct(user_id, window, cx)607 yumush.open_direct(user_id, window, cx)
536 })608 })
537 })609 })
538 .context_menu(move |menu, _, _| {610 .context_menu(move |menu, _, _| {
539 menu_action(611 menu_action(
540 menu,612 menu,
541- "Remove friend",613+ w().sidebar.remove_friend,
542 &remove,614 &remove,
543 user_id,615 user_id,
544 |yumush, id, window, cx| yumush.remove_friend(id, window, cx),616 |yumush, id, window, cx| yumush.remove_friend(id, window, cx),
@@ -599,7 +671,7 @@ impl Yumush {
599 palette,671 palette,
600 active,672 active,
601 Some(notes_tile(palette)),673 Some(notes_tile(palette)),
602- "Notes".to_string(),674+ w().sidebar.notes.to_string(),
603 unread_badge(palette, false, unread),675 unread_badge(palette, false, unread),
604 ),676 ),
605 palette,677 palette,
@@ -747,7 +819,7 @@ impl Yumush {
747 )819 )
748 .collect();820 .collect();
749 821
750- group("Requests", palette, rows)822+ group(w().sidebar.requests, palette, rows)
751 }823 }
752 824
753 fn unread_first<'a>(&self, rooms: impl Iterator<Item = &'a Community>) -> Vec<&'a Community> {825 fn unread_first<'a>(&self, rooms: impl Iterator<Item = &'a Community>) -> Vec<&'a Community> {
@@ -797,9 +869,9 @@ impl Yumush {
797 user.id,869 user.id,
798 palette,870 palette,
799 IconName::MessageSquare,871 IconName::MessageSquare,
800- "Message",872+ w().sidebar.message,
801 |yumush, id, window, cx| {873 |yumush, id, window, cx| {
802- yumush.close_friends(cx);874+ yumush.close_friends(window, cx);
803 yumush.open_direct(id, window, cx)875 yumush.open_direct(id, window, cx)
804 },876 },
805 ));877 ));
@@ -873,7 +945,7 @@ impl Yumush {
873 user.id,945 user.id,
874 palette,946 palette,
875 IconName::Check,947 IconName::Check,
876- "Accept",948+ w().sidebar.accept,
877 |yumush, id, window, cx| yumush.accept_friend(id, window, cx),949 |yumush, id, window, cx| yumush.accept_friend(id, window, cx),
878 ),950 ),
879 row_button(951 row_button(
@@ -882,7 +954,7 @@ impl Yumush {
882 user.id,954 user.id,
883 palette,955 palette,
884 IconName::X,956 IconName::X,
885- "Decline",957+ w().sidebar.decline,
886 |yumush, id, window, cx| yumush.remove_friend(id, window, cx),958 |yumush, id, window, cx| yumush.remove_friend(id, window, cx),
887 ),959 ),
888 ],960 ],
@@ -900,7 +972,7 @@ impl Yumush {
900 user.id,972 user.id,
901 palette,973 palette,
902 IconName::X,974 IconName::X,
903- "Cancel",975+ w().sidebar.cancel,
904 |yumush, id, window, cx| yumush.remove_friend(id, window, cx),976 |yumush, id, window, cx| yumush.remove_friend(id, window, cx),
905 )],977 )],
906 )978 )
@@ -918,7 +990,7 @@ impl Yumush {
918 div()990 div()
919 .text_size(text(text::CAPTION))991 .text_size(text(text::CAPTION))
920 .text_color(palette.muted)992 .text_color(palette.muted)
921- .child(format!("from {}", invitation.inviter.username)),993+ .child(w().sidebar.from_user(&invitation.inviter.username)),
922 );994 );
923 995
924 entry(996 entry(
@@ -939,7 +1011,7 @@ impl Yumush {
939 community.id,1011 community.id,
940 palette,1012 palette,
941 IconName::Check,1013 IconName::Check,
942- "Accept",1014+ w().sidebar.accept,
943 |yumush, id, window, cx| yumush.accept_invitation(id, window, cx),1015 |yumush, id, window, cx| yumush.accept_invitation(id, window, cx),
944 ),1016 ),
945 row_button(1017 row_button(
@@ -948,7 +1020,7 @@ impl Yumush {
948 community.id,1020 community.id,
949 palette,1021 palette,
950 IconName::X,1022 IconName::X,
951- "Decline",1023+ w().sidebar.decline,
952 |yumush, id, window, cx| yumush.decline_invitation(id, window, cx),1024 |yumush, id, window, cx| yumush.decline_invitation(id, window, cx),
953 ),1025 ),
954 ],1026 ],
@@ -965,28 +1037,23 @@ impl Yumush {
965 .items_center()1037 .items_center()
966 .gap(px(space::XS))1038 .gap(px(space::XS))
967 .child(self.account_trigger(entity, user, true, palette))1039 .child(self.account_trigger(entity, user, true, palette))
968- .children(self.is_builder().then(|| {1040+ .children((self.is_builder() && self.chat.ghost).then(|| {
969- let ghost = self.chat.ghost;1041+ self.folding(
970- icon_button(1042+ "builder_fold",
971- "builder_button".to_string(),1043+ div().child(
972- palette,1044+ icon_button(
973- if ghost {1045+ "builder_button".to_string(),
974- IconName::Ghost1046+ palette,
975- } else {1047+ IconName::Ghost,
976- IconName::Shield1048+ w().sidebar.ghost_on,
977- },1049+ entity_action(entity, |yumush, window, cx| {
978- if ghost {1050+ yumush.show_view(View::Builder, window, cx)
979- "Ghost on"1051+ }),
980- } else {1052+ )
981- Role::Builder.label()1053+ .text_color(palette.tokens.hue(super::style::my_hue())),
982- },1054+ ),
983- entity_action(entity, |yumush, window, cx| {1055+ fade,
984- yumush.show_view(View::Builder, window, cx)
985- }),
986 )1056 )
987- .when(ghost, |button| {
988- button.text_color(palette.tokens.hue(super::style::my_hue()))
989- })
990 })),1057 })),
991 )1058 )
992 }1059 }
@@ -999,6 +1066,32 @@ impl Yumush {
999 palette: Palette,1066 palette: Palette,
1000 ) -> impl IntoElement {1067 ) -> impl IntoElement {
1001 let face = if named { size::AVATAR } else { size::CONTROL };1068 let face = if named { size::AVATAR } else { size::CONTROL };
1069+ let picture = avatar(
1070+ palette,
1071+ user,
1072+ px(face),
1073+ text(text::CAPTION),
1074+ &self.chat.avatars,
1075+ );
1076+ let picture = if named {
1077+ self.folding("avatar_face", picture, |picture, f| {
1078+ picture.size(px(lerp(size::AVATAR, size::CONTROL, f)))
1079+ })
1080+ } else {
1081+ picture.into_any_element()
1082+ };
1083+ let picture = presence_avatar(picture, self.presence_of(user.id), px(face), palette);
1084+ let picture = if named {
1085+ self.folding("avatar", picture, |picture, f| {
1086+ picture
1087+ .left(px(
1088+ f * (RAIL_CENTER - space::LG - space::SM - size::CONTROL / 2.)
1089+ ))
1090+ .top(px(f * (space::LG - space::MD - space::XXS)))
1091+ })
1092+ } else {
1093+ picture.into_any_element()
1094+ };
1002 profile_popover(1095 profile_popover(
1003 "account_profile",1096 "account_profile",
1004 Anchor::BottomLeft,1097 Anchor::BottomLeft,
@@ -1014,25 +1107,18 @@ impl Yumush {
1014 .p(px(if named { 0. } else { space::XXS }))1107 .p(px(if named { 0. } else { space::XXS }))
1015 .when(named, |trigger| trigger.px(px(space::SM)))1108 .when(named, |trigger| trigger.px(px(space::SM)))
1016 .rounded(px(radius::MD))1109 .rounded(px(radius::MD))
1017- .child(presence_avatar(1110+ .child(picture)
1018- avatar(
1019- palette,
1020- user,
1021- px(face),
1022- text(text::CAPTION),
1023- &self.chat.avatars,
1024- ),
1025- self.presence_of(user.id),
1026- px(face),
1027- palette,
1028- ))
1029 .when(named, |trigger| {1111 .when(named, |trigger| {
1030 trigger.child(1112 trigger.child(
1031- div()1113+ self.folding(
1032- .min_w_0()1114+ "username_fold",
1033- .truncate()1115+ div()
1034- .text_color(palette.muted)1116+ .min_w_0()
1035- .child(user.username.clone()),1117+ .truncate()
1118+ .text_color(palette.muted)
1119+ .child(user.username.clone()),
1120+ fade,
1121+ ),
1036 )1122 )
1037 }),1123 }),
1038 palette,1124 palette,
@@ -1075,9 +1161,9 @@ fn watch_pill(
1075 Kind::Screen => IconName::ScreenShare,1161 Kind::Screen => IconName::ScreenShare,
1076 };1162 };
1077 let tip = match (watching, kind) {1163 let tip = match (watching, kind) {
1078- (true, _) => "Stop watching",1164+ (true, _) => w().sidebar.stop_watching,
1079- (false, Kind::Camera) => "Watch camera",1165+ (false, Kind::Camera) => w().sidebar.watch_camera,
1080- (false, Kind::Screen) => "Watch screen",1166+ (false, Kind::Screen) => w().sidebar.watch_screen,
1081 };1167 };
1082 clickable(1168 clickable(
1083 format!("voice_watch_{user_id}_{kind:?}"),1169 format!("voice_watch_{user_id}_{kind:?}"),
@@ -1153,14 +1239,14 @@ fn room_menu(
1153 let menu = if group {1239 let menu = if group {
1154 let menu = menu_action(1240 let menu = menu_action(
1155 menu,1241 menu,
1156- "Invite",1242+ w().sidebar.invite,
1157 &entity,1243 &entity,
1158 community_id,1244 community_id,
1159 |yumush, id, window, cx| yumush.open_invite(id, window, cx),1245 |yumush, id, window, cx| yumush.open_invite(id, window, cx),
1160 );1246 );
1161 menu_action(1247 menu_action(
1162 menu,1248 menu,
1163- "Settings",1249+ w().sidebar.settings,
1164 &entity,1250 &entity,
1165 community_id,1251 community_id,
1166 |yumush, id, window, cx| yumush.open_community_settings(id, window, cx),1252 |yumush, id, window, cx| yumush.open_community_settings(id, window, cx),
@@ -1169,8 +1255,8 @@ fn room_menu(
1169 menu1255 menu
1170 };1256 };
1171 let menu = [1257 let menu = [
1172- (Mark::Pin, pinned, "Pin", "Unpin"),1258+ (Mark::Pin, pinned, w().sidebar.pin, w().sidebar.unpin),
1173- (Mark::Mute, muted, "Mute", "Unmute"),1259+ (Mark::Mute, muted, w().sidebar.mute, w().sidebar.unmute),
1174 ]1260 ]
1175 .into_iter()1261 .into_iter()
1176 .fold(menu, |menu, (mark, on, set, unset)| {1262 .fold(menu, |menu, (mark, on, set, unset)| {
@@ -1186,7 +1272,7 @@ fn room_menu(
1186 }1272 }
1187 menu_action(1273 menu_action(
1188 menu,1274 menu,
1189- "Leave",1275+ w().sidebar.leave,
1190 &entity,1276 &entity,
1191 community_id,1277 community_id,
1192 |yumush, id, window, cx| yumush.leave_community(id, window, cx),1278 |yumush, id, window, cx| yumush.leave_community(id, window, cx),
@@ -1198,27 +1284,6 @@ fn matches_query(name: &str, query: &str) -> bool {
1198 name.to_lowercase().contains(query)1284 name.to_lowercase().contains(query)
1199 }1285 }
1200 1286
1201-fn new_community(entity: &Entity<Yumush>) -> impl Fn(&mut Window, &mut App) + 'static {
1202- let entity = entity.clone();
1203- move |window, cx| {
1204- entity.update(cx, |_, cx| {
1205- input_dialog(
1206- "New community",
1207- "Create",
1208- "Name...",
1209- window,
1210- cx,
1211- |this, name, window, cx| {
1212- let name = name.trim().to_string();
1213- if validate_community_name(&name).is_ok() {
1214- create_community(this, name, window, cx);
1215- }
1216- },
1217- );
1218- })
1219- }
1220-}
1221-
1222 pub(super) fn input_box(input: &Entity<InputState>, palette: Palette) -> Div {1287 pub(super) fn input_box(input: &Entity<InputState>, palette: Palette) -> Div {
1223 compact_frame(palette)1288 compact_frame(palette)
1224 .gap(px(space::SM))1289 .gap(px(space::SM))
@@ -1351,10 +1416,24 @@ enum Doing {
1351 Offline,1416 Offline,
1352 }1417 }
1353 1418
1354-const S_WIDTH: f32 = 0.5;1419+const RAIL_SHIFT: f32 = space::LG;
1355-const CEDILLA_DROP: f32 = 0.45;1420+const RAIL_CENTER: f32 = (size::RAIL + RAIL_SHIFT) / 2.;
1356-const H_SHRINK: f32 = 0.6;1421+const S_ADVANCE: f32 = 0.511;
1357-const MORPH: std::time::Duration = std::time::Duration::from_millis(420);1422+const LEADING: f32 = 1.4;
1423+const BASELINE: f32 = (LEADING - 0.97 - 0.305) / 2. + 0.97;
1424+const MARK_VIEW: f32 = 76.;
1425+const WANDER: std::time::Duration = std::time::Duration::from_secs(10);
1426+const LINGER: std::time::Duration = std::time::Duration::from_secs(6);
1427+const TOW: std::time::Duration = std::time::Duration::from_millis(2300);
1428+
1429+fn lerp(from: f32, to: f32, f: f32) -> f32 {
1430+ from + (to - from) * f
1431+}
1432+
1433+fn fade<E: Styled>(element: E, f: f32) -> E {
1434+ let shown = 1. - f;
1435+ element.opacity(shown)
1436+}
1358 1437
1359 fn logo_mark(palette: Palette) -> gpui_kit::Svg {1438 fn logo_mark(palette: Palette) -> gpui_kit::Svg {
1360 gpui_kit::svg()1439 gpui_kit::svg()
@@ -1364,50 +1443,128 @@ fn logo_mark(palette: Palette) -> gpui_kit::Svg {
1364 .text_color(palette.text)1443 .text_color(palette.text)
1365 }1444 }
1366 1445
1367-fn wordmark_tail(flips: u32, flipped: Option<std::time::Instant>) -> AnyElement {1446+pub(super) fn wander(cx: &mut Context<Yumush>) {
1368- let em = super::style::text::TITLE / super::style::text::UI;1447+ cx.spawn(async move |this, cx| {
1448+ for wait in [WANDER, LINGER].into_iter().cycle() {
1449+ cx.background_executor().timer(wait).await;
1450+ let flipped = this.update(cx, |yumush, cx| {
1451+ yumush.wordmark_flips += 1;
1452+ yumush.wordmark_flipped = Some(std::time::Instant::now());
1453+ cx.notify();
1454+ });
1455+ cx.background_executor().timer(TOW).await;
1456+ if flipped.is_err() || this.update(cx, |_, cx| cx.notify()).is_err() {
1457+ break;
1458+ }
1459+ }
1460+ })
1461+ .detach();
1462+}
1463+
1464+fn towing(flipped: Option<std::time::Instant>) -> bool {
1465+ flipped.is_some_and(|at| at.elapsed() < TOW)
1466+}
1467+
1468+fn wordmark_tail(flips: u32, flipped: Option<std::time::Instant>, palette: Palette) -> AnyElement {
1369 let turkish = flips % 2 == 1;1469 let turkish = flips % 2 == 1;
1370- let progress = move |delta: f32| if turkish { delta } else { 1. - delta };1470+ let em = super::style::text::TITLE / super::style::text::UI;
1371- let fade = |p: f32| 1. - p;1471+ if !towing(flipped) {
1372- let s = move |p: f32| div().opacity(fade(p)).child("s");1472+ return if turkish {
1373- let cedilla = move |p: f32| div().absolute().top_0().left_0().opacity(p).child("ş");1473+ div().child("ş")
1374- let h = move |p: f32| {1474+ } else {
1375- div()1475+ div().relative().child("s").child(
1376- .absolute()1476+ div()
1377- .top(gpui_kit::rems(p * CEDILLA_DROP * em))1477+ .absolute()
1378- .left(gpui_kit::rems(S_WIDTH * em * (1. - p)))1478+ .top_0()
1379- .text_size(gpui_kit::rems(em * (1. - H_SHRINK * p)))1479+ .left(gpui_kit::rems(S_ADVANCE * em))
1380- .opacity(fade(p))1480+ .child("h"),
1381- .child("h")1481+ )
1382- };1482+ }
1383- let tail = div().relative();1483+ .into_any_element();
1384- if !flipped.is_some_and(|at| at.elapsed() < MORPH) {
1385- let p = if turkish { 1. } else { 0. };
1386- return tail
1387- .child(s(p))
1388- .child(cedilla(p))
1389- .child(h(p))
1390- .into_any_element();
1391 }1484 }
1392- let animation = || gpui_kit::Animation::new(MORPH).with_easing(gpui_kit::ease_in_out);1485+ let (ink, ground) = (palette.text, palette.panel);
1393- tail.child(1486+ div()
1394- s(0.).with_animation(("wordmark_s", flips), animation(), move |el, delta| {1487+ .relative()
1395- el.opacity(fade(progress(delta)))1488+ .child("s")
1396- }),1489+ .with_animation(
1397- )1490+ ("wordmark", flips),
1398- .child(cedilla(0.).with_animation(1491+ gpui_kit::Animation::new(TOW),
1399- ("wordmark_cedilla", flips),1492+ move |tail, progress| {
1400- animation(),1493+ tail.child(
1401- move |el, delta| el.opacity(progress(delta)),1494+ tow_canvas(progress, turkish, ink, ground)
1402- ))1495+ .absolute()
1403- .child(1496+ .top_0()
1404- h(0.).with_animation(("wordmark_h", flips), animation(), move |el, delta| {1497+ .left_0()
1405- let p = progress(delta);1498+ .size_full(),
1406- el.top(gpui_kit::rems(p * CEDILLA_DROP * em))1499+ )
1407- .left(gpui_kit::rems(S_WIDTH * em * (1. - p)))1500+ },
1408- .text_size(gpui_kit::rems(em * (1. - H_SHRINK * p)))1501+ )
1409- .opacity(fade(p))1502+ .into_any_element()
1410- }),1503+}
1504+
1505+fn tow_canvas(progress: f32, turkish: bool, ink: Hsla, ground: Hsla) -> gpui_kit::Canvas<()> {
1506+ gpui_kit::canvas(
1507+ |_, _, _| {},
1508+ move |bounds, _, window, _| {
1509+ let em =
1510+ f32::from(window.rem_size()) * super::style::text::TITLE / super::style::text::UI;
1511+ let unit = em / 1000.;
1512+ let left = f32::from(bounds.origin.x) - super::tow::S_X * unit;
1513+ let baseline = f32::from(bounds.origin.y) + BASELINE * em;
1514+ let rig = super::tow::Rig {
1515+ x: -(size::CHIP + space::XXS + space::XS) / unit,
1516+ y: ((LEADING * em - size::CHIP) / 2. - BASELINE * em) / unit,
1517+ scale: size::CHIP / MARK_VIEW / unit,
1518+ };
1519+ let scene = super::tow::scene(&rig, progress, turkish, progress * TOW.as_secs_f32());
1520+ let at = |[x, y]: super::tow::Point| {
1521+ gpui_kit::point(px(left + x * unit), px(baseline + y * unit))
1522+ };
1523+ trace(
1524+ window,
1525+ scene.gap.iter().map(|p| at(*p)),
1526+ scene.halo * unit,
1527+ ground,
1528+ );
1529+ trace(
1530+ window,
1531+ scene.thread.iter().map(|p| at(*p)),
1532+ scene.width * unit,
1533+ ink,
1534+ );
1535+ let mut glyph = PathBuilder::fill();
1536+ let mut points = scene.glyph.iter().map(|p| at(*p));
1537+ if let Some(first) = points.next() {
1538+ glyph.move_to(first);
1539+ points.for_each(|point| glyph.line_to(point));
1540+ glyph.close();
1541+ if let Ok(glyph) = glyph.build() {
1542+ window.paint_path(glyph, ink);
1543+ }
1544+ }
1545+ },
1411 )1546 )
1412- .into_any_element()1547+}
1548+
1549+fn trace(
1550+ window: &mut Window,
1551+ mut points: impl Iterator<Item = gpui_kit::Point<gpui_kit::Pixels>>,
1552+ width: f32,
1553+ color: Hsla,
1554+) {
1555+ let Some(first) = points.next() else {
1556+ return;
1557+ };
1558+ let mut path =
1559+ PathBuilder::fill().with_style(gpui_kit::PathStyle::Stroke(gpui_kit::StrokeOptions {
1560+ line_width: width,
1561+ line_cap: gpui_kit::LineCap::Round,
1562+ line_join: gpui_kit::LineJoin::Round,
1563+ ..Default::default()
1564+ }));
1565+ path.move_to(first);
1566+ points.for_each(|point| path.line_to(point));
1567+ if let Ok(path) = path.build() {
1568+ window.paint_path(path, color);
1569+ }
1413 }1570 }
crates/client/src/gui/snippet.rsmodified+3 -2
@@ -1,5 +1,6 @@
1 use super::style::{size, space, text};1 use super::style::{size, space, text};
2 use crate::gui::CLOCK;2 use crate::gui::CLOCK;
3+use crate::lang::w;
3 use common::model::{Message, Role, SnippetMessage, User};4 use common::model::{Message, Role, SnippetMessage, User};
4 use gpui_kit::{5 use gpui_kit::{
5 Entity, FontWeight, IntoElement, ParentElement, Styled, div, prelude::FluentBuilder as _, px,6 Entity, FontWeight, IntoElement, ParentElement, Styled, div, prelude::FluentBuilder as _, px,
@@ -19,8 +20,8 @@ pub fn snippet_card(
19 ) -> Option<impl IntoElement> {20 ) -> Option<impl IntoElement> {
20 let snippet = message.snippet.as_ref()?;21 let snippet = message.snippet.as_ref()?;
21 let header = match &snippet.origin {22 let header = match &snippet.origin {
22- Some(origin) => format!("Forwarded · {origin}"),23+ Some(origin) => w().snippet.forwarded_from(origin),
23- None => "Forwarded".to_string(),24+ None => w().snippet.forwarded.to_string(),
24 };25 };
25 26
26 Some(27 Some(
crates/client/src/gui/social.rsmodified+9 -8
@@ -1,3 +1,4 @@
1+use crate::lang::{Label as _, w};
1 use common::model::Id;2 use common::model::Id;
2 use std::{fmt::Display, future::Future};3 use std::{fmt::Display, future::Future};
3 4
@@ -49,10 +50,10 @@ impl Relation {
49 pub fn action(self) -> Option<(&'static str, IconName)> {50 pub fn action(self) -> Option<(&'static str, IconName)> {
50 match self {51 match self {
51 Relation::Myself => None,52 Relation::Myself => None,
52- Relation::Friend => Some(("Remove friend", IconName::UserX)),53+ Relation::Friend => Some((w().social.remove_friend, IconName::UserX)),
53- Relation::Outgoing => Some(("Cancel request", IconName::X)),54+ Relation::Outgoing => Some((w().social.cancel_request, IconName::X)),
54- Relation::Incoming => Some(("Accept friend", IconName::UserCheck)),55+ Relation::Incoming => Some((w().social.accept_friend, IconName::UserCheck)),
55- Relation::Stranger => Some(("Add friend", IconName::UserPlus)),56+ Relation::Stranger => Some((w().social.add_friend, IconName::UserPlus)),
56 }57 }
57 }58 }
58 }59 }
@@ -307,7 +308,7 @@ impl Yumush {
307 cx: &mut Context<Self>,308 cx: &mut Context<Self>,
308 ) {309 ) {
309 self.chat.invite = InviteLookup::Idle;310 self.chat.invite = InviteLookup::Idle;
310- let input = new_input("Username...", window, cx);311+ let input = new_input(w().social.username_placeholder, window, cx);
311 let enter_id = community_id;312 let enter_id = community_id;
312 let lookup_id = community_id;313 let lookup_id = community_id;
313 314
@@ -329,7 +330,7 @@ impl Yumush {
329 let palette = super::palette(cx);330 let palette = super::palette(cx);
330 let result = invite_result(&yumush.chat.invite, community_id, &entity, yumush, palette);331 let result = invite_result(&yumush.chat.invite, community_id, &entity, yumush, palette);
331 332
332- dialog.title("Invite").child(333+ dialog.title(w().social.invite).child(
333 div()334 div()
334 .flex()335 .flex()
335 .flex_col()336 .flex_col()
@@ -431,7 +432,7 @@ fn invite_result(
431 div()432 div()
432 .text_size(text(super::style::text::LABEL))433 .text_size(text(super::style::text::LABEL))
433 .text_color(palette.muted)434 .text_color(palette.muted)
434- .child("No such user")435+ .child(w().social.no_such_user)
435 .into_any_element(),436 .into_any_element(),
436 ),437 ),
437 InviteLookup::Member(user) => Some(438 InviteLookup::Member(user) => Some(
@@ -460,7 +461,7 @@ fn invite_result(
460 .flex()461 .flex()
461 .items_center()462 .items_center()
462 .rounded(px(radius::MD))463 .rounded(px(radius::MD))
463- .child("Invite"),464+ .child(w().social.invite),
464 )465 )
465 .into_any_element(),466 .into_any_element(),
466 )467 )
crates/client/src/gui/stream_stats.rsmodified+5 -4
@@ -1,3 +1,4 @@
1+use crate::lang::w;
1 use common::{model::Id, share::Kind};2 use common::{model::Id, share::Kind};
2 use gpui_kit::{Div, FontWeight, ParentElement, Styled, div, px};3 use gpui_kit::{Div, FontWeight, ParentElement, Styled, div, px};
3 4
@@ -79,7 +80,7 @@ pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Pal
79 ))80 ))
80 .child(number(81 .child(number(
81 field(loss.map(|loss| format!("{loss:.1}"))),82 field(loss.map(|loss| format!("{loss:.1}"))),
82- "loss %",83+ w().stream_stats.loss,
83 bad,84 bad,
84 t,85 t,
85 ))86 ))
@@ -89,7 +90,7 @@ pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Pal
89 .and_then(|stats| stats.latency_ms)90 .and_then(|stats| stats.latency_ms)
90 .map(|ms| ms.to_string()),91 .map(|ms| ms.to_string()),
91 ),92 ),
92- "latency ms",93+ w().stream_stats.latency,
93 false,94 false,
94 t,95 t,
95 )),96 )),
@@ -104,8 +105,8 @@ pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Pal
104 stats105 stats
105 .map(|stats| {106 .map(|stats| {
106 [107 [
107- format!("buffer {} ms", stats.buffer_ms),108+ w().stream_stats.buffer(stats.buffer_ms),
108- format!("keyframes {}", stats.keyframes),109+ w().stream_stats.keyframes(stats.keyframes),
109 format!("NACKs {}", stats.nacks),110 format!("NACKs {}", stats.nacks),
110 ]111 ]
111 .map(|text| words(text, Text::Caption, Ink::Faint, t))112 .map(|text| words(text, Text::Caption, Ink::Faint, t))
crates/client/src/gui/tow.rsadded+502 -0
@@ -0,0 +1,502 @@
1+use std::f32::consts::PI;
2+
3+pub type Point = [f32; 2];
4+type Segment = [Point; 4];
5+
6+pub const S_X: f32 = 2615.;
7+const H_X: f32 = S_X + 511.;
8+const STEM: f32 = 105.;
9+const H_TOP: f32 = -707.;
10+const WORD_RIGHT: f32 = S_X + 480.;
11+const WORD_TOP: f32 = -540.;
12+const SAMPLES: usize = 60;
13+const CROSSING: f32 = 30.5;
14+const GAP: f32 = 5.3;
15+const HALO: f32 = 8.4;
16+const THREAD: f32 = 5.;
17+
18+pub struct Rig {
19+ pub x: f32,
20+ pub y: f32,
21+ pub scale: f32,
22+}
23+
24+pub struct Scene {
25+ pub thread: Vec<Point>,
26+ pub gap: Vec<Point>,
27+ pub glyph: Vec<Point>,
28+ pub width: f32,
29+ pub halo: f32,
30+}
31+
32+impl Rig {
33+ fn mark(&self, x: f32, y: f32) -> Point {
34+ [
35+ self.x + (x - 14.) * self.scale,
36+ self.y + (y - 12.) * self.scale,
37+ ]
38+ }
39+
40+ fn shaft(&self, along: f32, off: f32) -> Point {
41+ let length = 48f32.hypot(60.);
42+ let (dx, dy) = (48. / length, -60. / length);
43+ self.mark(26. + dx * along - dy * off, 80. + dy * along + dx * off)
44+ }
45+
46+ fn strand(&self) -> [Segment; 2] {
47+ [
48+ [
49+ self.mark(68., 28.),
50+ self.mark(80., 40.),
51+ self.mark(76., 56.),
52+ self.mark(60., 58.),
53+ ],
54+ [
55+ self.mark(60., 58.),
56+ self.mark(44., 60.),
57+ self.mark(40., 74.),
58+ self.mark(52., 84.),
59+ ],
60+ ]
61+ }
62+
63+ fn lift(&self) -> (Point, Point) {
64+ let lift = self.shaft(92., -4.);
65+ let bend = self.shaft(80., -20.);
66+ (lift, add(lift, scale(sub(lift, bend), 1.5)))
67+ }
68+
69+ fn taut(&self, to: Point) -> Vec<Segment> {
70+ let (lift, lead) = self.lift();
71+ let corners = [[WORD_RIGHT + 33., WORD_TOP - 38.], [WORD_RIGHT + 33., 48.]];
72+ let word = [[0., WORD_TOP, WORD_RIGHT - 5., 10.]];
73+ let mut points = vec![lift];
74+ for corner in corners {
75+ if hits(&word, *points.last().unwrap_or(&lift), to) {
76+ points.push(corner);
77+ }
78+ }
79+ points.push(to);
80+ joined(lift, lead, &points)
81+ }
82+
83+ fn below(&self, to: Point) -> Vec<Segment> {
84+ let tail = self.strand()[1][3];
85+ let boxes = [[0., WORD_TOP, WORD_RIGHT, 30.], [20., 15., 580., 250.]];
86+ let mut points = vec![tail];
87+ for corner in [[20., 283.], [580., 283.], [WORD_RIGHT + 33., 63.]] {
88+ if hits(&boxes, *points.last().unwrap_or(&tail), to) {
89+ points.push(corner);
90+ }
91+ }
92+ points.push(to);
93+ joined(tail, add(tail, [120., 100.]), &points)
94+ }
95+}
96+
97+pub fn scene(rig: &Rig, progress: f32, turkish: bool, time: f32) -> Scene {
98+ let beat = Beat::new(progress);
99+ let (thread, glyph, gap) = if turkish {
100+ under(rig, &beat, time)
101+ } else {
102+ over(rig, &beat, time)
103+ };
104+ Scene {
105+ thread,
106+ gap,
107+ glyph,
108+ width: THREAD * rig.scale,
109+ halo: HALO * rig.scale,
110+ }
111+}
112+
113+struct Beat {
114+ out: f32,
115+ back: f32,
116+ slack: f32,
117+ lift: f32,
118+ settle: f32,
119+ ahead: f32,
120+ pulling: bool,
121+ reaching: bool,
122+}
123+
124+impl Beat {
125+ fn new(progress: f32) -> Self {
126+ let v = ease(0., 1., progress);
127+ let pull = clamp(0.32, 0.78, v);
128+ Beat {
129+ out: ease(0., 0.3, v),
130+ back: ease(0.78, 1., v),
131+ slack: ease(0., 0.18, pull),
132+ lift: heave(0.18, 0.82, pull),
133+ settle: clamp(0.82, 1., pull),
134+ ahead: heave(0.18, 0.82, pull + 0.02).min(1.),
135+ pulling: (0.32..0.78).contains(&v),
136+ reaching: v < 0.32,
137+ }
138+ }
139+
140+ fn amp(&self, grown: f32) -> f32 {
141+ if self.pulling {
142+ 45. * (1. - self.slack)
143+ } else {
144+ 80. * (PI * grown).sin()
145+ }
146+ }
147+
148+ fn swing(&self, strength: f32) -> f32 {
149+ strength * (self.settle * PI * 3.).sin() * (1. - self.settle)
150+ }
151+}
152+
153+fn over(rig: &Rig, beat: &Beat, time: f32) -> (Vec<Point>, Vec<Point>, Vec<Point>) {
154+ let top = [H_X + STEM, H_TOP];
155+ let grab = [S_X + 380., 140.];
156+ let load = |t: f32| cubic(&[grab, [H_X + 54., 150.], [H_X + STEM, -200.], top], t);
157+ let bounce = 0.06 * (beat.settle * PI * 2.).sin() * (1. - beat.settle);
158+ let t = if beat.reaching {
159+ 0.
160+ } else if beat.pulling {
161+ if beat.settle > 0. {
162+ 1. - bounce
163+ } else {
164+ beat.lift
165+ }
166+ } else {
167+ 1.
168+ };
169+ let anchor = load(t);
170+ let speed = if beat.pulling {
171+ (load(beat.ahead)[0] - anchor[0]) / 0.02 / 3000.
172+ } else {
173+ 0.
174+ };
175+ let (curl, grown) = if beat.reaching {
176+ (ease(0., 0.45, beat.out), ease(0.35, 1., beat.out))
177+ } else if beat.pulling {
178+ (1., 1.)
179+ } else {
180+ (
181+ 1. - ease(0.55, 1., beat.back),
182+ 1. - ease(0., 0.6, beat.back),
183+ )
184+ };
185+ let [first, low] = rig.strand();
186+ let looped = [
187+ low[0],
188+ rig.mark(52., 59.),
189+ rig.shaft(26., -4.),
190+ rig.shaft(32., -14.),
191+ ];
192+ let low: Segment = std::array::from_fn(|i| mix(low[i], looped[i], curl));
193+ let (lift, _) = rig.lift();
194+ let wrap = [
195+ rig.shaft(32., -14.),
196+ rig.shaft(40., -22.),
197+ rig.shaft(80., -20.),
198+ lift,
199+ ];
200+ let mut segments = vec![first, low, wrap];
201+ segments.extend(rig.taut(anchor));
202+ let route = Route::new(&segments);
203+ let tip = route.marks[1] + (route.end() - route.marks[1]) * grown;
204+ let thread = route.wave(tip, beat.amp(grown), time, route.marks[2]);
205+ let crossing = rig.shaft(CROSSING, 0.);
206+ let gap = thread
207+ .iter()
208+ .copied()
209+ .filter(|point| distance(*point, crossing) < GAP * rig.scale)
210+ .collect();
211+ let glyph = shape(
212+ [STEM, H_TOP],
213+ anchor,
214+ -speed * 0.6 + beat.swing(0.22),
215+ 0.45 + 0.55 * beat.lift,
216+ 1. - ease(0.1, 0.75, beat.lift),
217+ );
218+ (thread, glyph, gap)
219+}
220+
221+fn under(rig: &Rig, beat: &Beat, time: f32) -> (Vec<Point>, Vec<Point>, Vec<Point>) {
222+ let foot = [H_X + STEM, 0.];
223+ let grab = [S_X + 380., 140.];
224+ let drop = |t: f32| cubic(&[foot, [H_X + STEM, 130.], [S_X + 495., 170.], grab], t);
225+ let t = if beat.reaching {
226+ 0.
227+ } else if beat.pulling {
228+ beat.lift
229+ } else {
230+ 1.
231+ };
232+ let anchor = drop(t);
233+ let speed = if beat.pulling {
234+ (drop(beat.ahead)[0] - anchor[0]) / 0.02 / 3000.
235+ } else {
236+ 0.
237+ };
238+ let mut segments = rig.strand().to_vec();
239+ segments.extend(rig.below(anchor));
240+ let route = Route::new(&segments);
241+ let rest = route.marks[1];
242+ let grown = if beat.reaching {
243+ beat.out
244+ } else if beat.pulling {
245+ 1.
246+ } else {
247+ 1. - beat.back
248+ };
249+ let thread = route.wave(
250+ rest + (route.end() - rest) * grown,
251+ beat.amp(grown),
252+ time,
253+ rest * 0.6,
254+ );
255+ let lean = (-speed * 0.5).clamp(-0.35, 0.35) * (1. - beat.lift);
256+ let glyph = shape(
257+ [STEM, 0.],
258+ anchor,
259+ lean + beat.swing(0.15),
260+ 1. - 0.55 * ease(0., 0.7, beat.lift),
261+ ease(0.25, 0.9, beat.lift),
262+ );
263+ (thread, glyph, Vec::new())
264+}
265+
266+fn shape(local: Point, at: Point, turn: f32, size: f32, melt: f32) -> Vec<Point> {
267+ let (sin, cos) = turn.sin_cos();
268+ H.chunks(2)
269+ .zip(CEDILLA.chunks(2))
270+ .map(|(h, c)| {
271+ let x = (h[0] - local[0]) * size;
272+ let y = (h[1] - local[1]) * size;
273+ let placed = [at[0] + x * cos - y * sin, at[1] + x * sin + y * cos];
274+ mix(placed, [c[0] + S_X, c[1]], melt)
275+ })
276+ .collect()
277+}
278+
279+struct Route {
280+ points: Vec<Point>,
281+ lengths: Vec<f32>,
282+ marks: Vec<f32>,
283+}
284+
285+impl Route {
286+ fn new(segments: &[Segment]) -> Self {
287+ let mut points = vec![segments[0][0]];
288+ let mut lengths = vec![0.];
289+ let mut marks = Vec::new();
290+ for segment in segments {
291+ for step in 1..=SAMPLES {
292+ let point = cubic(segment, step as f32 / SAMPLES as f32);
293+ let last = lengths.last().copied().unwrap_or(0.);
294+ lengths.push(last + distance(*points.last().unwrap_or(&point), point));
295+ points.push(point);
296+ }
297+ marks.push(lengths.last().copied().unwrap_or(0.));
298+ }
299+ Route {
300+ points,
301+ lengths,
302+ marks,
303+ }
304+ }
305+
306+ fn end(&self) -> f32 {
307+ self.lengths.last().copied().unwrap_or(0.)
308+ }
309+
310+ fn at(&self, length: f32) -> Point {
311+ let i = self
312+ .lengths
313+ .iter()
314+ .position(|&l| l >= length)
315+ .unwrap_or(self.lengths.len() - 1)
316+ .max(1);
317+ let span = self.lengths[i] - self.lengths[i - 1];
318+ let f = if span > 0. {
319+ ((length - self.lengths[i - 1]) / span).clamp(0., 1.)
320+ } else {
321+ 0.
322+ };
323+ mix(self.points[i - 1], self.points[i], f)
324+ }
325+
326+ fn wave(&self, to: f32, amp: f32, time: f32, calm: f32) -> Vec<Point> {
327+ let push = |length: f32| {
328+ let point = self.at(length);
329+ let [dx, dy] = sub(self.at(length + 20.), self.at(length - 20.));
330+ let norm = dx.hypot(dy).max(f32::EPSILON);
331+ let envelope = smooth(calm, calm + 500., length) * smooth(0., 600., to - length);
332+ let w = amp * envelope * (length / 700. * 2. * PI - time * 9.).sin();
333+ [point[0] - dy / norm * w, point[1] + dx / norm * w]
334+ };
335+ self.lengths
336+ .iter()
337+ .copied()
338+ .take_while(|&length| length < to)
339+ .chain(std::iter::once(to))
340+ .map(push)
341+ .collect()
342+ }
343+}
344+
345+fn joined(start: Point, lead: Point, points: &[Point]) -> Vec<Segment> {
346+ let first = [start, lead, mix(start, points[1], 2. / 3.), points[1]];
347+ std::iter::once(first)
348+ .chain(points[1..].windows(2).map(|pair| line(pair[0], pair[1])))
349+ .collect()
350+}
351+
352+fn hits(boxes: &[[f32; 4]], from: Point, to: Point) -> bool {
353+ (1..60).any(|step| {
354+ let [x, y] = mix(from, to, step as f32 / 60.);
355+ boxes
356+ .iter()
357+ .any(|b| x > b[0] && y > b[1] && x < b[2] && y < b[3])
358+ })
359+}
360+
361+fn line(a: Point, b: Point) -> Segment {
362+ [a, mix(a, b, 1. / 3.), mix(a, b, 2. / 3.), b]
363+}
364+
365+fn cubic(segment: &Segment, t: f32) -> Point {
366+ let u = 1. - t;
367+ let weights = [u * u * u, 3. * u * u * t, 3. * u * t * t, t * t * t];
368+ segment
369+ .iter()
370+ .zip(weights)
371+ .fold([0., 0.], |sum, (point, weight)| {
372+ add(sum, scale(*point, weight))
373+ })
374+}
375+
376+fn mix(a: Point, b: Point, f: f32) -> Point {
377+ add(a, scale(sub(b, a), f))
378+}
379+
380+fn add(a: Point, b: Point) -> Point {
381+ [a[0] + b[0], a[1] + b[1]]
382+}
383+
384+fn sub(a: Point, b: Point) -> Point {
385+ [a[0] - b[0], a[1] - b[1]]
386+}
387+
388+fn scale(a: Point, f: f32) -> Point {
389+ [a[0] * f, a[1] * f]
390+}
391+
392+fn distance(a: Point, b: Point) -> f32 {
393+ (a[0] - b[0]).hypot(a[1] - b[1])
394+}
395+
396+fn clamp(from: f32, to: f32, x: f32) -> f32 {
397+ ((x - from) / (to - from)).clamp(0., 1.)
398+}
399+
400+fn ease(from: f32, to: f32, x: f32) -> f32 {
401+ let v = clamp(from, to, x);
402+ if v < 0.5 {
403+ 2. * v * v
404+ } else {
405+ 1. - (2. - 2. * v).powi(2) / 2.
406+ }
407+}
408+
409+fn smooth(from: f32, to: f32, x: f32) -> f32 {
410+ let v = clamp(from, to, x);
411+ v * v * (3. - 2. * v)
412+}
413+
414+fn heave(from: f32, to: f32, x: f32) -> f32 {
415+ let v = clamp(from, to, x);
416+ if v < 0.6 {
417+ v * v * v / 0.216 * 0.6
418+ } else {
419+ 1. - (1. - v).powi(2) / 0.16 * 0.4
420+ }
421+}
422+
423+const H: [f32; 480] = [
424+ 59.0, -0.0, 59.0, -13.1, 59.0, -26.2, 59.0, -39.3, 59.0, -52.4, 59.0, -65.5, 59.0, -78.6, 59.0,
425+ -91.7, 59.0, -104.8, 59.0, -117.9, 59.0, -131.0, 59.0, -144.1, 59.0, -157.2, 59.0, -170.3,
426+ 59.0, -183.4, 59.0, -196.5, 59.0, -209.6, 59.0, -222.7, 59.0, -235.8, 59.0, -248.9, 59.0,
427+ -262.0, 59.0, -275.1, 59.0, -288.2, 59.0, -301.3, 59.0, -314.4, 59.0, -327.5, 59.0, -340.6,
428+ 59.0, -353.7, 59.0, -366.8, 59.0, -379.9, 59.0, -393.0, 59.0, -406.1, 59.0, -419.2, 59.0,
429+ -432.3, 59.0, -445.4, 59.0, -458.5, 59.0, -471.6, 59.0, -484.7, 59.0, -497.8, 59.0, -510.9,
430+ 59.0, -524.1, 59.0, -537.2, 59.0, -550.3, 59.0, -563.4, 59.0, -576.5, 59.0, -589.6, 59.0,
431+ -602.7, 59.0, -615.8, 59.0, -628.9, 59.0, -642.0, 59.0, -655.1, 59.0, -668.2, 59.0, -681.3,
432+ 59.0, -694.4, 59.5, -707.0, 72.6, -707.0, 85.7, -707.0, 98.8, -707.0, 111.9, -707.0, 125.0,
433+ -707.0, 138.1, -707.0, 151.2, -707.0, 164.3, -707.0, 177.4, -707.0, 181.0, -697.5, 181.0,
434+ -684.4, 181.0, -671.3, 181.0, -658.2, 181.0, -645.1, 181.0, -632.0, 181.0, -618.9, 181.0,
435+ -605.8, 181.0, -592.7, 181.0, -579.6, 181.0, -566.5, 181.0, -553.4, 181.0, -540.3, 181.0,
436+ -527.2, 181.0, -514.1, 181.0, -501.0, 181.0, -487.9, 181.0, -474.8, 181.0, -461.7, 187.6,
437+ -467.0, 196.5, -476.6, 206.1, -485.5, 216.3, -493.8, 227.1, -501.2, 238.4, -507.8, 250.1,
438+ -513.8, 262.1, -518.9, 274.4, -523.4, 287.0, -527.0, 299.8, -529.9, 312.7, -532.2, 325.7,
439+ -533.8, 338.8, -534.8, 351.9, -534.9, 364.9, -534.5, 378.0, -533.4, 391.0, -531.7, 403.9,
440+ -529.4, 416.6, -526.2, 429.0, -522.2, 441.1, -517.0, 452.6, -510.9, 463.6, -503.7, 473.8,
441+ -495.5, 483.4, -486.6, 492.2, -476.9, 500.3, -466.6, 507.5, -455.7, 513.9, -444.3, 519.5,
442+ -432.4, 524.3, -420.2, 528.3, -407.8, 531.8, -395.2, 534.8, -382.4, 537.4, -369.6, 539.4,
443+ -356.6, 541.1, -343.6, 542.3, -330.6, 543.2, -317.5, 543.8, -304.4, 544.0, -291.3, 544.0,
444+ -278.2, 544.0, -265.1, 544.0, -252.0, 544.0, -238.9, 544.0, -225.8, 544.0, -212.7, 544.0,
445+ -199.6, 544.0, -186.5, 544.0, -173.4, 544.0, -160.3, 544.0, -147.2, 544.0, -134.1, 544.0,
446+ -121.0, 544.0, -107.9, 544.0, -94.8, 544.0, -81.7, 544.0, -68.6, 544.0, -55.5, 544.0, -42.4,
447+ 544.0, -29.3, 544.0, -16.2, 544.0, -3.1, 534.0, -0.0, 520.9, -0.0, 507.8, -0.0, 494.7, -0.0,
448+ 481.6, -0.0, 468.5, -0.0, 455.4, -0.0, 442.3, -0.0, 429.2, -0.0, 422.0, -5.9, 422.0, -19.0,
449+ 422.0, -32.1, 422.0, -45.2, 422.0, -58.3, 422.0, -71.4, 422.0, -84.5, 422.0, -97.6, 422.0,
450+ -110.7, 422.0, -123.8, 422.0, -136.9, 422.0, -150.0, 422.0, -163.1, 422.0, -176.2, 422.0,
451+ -189.3, 422.0, -202.4, 422.0, -215.5, 422.0, -228.6, 422.0, -241.7, 422.0, -254.8, 422.0,
452+ -267.9, 421.8, -281.0, 421.1, -294.1, 420.0, -307.2, 418.5, -320.2, 416.4, -333.1, 413.5,
453+ -345.9, 409.5, -358.3, 404.5, -370.4, 398.2, -381.9, 390.4, -392.4, 381.1, -401.7, 370.7,
454+ -409.6, 359.2, -415.8, 346.9, -420.3, 334.1, -423.1, 321.1, -424.5, 308.0, -425.0, 294.9,
455+ -424.3, 282.0, -422.5, 269.3, -419.4, 257.0, -414.6, 245.6, -408.4, 234.9, -400.8, 225.3,
456+ -391.9, 216.8, -381.9, 209.5, -371.0, 203.4, -359.5, 198.0, -347.5, 193.5, -335.2, 189.7,
457+ -322.7, 186.7, -309.9, 184.3, -297.1, 182.6, -284.1, 181.4, -271.0, 181.0, -257.9, 181.0,
458+ -244.8, 181.0, -231.7, 181.0, -218.6, 181.0, -205.5, 181.0, -192.4, 181.0, -179.3, 181.0,
459+ -166.2, 181.0, -153.1, 181.0, -140.0, 181.0, -126.9, 181.0, -113.8, 181.0, -100.7, 181.0,
460+ -87.6, 181.0, -74.5, 181.0, -61.4, 181.0, -48.3, 181.0, -35.2, 181.0, -22.1, 181.0, -9.0,
461+ 176.9, -0.0, 163.8, -0.0, 150.7, -0.0, 137.6, -0.0, 124.5, -0.0, 111.4, -0.0, 98.3, -0.0, 85.2,
462+ -0.0, 72.1, -0.0,
463+];
464+
465+const CEDILLA: [f32; 480] = [
466+ 289.3, 130.0, 287.0, 126.2, 284.0, 122.9, 280.5, 120.0, 276.8, 117.6, 272.8, 115.5, 268.7,
467+ 113.8, 264.4, 112.4, 260.1, 111.4, 255.7, 110.6, 251.2, 109.9, 246.8, 109.4, 242.3, 109.1,
468+ 237.8, 109.0, 233.4, 109.1, 228.9, 109.3, 224.4, 109.6, 220.0, 110.0, 215.5, 110.6, 211.1,
469+ 111.2, 206.7, 111.9, 202.2, 112.7, 197.9, 113.6, 193.5, 114.6, 189.2, 115.7, 184.9, 117.0,
470+ 182.4, 116.6, 183.5, 112.3, 184.6, 107.9, 185.7, 103.6, 186.8, 99.3, 188.0, 94.9, 189.1, 90.6,
471+ 190.2, 86.3, 191.3, 81.9, 192.5, 77.6, 193.6, 73.2, 194.7, 68.9, 195.8, 64.6, 196.9, 60.2,
472+ 198.1, 55.9, 199.2, 51.6, 200.3, 47.2, 201.4, 42.9, 202.6, 38.6, 203.7, 34.2, 204.8, 29.9,
473+ 205.9, 25.6, 207.0, 21.2, 208.2, 16.9, 209.3, 12.5, 210.4, 8.2, 211.5, 3.9, 212.7, -0.5, 213.8,
474+ -4.8, 214.9, -9.1, 216.0, -13.5, 217.1, -17.8, 218.3, -22.1, 220.5, -25.0, 225.0, -25.0, 229.5,
475+ -25.0, 234.0, -25.0, 238.4, -25.0, 242.9, -25.0, 247.4, -25.0, 251.9, -25.0, 256.4, -25.0,
476+ 260.8, -25.0, 265.3, -25.0, 269.8, -25.0, 274.3, -25.0, 278.8, -25.0, 283.2, -25.0, 287.7,
477+ -25.0, 292.2, -25.0, 296.7, -25.0, 301.0, -24.9, 300.0, -20.5, 298.9, -16.1, 297.9, -11.8,
478+ 296.9, -7.4, 295.9, -3.0, 294.9, 1.3, 293.9, 5.7, 292.8, 10.0, 291.8, 14.4, 290.8, 18.8, 289.8,
479+ 23.1, 288.8, 27.5, 287.8, 31.8, 286.7, 36.2, 285.7, 40.6, 284.7, 44.9, 285.3, 47.8, 289.8,
480+ 47.3, 294.2, 47.0, 298.7, 47.1, 303.2, 47.4, 307.6, 48.1, 312.1, 48.5, 316.5, 49.0, 320.9,
481+ 49.7, 325.3, 50.6, 329.6, 51.8, 333.9, 53.1, 338.1, 54.7, 342.2, 56.5, 346.2, 58.5, 350.0,
482+ 60.8, 353.8, 63.2, 357.3, 66.0, 360.7, 68.9, 364.0, 72.0, 366.9, 75.3, 369.8, 78.8, 372.2,
483+ 82.5, 374.6, 86.3, 376.6, 90.3, 378.4, 94.4, 380.0, 98.6, 381.4, 102.9, 382.6, 107.2, 383.5,
484+ 111.6, 384.3, 116.0, 384.9, 120.4, 385.4, 124.9, 385.7, 129.3, 385.9, 133.8, 386.0, 138.3,
485+ 385.9, 142.7, 385.7, 147.2, 385.4, 151.7, 384.9, 156.1, 384.3, 160.6, 383.6, 165.0, 382.7,
486+ 169.4, 381.6, 173.7, 380.4, 178.0, 379.0, 182.3, 377.4, 186.5, 375.6, 190.6, 373.6, 194.6,
487+ 371.5, 198.5, 369.1, 202.3, 366.6, 206.0, 363.9, 209.6, 361.1, 213.1, 358.1, 216.4, 355.0,
488+ 219.6, 351.8, 222.8, 348.4, 225.7, 345.0, 228.6, 341.4, 231.3, 337.8, 233.9, 334.0, 236.3,
489+ 330.2, 238.6, 326.2, 240.8, 322.3, 242.8, 318.2, 244.7, 314.1, 246.5, 309.9, 248.2, 305.7,
490+ 249.7, 301.5, 251.2, 297.3, 252.6, 293.0, 253.9, 288.7, 255.1, 284.3, 256.3, 280.0, 257.2,
491+ 275.6, 258.2, 271.2, 259.0, 266.8, 259.8, 262.3, 260.5, 257.9, 261.1, 253.5, 261.5, 249.0,
492+ 262.0, 244.5, 262.2, 240.1, 262.4, 235.6, 262.5, 231.1, 262.6, 226.6, 262.7, 222.1, 262.7,
493+ 217.7, 262.6, 213.2, 262.5, 208.7, 262.4, 204.2, 262.2, 199.8, 261.9, 195.3, 261.6, 190.8,
494+ 261.2, 186.4, 260.7, 181.9, 260.2, 180.0, 257.5, 180.0, 253.0, 180.0, 248.5, 180.0, 244.0,
495+ 180.0, 239.5, 180.0, 235.1, 180.0, 230.6, 180.0, 226.1, 180.0, 221.6, 180.0, 217.2, 180.0,
496+ 212.7, 180.0, 208.2, 180.0, 203.7, 180.0, 199.2, 180.0, 194.8, 180.0, 190.3, 181.2, 187.1,
497+ 185.7, 187.5, 190.1, 187.8, 194.6, 188.1, 199.1, 188.3, 203.5, 188.4, 208.0, 188.5, 212.5,
498+ 188.6, 217.0, 188.6, 221.5, 188.5, 225.9, 188.4, 230.4, 188.1, 234.9, 187.7, 239.3, 187.2,
499+ 243.7, 186.5, 248.2, 185.8, 252.5, 184.8, 256.9, 183.7, 261.1, 182.3, 265.3, 180.7, 269.4,
500+ 178.8, 273.2, 176.5, 276.9, 174.0, 280.3, 171.1, 283.4, 167.9, 286.2, 164.3, 288.4, 160.5,
501+ 290.0, 156.3, 291.1, 152.0, 291.8, 147.5, 292.0, 143.1, 291.7, 138.6, 290.9, 134.2,
502+];
crates/client/src/gui/voice_note.rsmodified+5 -4
@@ -4,6 +4,7 @@ use std::{
4 time::{Duration, Instant},4 time::{Duration, Instant},
5 };5 };
6 6
7+use crate::lang::w;
7 use common::call::CreateMessage;8 use common::call::CreateMessage;
8 use common::constant::VOICE_SAMPLE_RATE;9 use common::constant::VOICE_SAMPLE_RATE;
9 use gpui_kit::{10 use gpui_kit::{
@@ -136,7 +137,7 @@ pub fn recording_row(
136 clickable("cancel_voice_note", palette, move |_, cx| {137 clickable("cancel_voice_note", palette, move |_, cx| {
137 cancel.update(cx, |yumush, cx| yumush.cancel_voice_note(cx))138 cancel.update(cx, |yumush, cx| yumush.cancel_voice_note(cx))
138 })139 })
139- .tip("Cancel")140+ .tip(w().voice_note.cancel)
140 .size(px(size::CONTROL_SM))141 .size(px(size::CONTROL_SM))
141 .flex()142 .flex()
142 .items_center()143 .items_center()
@@ -165,7 +166,7 @@ pub fn recording_row(
165 primary_button("send_voice_note", palette, move |window, cx| {166 primary_button("send_voice_note", palette, move |window, cx| {
166 send.update(cx, |yumush, cx| yumush.send_voice_note(window, cx))167 send.update(cx, |yumush, cx| yumush.send_voice_note(window, cx))
167 })168 })
168- .tip("Send")169+ .tip(w().voice_note.send)
169 .size(px(size::CONTROL_SM))170 .size(px(size::CONTROL_SM))
170 .flex()171 .flex()
171 .items_center()172 .items_center()
@@ -181,7 +182,7 @@ pub fn mic_button(entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement
181 clickable("voice_note_button", palette, move |window, cx| {182 clickable("voice_note_button", palette, move |window, cx| {
182 entity.update(cx, |yumush, cx| yumush.start_voice_note(window, cx))183 entity.update(cx, |yumush, cx| yumush.start_voice_note(window, cx))
183 })184 })
184- .tip("Voice message")185+ .tip(w().voice_note.voice_message)
185 .size(px(size::CONTROL_SM))186 .size(px(size::CONTROL_SM))
186 .flex()187 .flex()
187 .items_center()188 .items_center()
@@ -194,7 +195,7 @@ pub fn mic_button(entity: &Entity<Yumush>, palette: Palette) -> impl IntoElement
194 impl Yumush {195 impl Yumush {
195 fn start_voice_note(&mut self, window: &mut Window, cx: &mut Context<Self>) {196 fn start_voice_note(&mut self, window: &mut Window, cx: &mut Context<Self>) {
196 if !matches!(self.chat.voice_state, VoiceState::Off) {197 if !matches!(self.chat.voice_state, VoiceState::Off) {
197- window.push_notification(Notification::error("Leave voice call first"), cx);198+ window.push_notification(Notification::error(w().voice_note.leave_call_first), cx);
198 return;199 return;
199 }200 }
200 let (producer, consumer) = RingBuffer::new(RING_SAMPLES);201 let (producer, consumer) = RingBuffer::new(RING_SAMPLES);
crates/client/src/gui/voice_settings.rsmodified+50 -25
@@ -22,16 +22,25 @@ use super::{
22 style::{radius, size, space},22 style::{radius, size, space},
23 };23 };
24 use crate::{24 use crate::{
25+ lang::w,
25 settings::{Activation, Profile, SENSITIVITY_DB, VOLUME, VoiceSettings},26 settings::{Activation, Profile, SENSITIVITY_DB, VOLUME, VoiceSettings},
26 voice::audio::{self, Device, Devices},27 voice::audio::{self, Device, Devices},
27 };28 };
28 29
29 const LEVEL_INTERVAL: Duration = Duration::from_millis(50);30 const LEVEL_INTERVAL: Duration = Duration::from_millis(50);
30-const MODES: [(Activation, &str); 2] = [31+fn modes() -> [(Activation, &'static str); 2] {
31- (Activation::VoiceActivity, "Voice activity"),32+ [
32- (Activation::PushToTalk, "Push to talk"),33+ (Activation::VoiceActivity, w().voice_settings.voice_activity),
33-];34+ (Activation::PushToTalk, w().voice_settings.push_to_talk),
34-const PROFILES: [(Profile, &str); 2] = [(Profile::Voice, "Voice"), (Profile::Music, "Music")];35+ ]
36+}
37+
38+fn profiles() -> [(Profile, &'static str); 2] {
39+ [
40+ (Profile::Voice, w().voice_settings.voice),
41+ (Profile::Music, w().voice_settings.music),
42+ ]
43+}
35 44
36 #[derive(Clone, Copy, PartialEq, Eq)]45 #[derive(Clone, Copy, PartialEq, Eq)]
37 pub(super) enum Side {46 pub(super) enum Side {
@@ -62,7 +71,7 @@ impl DeviceItem {
62 fn default_choice() -> Self {71 fn default_choice() -> Self {
63 Self {72 Self {
64 id: None,73 id: None,
65- name: "Default".into(),74+ name: w().voice_settings.default.into(),
66 }75 }
67 }76 }
68 }77 }
@@ -229,7 +238,7 @@ impl Yumush {
229 238
230 let mut rows = vec![239 let mut rows = vec![
231 row(240 row(
232- "Input device",241+ w().voice_settings.input_device,
233 div().child(242 div().child(
234 Select::new(&controls.inputs)243 Select::new(&controls.inputs)
235 .appearance(false)244 .appearance(false)
@@ -237,7 +246,7 @@ impl Yumush {
237 ),246 ),
238 ),247 ),
239 row(248 row(
240- "Output device",249+ w().voice_settings.output_device,
241 div().child(250 div().child(
242 Select::new(&controls.outputs)251 Select::new(&controls.outputs)
243 .appearance(false)252 .appearance(false)
@@ -245,17 +254,17 @@ impl Yumush {
245 ),254 ),
246 ),255 ),
247 row(256 row(
248- "Input volume",257+ w().voice_settings.input_volume,
249 volume_control(&controls.input_volume, voice.input_volume, palette),258 volume_control(&controls.input_volume, voice.input_volume, palette),
250 ),259 ),
251 row(260 row(
252- "Output volume",261+ w().voice_settings.output_volume,
253 volume_control(&controls.output_volume, voice.output_volume, palette),262 volume_control(&controls.output_volume, voice.output_volume, palette),
254 ),263 ),
255 row(264 row(
256- "Mode",265+ w().voice_settings.mode,
257 segmented(266 segmented(
258- MODES,267+ modes(),
259 voice.activation,268 voice.activation,
260 entity,269 entity,
261 palette,270 palette,
@@ -263,9 +272,9 @@ impl Yumush {
263 ),272 ),
264 ),273 ),
265 row(274 row(
266- "Profile",275+ w().voice_settings.profile,
267 segmented(276 segmented(
268- PROFILES,277+ profiles(),
269 voice.profile,278 voice.profile,
270 entity,279 entity,
271 palette,280 palette,
@@ -274,13 +283,17 @@ impl Yumush {
274 ),283 ),
275 ];284 ];
276 285
277- rows.push(row("Test", self.test_control(entity, palette)));286+ rows.push(row(
287+ w().voice_settings.test,
288+ self.test_control(entity, palette),
289+ ));
278 match voice.activation {290 match voice.activation {
279- Activation::VoiceActivity => {291+ Activation::VoiceActivity => rows.push(row(
280- rows.push(row("Sensitivity", self.sensitivity_control(palette)))292+ w().voice_settings.sensitivity,
281- }293+ self.sensitivity_control(palette),
294+ )),
282 Activation::PushToTalk => rows.push(row(295 Activation::PushToTalk => rows.push(row(
283- "Key",296+ w().voice_settings.key,
284 self.key_control(&voice.push_to_talk_key, entity, palette, cx),297 self.key_control(&voice.push_to_talk_key, entity, palette, cx),
285 )),298 )),
286 }299 }
@@ -302,7 +315,11 @@ impl Yumush {
302 mic.update(cx, |yumush, cx| yumush.toggle_mic_test(cx));315 mic.update(cx, |yumush, cx| yumush.toggle_mic_test(cx));
303 })316 })
304 .child(Icon::new(IconName::Mic).size(px(size::ICON_SM)))317 .child(Icon::new(IconName::Mic).size(px(size::ICON_SM)))
305- .child(if testing { "Stop" } else { "Hear yourself" }),318+ .child(if testing {
319+ w().voice_settings.stop
320+ } else {
321+ w().voice_settings.hear_yourself
322+ }),
306 )323 )
307 .child(324 .child(
308 test_button("speaker_test_button", palette, false, move |_, cx| {325 test_button("speaker_test_button", palette, false, move |_, cx| {
@@ -311,7 +328,7 @@ impl Yumush {
311 });328 });
312 })329 })
313 .child(Icon::new(IconName::Volume2).size(px(size::ICON_SM)))330 .child(Icon::new(IconName::Volume2).size(px(size::ICON_SM)))
314- .child("Play sound"),331+ .child(w().voice_settings.play_sound),
315 )332 )
316 }333 }
317 334
@@ -345,10 +362,10 @@ impl Yumush {
345 cx: &App,362 cx: &App,
346 ) -> impl IntoElement {363 ) -> impl IntoElement {
347 let content = match self.voice.key {364 let content = match self.voice.key {
348- KeyCapture::Waiting => div().child("Press key").into_any_element(),365+ KeyCapture::Waiting => div().child(w().voice_settings.press_key).into_any_element(),
349 KeyCapture::Idle => match Keystroke::parse_with_os(key, cx.platform_info().os) {366 KeyCapture::Idle => match Keystroke::parse_with_os(key, cx.platform_info().os) {
350 Ok(stroke) if !key.is_empty() => Kbd::new(stroke).into_any_element(),367 Ok(stroke) if !key.is_empty() => Kbd::new(stroke).into_any_element(),
351- _ => div().child("Set key").into_any_element(),368+ _ => div().child(w().voice_settings.set_key).into_any_element(),
352 },369 },
353 };370 };
354 let entity = entity.clone();371 let entity = entity.clone();
@@ -585,8 +602,16 @@ impl Yumush {
585 cx: &App,602 cx: &App,
586 ) -> impl IntoElement {603 ) -> impl IntoElement {
587 let (id, button, tip) = match side {604 let (id, button, tip) = match side {
588- Side::Input => ("mic_settings", "mic_settings_button", "Microphone"),605+ Side::Input => (
589- Side::Output => ("speaker_settings", "speaker_settings_button", "Speaker"),606+ "mic_settings",
607+ "mic_settings_button",
608+ w().voice_settings.microphone,
609+ ),
610+ Side::Output => (
611+ "speaker_settings",
612+ "speaker_settings_button",
613+ w().voice_settings.speaker,
614+ ),
590 };615 };
591 let refresh = entity.clone();616 let refresh = entity.clone();
592 let content = entity.clone();617 let content = entity.clone();
crates/client/src/gui/voice_stats.rsmodified+34 -31
@@ -14,6 +14,7 @@ use super::{
14 parts::{Fill, Ink, Text, band, grow, spark, stack, track, words},14 parts::{Fill, Ink, Text, band, grow, spark, stack, track, words},
15 style::{Tokens, size, space},15 style::{Tokens, size, space},
16 };16 };
17+use crate::lang::w;
17 use crate::media::decode::Engine;18 use crate::media::decode::Engine;
18 use crate::share::session::{LayerStats, WatchStats};19 use crate::share::session::{LayerStats, WatchStats};
19 use crate::usage::Usage;20 use crate::usage::Usage;
@@ -68,9 +69,9 @@ impl Quality {
68 69
69 fn word(self) -> &'static str {70 fn word(self) -> &'static str {
70 match self {71 match self {
71- Self::Good => "good",72+ Self::Good => w().voice_stats.good,
72- Self::Fair => "fair",73+ Self::Fair => w().voice_stats.fair,
73- Self::Poor => "poor",74+ Self::Poor => w().voice_stats.poor,
74 }75 }
75 }76 }
76 }77 }
@@ -191,7 +192,7 @@ fn connection(stats: &Stats, t: Tokens) -> Div {
191 });192 });
192 193
193 stack(space::MD)194 stack(space::MD)
194- .child(title("Connection", String::new(), word, t))195+ .child(title(w().voice_stats.connection, String::new(), word, t))
195 .child(196 .child(
196 band(space::LG)197 band(space::LG)
197 .child(number(198 .child(number(
@@ -208,13 +209,13 @@ fn connection(stats: &Stats, t: Tokens) -> Div {
208 ))209 ))
209 .child(number(210 .child(number(
210 field(loss.map(|loss| format!("{loss:.1}"))),211 field(loss.map(|loss| format!("{loss:.1}"))),
211- "loss %",212+ w().voice_stats.loss,
212 loss.is_some_and(|loss| loss > GOOD_LOSS),213 loss.is_some_and(|loss| loss > GOOD_LOSS),
213 t,214 t,
214 ))215 ))
215 .child(number(216 .child(number(
216 field(latest.map(|sample| format!("{:.0}", sample.traffic.buffer_ms))),217 field(latest.map(|sample| format!("{:.0}", sample.traffic.buffer_ms))),
217- "buffer ms",218+ w().voice_stats.buffer,
218 false,219 false,
219 t,220 t,
220 )),221 )),
@@ -249,16 +250,16 @@ fn traffic(stats: &Stats, t: Tokens) -> Div {
249 let latest = |values: &[f32]| rate(values.last().copied().unwrap_or_default() as u32);250 let latest = |values: &[f32]| rate(values.last().copied().unwrap_or_default() as u32);
250 251
251 stack(space::XS)252 stack(space::XS)
252- .child(title("Traffic", String::new(), None, t))253+ .child(title(w().voice_stats.traffic, String::new(), None, t))
253 .child(line_row(254 .child(line_row(
254- label("up", t),255+ label(w().voice_stats.up, t),
255 line(&up, t.paper()),256 line(&up, t.paper()),
256 latest(&up),257 latest(&up),
257 false,258 false,
258 t,259 t,
259 ))260 ))
260 .child(line_row(261 .child(line_row(
261- label("down", t),262+ label(w().voice_stats.down, t),
262 line(&down, t.dim()),263 line(&down, t.dim()),
263 latest(&down),264 latest(&down),
264 false,265 false,
@@ -273,7 +274,7 @@ fn machine(usage: &Usage, t: Tokens) -> Div {
273 let model = |name: &str| words(name.to_string(), Text::Caption, Ink::Faint, t).truncate();274 let model = |name: &str| words(name.to_string(), Text::Caption, Ink::Faint, t).truncate();
274 275
275 stack(space::XS)276 stack(space::XS)
276- .child(title("This machine", String::new(), None, t))277+ .child(title(w().voice_stats.this_machine, String::new(), None, t))
277 .child(model(&format!("{} · {}", usage.host, usage.os)))278 .child(model(&format!("{} · {}", usage.host, usage.os)))
278 .child(model(&usage.cpu_model))279 .child(model(&usage.cpu_model))
279 .child(line_row(280 .child(line_row(
@@ -286,10 +287,10 @@ fn machine(usage: &Usage, t: Tokens) -> Div {
286 .children(usage.threads.map(|threads| {287 .children(usage.threads.map(|threads| {
287 band(space::MD).children(288 band(space::MD).children(
288 [289 [
289- ("gui", threads.gui),290+ (w().voice_stats.thread_gui, threads.gui),
290- ("camera", threads.camera),291+ (w().voice_stats.thread_camera, threads.camera),
291- ("encode", threads.encode),292+ (w().voice_stats.thread_encode, threads.encode),
292- ("decode", threads.decode),293+ (w().voice_stats.thread_decode, threads.decode),
293 ]294 ]
294 .map(|(name, value)| {295 .map(|(name, value)| {
295 words(format!("{name} {value:.0} %"), Text::Caption, Ink::Faint, t)296 words(format!("{name} {value:.0} %"), Text::Caption, Ink::Faint, t)
@@ -297,7 +298,7 @@ fn machine(usage: &Usage, t: Tokens) -> Div {
297 )298 )
298 }))299 }))
299 .child(line_row(300 .child(line_row(
300- label("memory", t),301+ label(w().voice_stats.memory, t),
301 over(302 over(
302 memory.own_mb as f32 / total_mb,303 memory.own_mb as f32 / total_mb,
303 memory.used_mb as f32 / total_mb,304 memory.used_mb as f32 / total_mb,
@@ -308,7 +309,7 @@ fn machine(usage: &Usage, t: Tokens) -> Div {
308 ))309 ))
309 .children(usage.storage.map(|storage| {310 .children(usage.storage.map(|storage| {
310 line_row(311 line_row(
311- label("storage", t),312+ label(w().voice_stats.storage, t),
312 track(313 track(
313 Fill::Part(storage.used_mb as f32 / storage.total_mb.max(1) as f32),314 Fill::Part(storage.used_mb as f32 / storage.total_mb.max(1) as f32),
314 false,315 false,
@@ -364,8 +365,8 @@ fn sending(sending: &[(Kind, LayerStats)], t: Tokens) -> Vec<Div> {
364 let last = layers.last()?;365 let last = layers.last()?;
365 let max = largest(layers.iter().map(|stats| stats.kbps));366 let max = largest(layers.iter().map(|stats| stats.kbps));
366 let name = match kind {367 let name = match kind {
367- Kind::Screen => "Sending screen",368+ Kind::Screen => w().voice_stats.sending_screen,
368- Kind::Camera => "Sending camera",369+ Kind::Camera => w().voice_stats.sending_camera,
369 };370 };
370 Some(371 Some(
371 stack(space::XS)372 stack(space::XS)
@@ -424,8 +425,12 @@ fn watching(
424 Some(425 Some(
425 stack(space::XS)426 stack(space::XS)
426 .child(title(427 .child(title(
427- "Watching",428+ w().voice_stats.watching,
428- format!("{count} {}", if count == 1 { "stream" } else { "streams" }),429+ if count == 1 {
430+ w().voice_stats.streams_one(count)
431+ } else {
432+ w().voice_stats.streams_many(count)
433+ },
429 None,434 None,
430 t,435 t,
431 ))436 ))
@@ -459,7 +464,7 @@ fn watching(
459 .child(words(detail, Text::Caption, Ink::Faint, t).flex_none()),464 .child(words(detail, Text::Caption, Ink::Faint, t).flex_none()),
460 )465 )
461 .child(line_row(466 .child(line_row(
462- label("rate", t),467+ label(w().voice_stats.rate, t),
463 track(Fill::Part(stats.kbps as f32 / max), bad, t).into_any_element(),468 track(Fill::Part(stats.kbps as f32 / max), bad, t).into_any_element(),
464 rate(stats.kbps),469 rate(stats.kbps),
465 bad,470 bad,
@@ -469,16 +474,14 @@ fn watching(
469 .child(474 .child(
470 band(space::MD)475 band(space::MD)
471 .child(words(476 .child(words(
472- format!(477+ w().voice_stats
473- "latency {}",478+ .latency(latency.map_or("…".into(), |ms| format!("{ms} ms"))),
474- latency.map_or("…".into(), |ms| format!("{ms} ms"))
475- ),
476 Text::Caption,479 Text::Caption,
477 Ink::Faint,480 Ink::Faint,
478 t,481 t,
479 ))482 ))
480 .child(words(483 .child(words(
481- format!("loss {loss:.1} %"),484+ w().voice_stats.loss_now(format!("{loss:.1}")),
482 Text::Caption,485 Text::Caption,
483 if loss > GOOD_LOSS {486 if loss > GOOD_LOSS {
484 Ink::Bad487 Ink::Bad
@@ -488,7 +491,7 @@ fn watching(
488 t,491 t,
489 ))492 ))
490 .child(words(493 .child(words(
491- format!("keyframes {keyframes}"),494+ w().voice_stats.keyframes(keyframes),
492 Text::Caption,495 Text::Caption,
493 Ink::Faint,496 Ink::Faint,
494 t,497 t,
@@ -505,8 +508,8 @@ fn watching(
505 508
506 pub(super) fn kind_word(kind: Kind) -> &'static str {509 pub(super) fn kind_word(kind: Kind) -> &'static str {
507 match kind {510 match kind {
508- Kind::Camera => "camera",511+ Kind::Camera => w().voice_stats.camera,
509- Kind::Screen => "screen",512+ Kind::Screen => w().voice_stats.screen,
510 }513 }
511 }514 }
512 515
@@ -531,8 +534,8 @@ pub fn rate(kbps: u32) -> String {
531 534
532 pub(super) fn engine_label(engine: Engine) -> &'static str {535 pub(super) fn engine_label(engine: Engine) -> &'static str {
533 match engine {536 match engine {
534- Engine::Hardware => "hardware",537+ Engine::Hardware => w().voice_stats.hardware,
535- Engine::Software => "software",538+ Engine::Software => w().voice_stats.software,
536 }539 }
537 }540 }
538 541
crates/client/src/lang.rsadded+95 -0
@@ -0,0 +1,95 @@
1+use std::sync::atomic::{AtomicU8, Ordering};
2+
3+use common::{
4+ model::{Presence, Rank, ReportStatus, Role},
5+ string_enum,
6+};
7+
8+include!(concat!(env!("OUT_DIR"), "/words.rs"));
9+
10+string_enum! {
11+ #[derive(Debug, Clone, Copy, PartialEq, Eq)]
12+ Lang {
13+ En => "en",
14+ Tr => "tr",
15+ }
16+}
17+
18+static CURRENT: AtomicU8 = AtomicU8::new(Lang::En as u8);
19+
20+impl Lang {
21+ pub fn words(self) -> &'static Words {
22+ match self {
23+ Lang::En => &EN,
24+ Lang::Tr => &TR,
25+ }
26+ }
27+
28+ pub fn system() -> Self {
29+ sys_locale::get_locale()
30+ .and_then(|locale| Lang::parse(&locale.get(..2)?.to_lowercase()))
31+ .unwrap_or(Lang::En)
32+ }
33+}
34+
35+pub fn set(lang: Lang) {
36+ CURRENT.store(lang as u8, Ordering::Relaxed);
37+}
38+
39+pub fn w() -> &'static Words {
40+ let current = CURRENT.load(Ordering::Relaxed);
41+ Lang::ALL
42+ .into_iter()
43+ .find(|lang| *lang as u8 == current)
44+ .unwrap_or(Lang::En)
45+ .words()
46+}
47+
48+pub trait Label {
49+ fn label(self) -> &'static str;
50+}
51+
52+impl Label for Role {
53+ fn label(self) -> &'static str {
54+ let w = &w().common;
55+ match self {
56+ Role::User => w.role_user,
57+ Role::Builder => w.role_builder,
58+ }
59+ }
60+}
61+
62+impl Label for Presence {
63+ fn label(self) -> &'static str {
64+ let w = &w().common;
65+ match self {
66+ Presence::Online => w.presence_online,
67+ Presence::Busy => w.presence_busy,
68+ Presence::Offline => w.presence_offline,
69+ }
70+ }
71+}
72+
73+impl Label for Rank {
74+ fn label(self) -> &'static str {
75+ let w = &w().common;
76+ match self {
77+ Rank::Member => w.rank_member,
78+ Rank::Moderator => w.rank_moderator,
79+ Rank::Admin => w.rank_admin,
80+ Rank::Owner => w.rank_owner,
81+ Rank::Builder => w.rank_builder,
82+ }
83+ }
84+}
85+
86+impl Label for ReportStatus {
87+ fn label(self) -> &'static str {
88+ let w = &w().common;
89+ match self {
90+ ReportStatus::Open => w.report_open,
91+ ReportStatus::Resolved => w.report_resolved,
92+ ReportStatus::Dismissed => w.report_dismissed,
93+ }
94+ }
95+}
crates/client/src/lib.rsmodified+1 -0
@@ -8,6 +8,7 @@ pub mod avatar;
8 pub mod embed;8 pub mod embed;
9 pub mod emoji;9 pub mod emoji;
10 pub mod gui;10 pub mod gui;
11+pub mod lang;
11 pub mod logo;12 pub mod logo;
12 pub mod marks;13 pub mod marks;
13 pub mod media;14 pub mod media;
crates/client/src/logo.rsmodified+5 -1
@@ -3,11 +3,12 @@ use std::borrow::Cow;
3 use gpui_kit::{AssetSource, SharedString, assets::AllAssets};3 use gpui_kit::{AssetSource, SharedString, assets::AllAssets};
4 4
5 pub const PATH: &str = "yumush/logo.svg";5 pub const PATH: &str = "yumush/logo.svg";
6+pub const NEEDLE: &str = "yumush/needle.svg";
6 const WINDOW_ICON: u32 = 256;7 const WINDOW_ICON: u32 = 256;
7 8
8 mod svg;9 mod svg;
9 10
10-pub use svg::{NAME, icon, mark, rgba};11+pub use svg::{NAME, icon, mark, needle, rgba};
11 12
12 pub fn window_icon() -> std::sync::Arc<image::RgbaImage> {13 pub fn window_icon() -> std::sync::Arc<image::RgbaImage> {
13 std::sync::Arc::new(14 std::sync::Arc::new(
@@ -54,6 +55,9 @@ impl AssetSource for Assets {
54 if path == PATH {55 if path == PATH {
55 return Ok(Some(Cow::Owned(mark().into_bytes())));56 return Ok(Some(Cow::Owned(mark().into_bytes())));
56 }57 }
58+ if path == NEEDLE {
59+ return Ok(Some(Cow::Owned(needle().into_bytes())));
60+ }
57 AllAssets.load(path)61 AllAssets.load(path)
58 }62 }
59 63
crates/client/src/logo/svg.rsmodified+4 -0
@@ -10,6 +10,10 @@ pub fn mark() -> String {
10 svg("14 12 76 76", "", "#000", "#000")10 svg("14 12 76 76", "", "#000", "#000")
11 }11 }
12 12
13+pub fn needle() -> String {
14+ svg("14 12 76 76", "", "#000", "none")
15+}
16+
13 pub fn icon() -> String {17 pub fn icon() -> String {
14 svg(18 svg(
15 "0 0 100 100",19 "0 0 100 100",
crates/client/src/main.rsmodified+1 -0
@@ -46,6 +46,7 @@ fn main() {
46 tracing::warn!("desktop entry: {error}");46 tracing::warn!("desktop entry: {error}");
47 }47 }
48 let settings = settings::load();48 let settings = settings::load();
49+ client::lang::set(settings.language);
49 let (network_handle, network_event_receiver) = net::start(Server::load());50 let (network_handle, network_event_receiver) = net::start(Server::load());
50 51
51 application()52 application()
crates/client/src/media/mod.rsmodified+2 -1
@@ -17,6 +17,7 @@ use ec_probe::{Reader, decoder::AudioDecoder};
17 use rtrb::RingBuffer;17 use rtrb::RingBuffer;
18 use tracing::warn;18 use tracing::warn;
19 19
20+use crate::lang::w;
20 use crate::voice::{21 use crate::voice::{
21 Playback,22 Playback,
22 audio::{self, Audio, Choice},23 audio::{self, Audio, Choice},
@@ -48,7 +49,7 @@ pub enum MediaError {
48 impl fmt::Display for MediaError {49 impl fmt::Display for MediaError {
49 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {50 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
50 match self {51 match self {
51- MediaError::Unsupported => write!(f, "no playable video or audio track"),52+ MediaError::Unsupported => write!(f, "{}", w().media_mod.no_track),
52 MediaError::Io(error) => write!(f, "{error}"),53 MediaError::Io(error) => write!(f, "{error}"),
53 MediaError::Decode(message) => write!(f, "{message}"),54 MediaError::Decode(message) => write!(f, "{message}"),
54 }55 }
crates/client/src/net/fail.rsmodified+8 -6
@@ -1,5 +1,7 @@
1 use common::{error::Error, frame::FrameError, transport::Close};1 use common::{error::Error, frame::FrameError, transport::Close};
2 2
3+use crate::lang::w;
4+
3 const NO_APPLICATION_PROTOCOL: u64 = 0x100 + 120;5 const NO_APPLICATION_PROTOCOL: u64 = 0x100 + 120;
4 const CRYPTO_ERRORS: std::ops::Range<u64> = 0x100..0x200;6 const CRYPTO_ERRORS: std::ops::Range<u64> = 0x100..0x200;
5 7
@@ -15,10 +17,10 @@ pub enum LinkError {
15 impl std::fmt::Display for LinkError {17 impl std::fmt::Display for LinkError {
16 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17 match self {19 match self {
18- Self::Unreachable => write!(f, "Server unreachable"),20+ Self::Unreachable => write!(f, "{}", w().fail.unreachable),
19- Self::Tls => write!(f, "Certificate error"),21+ Self::Tls => write!(f, "{}", w().fail.tls),
20- Self::Outdated => write!(f, "Client is outdated"),22+ Self::Outdated => write!(f, "{}", w().fail.outdated),
21- Self::Reset => write!(f, "Connection lost"),23+ Self::Reset => write!(f, "{}", w().fail.reset),
22 Self::Closed(close) => write!(f, "{}", close.reason()),24 Self::Closed(close) => write!(f, "{}", close.reason()),
23 }25 }
24 }26 }
@@ -65,9 +67,9 @@ impl std::fmt::Display for Fail {
65 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {67 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
66 match self {68 match self {
67 Self::Server(error) => write!(f, "{error}"),69 Self::Server(error) => write!(f, "{error}"),
68- Self::Offline => write!(f, "Offline"),70+ Self::Offline => write!(f, "{}", w().fail.offline),
69 Self::Link(error) => write!(f, "{error}"),71 Self::Link(error) => write!(f, "{error}"),
70- Self::Protocol => write!(f, "Protocol error"),72+ Self::Protocol => write!(f, "{}", w().fail.protocol),
71 Self::Io(message) => write!(f, "{message}"),73 Self::Io(message) => write!(f, "{message}"),
72 }74 }
73 }75 }
crates/client/src/settings.rsmodified+50 -3
@@ -14,6 +14,7 @@ use gpui_kit::{
14 14
15 use crate::{15 use crate::{
16 gui::style::{Look, Theme},16 gui::style::{Look, Theme},
17+ lang::{Lang, w},
17 read_config,18 read_config,
18 share::{audio::AudioMode, encode::capabilities},19 share::{audio::AudioMode, encode::capabilities},
19 voice::audio::Choice,20 voice::audio::Choice,
@@ -49,9 +50,9 @@ impl Global for Scale {}
49 impl FontSize {50 impl FontSize {
50 pub fn label(self) -> &'static str {51 pub fn label(self) -> &'static str {
51 match self {52 match self {
52- FontSize::Small => "Small",53+ FontSize::Small => w().settings.small,
53- FontSize::Medium => "Medium",54+ FontSize::Medium => w().settings.medium,
54- FontSize::Large => "Large",55+ FontSize::Large => w().settings.large,
55 }56 }
56 }57 }
57 58
@@ -190,9 +191,12 @@ impl ShareSettings {
190 pub struct Settings {191 pub struct Settings {
191 pub theme: Theme,192 pub theme: Theme,
192 pub font_size: FontSize,193 pub font_size: FontSize,
194+ pub language: Lang,
193 pub voice: VoiceSettings,195 pub voice: VoiceSettings,
194 pub share: ShareSettings,196 pub share: ShareSettings,
195 pub close_to_tray: bool,197 pub close_to_tray: bool,
198+ pub jump_usage: BTreeMap<String, u32>,
199+ pub last_chats: BTreeMap<Id, Id>,
196 }200 }
197 201
198 impl Default for Settings {202 impl Default for Settings {
@@ -200,9 +204,12 @@ impl Default for Settings {
200 Self {204 Self {
201 theme: Theme::Gece,205 theme: Theme::Gece,
202 font_size: FontSize::Medium,206 font_size: FontSize::Medium,
207+ language: Lang::system(),
203 voice: VoiceSettings::default(),208 voice: VoiceSettings::default(),
204 share: ShareSettings::default(),209 share: ShareSettings::default(),
205 close_to_tray: true,210 close_to_tray: true,
211+ jump_usage: BTreeMap::new(),
212+ last_chats: BTreeMap::new(),
206 }213 }
207 }214 }
208 }215 }
@@ -307,10 +314,31 @@ pub fn load() -> Settings {
307 font_size: text("font_size")314 font_size: text("font_size")
308 .and_then(|value| FontSize::parse(&value))315 .and_then(|value| FontSize::parse(&value))
309 .unwrap_or(defaults.font_size),316 .unwrap_or(defaults.font_size),
317+ language: text("language")
318+ .and_then(|value| Lang::parse(&value))
319+ .unwrap_or(defaults.language),
310 voice,320 voice,
311 share,321 share,
312 close_to_tray: text("close_to_tray")322 close_to_tray: text("close_to_tray")
313 .map_or(defaults.close_to_tray, |value| value != "false"),323 .map_or(defaults.close_to_tray, |value| value != "false"),
324+ jump_usage: text("jump.usage")
325+ .map(|value| {
326+ value
327+ .split('\t')
328+ .filter_map(|pair| pair.rsplit_once('='))
329+ .filter_map(|(place, count)| Some((place.to_string(), count.parse().ok()?)))
330+ .collect()
331+ })
332+ .unwrap_or_default(),
333+ last_chats: text("last_chats")
334+ .map(|value| {
335+ value
336+ .split(',')
337+ .filter_map(|pair| pair.split_once('='))
338+ .filter_map(|(user, chat)| Some((user.parse().ok()?, chat.parse().ok()?)))
339+ .collect()
340+ })
341+ .unwrap_or_default(),
314 }342 }
315 }343 }
316 344
@@ -330,6 +358,7 @@ pub fn save(settings: &Settings) {
330 let content = [358 let content = [
331 line("theme", settings.theme.as_str()),359 line("theme", settings.theme.as_str()),
332 line("font_size", settings.font_size.as_str()),360 line("font_size", settings.font_size.as_str()),
361+ line("language", settings.language.as_str()),
333 line("close_to_tray", settings.close_to_tray),362 line("close_to_tray", settings.close_to_tray),
334 line("voice.sensitivity", voice.sensitivity_db),363 line("voice.sensitivity", voice.sensitivity_db),
335 line("voice.input_volume", voice.input_volume),364 line("voice.input_volume", voice.input_volume),
@@ -380,6 +409,24 @@ pub fn save(settings: &Settings) {
380 .join("\t"),409 .join("\t"),
381 ),410 ),
382 line("share.volume", share.volume),411 line("share.volume", share.volume),
412+ line(
413+ "jump.usage",
414+ settings
415+ .jump_usage
416+ .iter()
417+ .map(|(place, count)| format!("{place}={count}"))
418+ .collect::<Vec<_>>()
419+ .join("\t"),
420+ ),
421+ line(
422+ "last_chats",
423+ settings
424+ .last_chats
425+ .iter()
426+ .map(|(user, chat)| format!("{user}={chat}"))
427+ .collect::<Vec<_>>()
428+ .join(","),
429+ ),
383 ]430 ]
384 .concat();431 .concat();
385 432
crates/client/src/share/audio_capture_windows.rsmodified+3 -2
@@ -15,6 +15,7 @@ use wasapi::{
15 };15 };
16 16
17 use super::audio::{AudioApp, AudioKind, AudioMode, is_picked};17 use super::audio::{AudioApp, AudioKind, AudioMode, is_picked};
18+use crate::lang::w;
18 use crate::voice::audio::{Worker, supervise};19 use crate::voice::audio::{Worker, supervise};
19 20
20 const STOP_CHECK: Duration = Duration::from_millis(100);21 const STOP_CHECK: Duration = Duration::from_millis(100);
@@ -130,10 +131,10 @@ fn run(
130 .into_iter()131 .into_iter()
131 .find(|app| is_picked((name, *pid), &app.name, app.pid))132 .find(|app| is_picked((name, *pid), &app.name, app.pid))
132 .and_then(|app| app.pid)133 .and_then(|app| app.pid)
133- .ok_or("share audio app is not running")?;134+ .ok_or(w().audio_capture_windows.app_not_running)?;
134 AudioClient::new_application_loopback_client(target, true)?135 AudioClient::new_application_loopback_client(target, true)?
135 }136 }
136- AudioMode::Device(_) => return Err("share audio device capture is not supported".into()),137+ AudioMode::Device(_) => return Err(w().audio_capture_windows.device_unsupported.into()),
137 };138 };
138 client.initialize_client(139 client.initialize_client(
139 &wave_format(),140 &wave_format(),
crates/client/src/share/camera.rsmodified+4 -3
@@ -8,6 +8,7 @@ use std::{
8 time::{Duration, Instant},8 time::{Duration, Instant},
9 };9 };
10 10
11+use crate::lang::w;
11 use common::share::{Mode, Quality, clamp};12 use common::share::{Mode, Quality, clamp};
12 use nokhwa::{13 use nokhwa::{
13 Buffer, Camera as Device,14 Buffer, Camera as Device,
@@ -124,7 +125,7 @@ pub fn open(top: Quality, device: Option<String>) -> Result<Camera, String> {
124 });125 });
125 }126 }
126 if !available() {127 if !available() {
127- return Err("Camera needs the Media Feature Pack".to_string());128+ return Err(w().camera.needs_media_pack.to_string());
128 }129 }
129 let (negotiated_tx, negotiated_rx) = sync_channel::<Result<Negotiated, String>>(1);130 let (negotiated_tx, negotiated_rx) = sync_channel::<Result<Negotiated, String>>(1);
130 let (frames_tx, frames_rx) = sync_channel(FRAME_QUEUE);131 let (frames_tx, frames_rx) = sync_channel(FRAME_QUEUE);
@@ -142,7 +143,7 @@ pub fn open(top: Quality, device: Option<String>) -> Result<Camera, String> {
142 Ok(negotiated) => negotiated,143 Ok(negotiated) => negotiated,
143 Err(_) => {144 Err(_) => {
144 stop.store(true, Ordering::Relaxed);145 stop.store(true, Ordering::Relaxed);
145- return Err("Camera did not respond".to_string());146+ return Err(w().camera.no_response.to_string());
146 }147 }
147 };148 };
148 let (width, height, refresh, size, modes) = match negotiated {149 let (width, height, refresh, size, modes) = match negotiated {
@@ -249,7 +250,7 @@ fn open_device(top: Quality, device: Option<&str>) -> Result<(Device, Vec<Camera
249 Err(error) => tracing::warn!(%error, "camera open failed"),250 Err(error) => tracing::warn!(%error, "camera open failed"),
250 }251 }
251 }252 }
252- Err("No camera found".to_string())253+ Err(w().camera.not_found.to_string())
253 }254 }
254 255
255 fn run(256 fn run(
crates/client/src/share/capture.rsmodified+4 -2
@@ -34,6 +34,8 @@ use spa::{
34 utils::{Choice, ChoiceEnum, ChoiceFlags, Direction, Fraction, Rectangle, SpaTypes},34 utils::{Choice, ChoiceEnum, ChoiceFlags, Direction, Fraction, Rectangle, SpaTypes},
35 };35 };
36 36
37+use crate::lang::w;
38+
37 use super::{39 use super::{
38 fake,40 fake,
39 frame::{BYTES_PER_PIXEL, DEFAULT_REFRESH, FRAME_QUEUE, Frame, Gpu, Release, take_gpu_failed},41 frame::{BYTES_PER_PIXEL, DEFAULT_REFRESH, FRAME_QUEUE, Frame, Gpu, Release, take_gpu_failed},
@@ -145,7 +147,7 @@ async fn pick(
145 .map_err(text)?147 .map_err(text)?
146 .response()148 .response()
147 .map_err(text)?;149 .map_err(text)?;
148- let stream = streams.streams().first().ok_or("no screen stream")?;150+ let stream = streams.streams().first().ok_or(w().capture.no_stream)?;
149 let node_id = stream.pipe_wire_node_id();151 let node_id = stream.pipe_wire_node_id();
150 let fd = screencast152 let fd = screencast
151 .open_pipe_wire_remote(session, Default::default())153 .open_pipe_wire_remote(session, Default::default())
@@ -183,7 +185,7 @@ async fn launch(
183 None => {185 None => {
184 stop.store(true, Ordering::Relaxed);186 stop.store(true, Ordering::Relaxed);
185 let _ = thread.join();187 let _ = thread.join();
186- Err("screen capture did not start".into())188+ Err(w().capture.did_not_start.into())
187 }189 }
188 }190 }
189 }191 }
crates/client/src/share/capture_windows.rsmodified+5 -3
@@ -5,6 +5,8 @@ use std::{
5 5
6 use ec_hw::{D3d11Pool, RgbOrder};6 use ec_hw::{D3d11Pool, RgbOrder};
7 7
8+use crate::lang::w;
9+
8 use windows_capture::{10 use windows_capture::{
9 capture::{CaptureControl, Context, GraphicsCaptureApiHandler},11 capture::{CaptureControl, Context, GraphicsCaptureApiHandler},
10 frame::Frame as CaptureFrame,12 frame::Frame as CaptureFrame,
@@ -49,9 +51,9 @@ pub fn targets() -> Option<Vec<(Target, String)>> {
49 .enumerate()51 .enumerate()
50 .map(move |(index, monitor)| {52 .map(move |(index, monitor)| {
51 let name = if count > 1 {53 let name = if count > 1 {
52- format!("Screen {}", index + 1)54+ w().capture_windows.screen_numbered(index + 1)
53 } else {55 } else {
54- "Screen".into()56+ w().capture_windows.screen.into()
55 };57 };
56 (Target::Screen(monitor.as_raw_hmonitor() as usize), name)58 (Target::Screen(monitor.as_raw_hmonitor() as usize), name)
57 });59 });
@@ -86,7 +88,7 @@ pub async fn open(target: Option<Target>) -> Result<Capture, String> {
86 Some(Target::Window(handle)) => {88 Some(Target::Window(handle)) => {
87 let window = Window::from_raw_hwnd(handle as *mut std::ffi::c_void);89 let window = Window::from_raw_hwnd(handle as *mut std::ffi::c_void);
88 if !window.is_valid() {90 if !window.is_valid() {
89- return Err("window is gone".into());91+ return Err(w().capture_windows.window_gone.into());
90 }92 }
91 let width = u32::try_from(window.width().map_err(text)?).unwrap_or(1);93 let width = u32::try_from(window.width().map_err(text)?).unwrap_or(1);
92 let height = u32::try_from(window.height().map_err(text)?).unwrap_or(1);94 let height = u32::try_from(window.height().map_err(text)?).unwrap_or(1);
crates/client/src/share/session.rsmodified+3 -2
@@ -37,6 +37,7 @@ use super::{
37 pacer::Pacer,37 pacer::Pacer,
38 reassembly::{Assembled, Nack, Reassembler},38 reassembly::{Assembled, Nack, Reassembler},
39 };39 };
40+use crate::lang::w;
40 use crate::media::{41 use crate::media::{
41 self,42 self,
42 decode::{Engine, VideoDecoder, lock},43 decode::{Engine, VideoDecoder, lock},
@@ -229,7 +230,7 @@ impl Sharing {
229 camera_device: Option<String>,230 camera_device: Option<String>,
230 ) -> Result<Sharing, String> {231 ) -> Result<Sharing, String> {
231 if encode.is_empty() {232 if encode.is_empty() {
232- return Err("codec unavailable".into());233+ return Err(w().session.codec_unavailable.into());
233 }234 }
234 let audio = audio.filter(|_| kind == Kind::Screen);235 let audio = audio.filter(|_| kind == Kind::Screen);
235 warn_if_small(&connection);236 warn_if_small(&connection);
@@ -321,7 +322,7 @@ impl Sharing {
321 audio: Option<AudioMode>,322 audio: Option<AudioMode>,
322 ) -> Result<Source, String> {323 ) -> Result<Source, String> {
323 if encode.is_empty() {324 if encode.is_empty() {
324- return Err("codec unavailable".into());325+ return Err(w().session.codec_unavailable.into());
325 }326 }
326 self.source.top = Self::clamp(top, &self.modes);327 self.source.top = Self::clamp(top, &self.modes);
327 self.source.encode = encode;328 self.source.encode = encode;
crates/client/src/share/unsupported.rsmodified+4 -4
@@ -1,12 +1,12 @@
1 use std::sync::mpsc::Receiver;1 use std::sync::mpsc::Receiver;
2 2
3+use crate::lang::w;
4+
3 use super::{5 use super::{
4 audio::{AudioApp, AudioMode},6 audio::{AudioApp, AudioMode},
5 frame::Frame,7 frame::Frame,
6 };8 };
7 9
8-const UNSUPPORTED: &str = "screen share is not supported on this OS";
9-
10 pub mod capture {10 pub mod capture {
11 use super::*;11 use super::*;
12 12
@@ -22,7 +22,7 @@ pub mod capture {
22 }22 }
23 23
24 pub async fn open(_: Option<crate::share::Target>) -> Result<Capture, String> {24 pub async fn open(_: Option<crate::share::Target>) -> Result<Capture, String> {
25- Err(UNSUPPORTED.into())25+ Err(w().unsupported.not_supported.into())
26 }26 }
27 }27 }
28 28
@@ -52,7 +52,7 @@ pub mod camera {
52 }52 }
53 53
54 pub fn open(_: Quality, _: Option<String>) -> Result<Camera, String> {54 pub fn open(_: Quality, _: Option<String>) -> Result<Camera, String> {
55- Err(UNSUPPORTED.into())55+ Err(w().unsupported.not_supported.into())
56 }56 }
57 57
58 pub fn list(_: Option<&str>) -> Vec<Mode> {58 pub fn list(_: Option<&str>) -> Vec<Mode> {
crates/client/src/tray.rsmodified+10 -10
@@ -1,3 +1,6 @@
1+#[cfg(any(target_os = "linux", target_os = "windows"))]
2+use crate::lang::w;
3+
1 pub const AVAILABLE: bool = cfg!(any(target_os = "linux", target_os = "windows"));4 pub const AVAILABLE: bool = cfg!(any(target_os = "linux", target_os = "windows"));
2 5
3 #[derive(Debug, Clone, Copy, PartialEq, Eq)]6 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -54,12 +57,7 @@ impl TrayState {
54 fn tip(self) -> String {57 fn tip(self) -> String {
55 match self.badge() {58 match self.badge() {
56 Badge::None => crate::NAME.to_string(),59 Badge::None => crate::NAME.to_string(),
57- _ => format!(60+ _ => w().tray.tip(self.mentions, self.messages, crate::NAME),
58- "{} · {} unread · {} mentions",
59- crate::NAME,
60- self.messages,
61- self.mentions
62- ),
63 }61 }
64 }62 }
65 }63 }
@@ -114,6 +112,7 @@ mod linux {
114 use tracing::warn;112 use tracing::warn;
115 113
116 use super::{Badge, ICON_SIZE, TrayAction, TrayHandle, TrayState, pixels};114 use super::{Badge, ICON_SIZE, TrayAction, TrayHandle, TrayState, pixels};
115+ use crate::lang::w;
117 116
118 pub fn start() -> (mpsc::UnboundedReceiver<TrayAction>, TrayHandle) {117 pub fn start() -> (mpsc::UnboundedReceiver<TrayAction>, TrayHandle) {
119 let (sender, receiver) = mpsc::unbounded_channel();118 let (sender, receiver) = mpsc::unbounded_channel();
@@ -198,7 +197,7 @@ mod linux {
198 197
199 vec![198 vec![
200 StandardItem {199 StandardItem {
201- label: "Show".to_string(),200+ label: w().tray.show.to_string(),
202 activate: Box::new(|tray: &mut Self| {201 activate: Box::new(|tray: &mut Self| {
203 let _ = tray.sender.send(TrayAction::Show);202 let _ = tray.sender.send(TrayAction::Show);
204 }),203 }),
@@ -206,7 +205,7 @@ mod linux {
206 }205 }
207 .into(),206 .into(),
208 StandardItem {207 StandardItem {
209- label: "Quit".to_string(),208+ label: w().tray.quit.to_string(),
210 activate: Box::new(|tray: &mut Self| {209 activate: Box::new(|tray: &mut Self| {
211 let _ = tray.sender.send(TrayAction::Quit);210 let _ = tray.sender.send(TrayAction::Quit);
212 }),211 }),
@@ -238,6 +237,7 @@ mod windows {
238 };237 };
239 238
240 use super::{Badge, ICON_SIZE, TrayAction, TrayHandle, TrayState, pixels};239 use super::{Badge, ICON_SIZE, TrayAction, TrayHandle, TrayState, pixels};
240+ use crate::lang::w;
241 241
242 fn icon(badge: Badge) -> Option<Icon> {242 fn icon(badge: Badge) -> Option<Icon> {
243 let rgba = pixels(badge)243 let rgba = pixels(badge)
@@ -248,8 +248,8 @@ mod windows {
248 248
249 pub fn start() -> (mpsc::UnboundedReceiver<TrayAction>, TrayHandle) {249 pub fn start() -> (mpsc::UnboundedReceiver<TrayAction>, TrayHandle) {
250 let (sender, receiver) = mpsc::unbounded_channel();250 let (sender, receiver) = mpsc::unbounded_channel();
251- let show = MenuItem::new("Show", true, None);251+ let show = MenuItem::new(w().tray.show, true, None);
252- let quit = MenuItem::new("Quit", true, None);252+ let quit = MenuItem::new(w().tray.quit, true, None);
253 let menu = Menu::new();253 let menu = Menu::new();
254 if let Err(error) = menu.append_items(&[&show, &quit]) {254 if let Err(error) = menu.append_items(&[&show, &quit]) {
255 warn!("tray menu: {error}");255 warn!("tray menu: {error}");
crates/common/src/model.rsmodified+0 -41
@@ -70,15 +70,6 @@ string_enum! {
70 }70 }
71 }71 }
72 72
73-impl Role {
74- pub fn label(self) -> &'static str {
75- match self {
76- Role::User => "User",
77- Role::Builder => "Builder",
78- }
79- }
80-}
81-
82 string_enum! {73 string_enum! {
83 #[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]74 #[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
84 Presence {75 Presence {
@@ -88,16 +79,6 @@ string_enum! {
88 }79 }
89 }80 }
90 81
91-impl Presence {
92- pub fn label(self) -> &'static str {
93- match self {
94- Presence::Online => "Online",
95- Presence::Busy => "Busy",
96- Presence::Offline => "Offline",
97- }
98- }
99-}
100-
101 string_enum! {82 string_enum! {
102 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)]83 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encode, Decode)]
103 Rank {84 Rank {
@@ -109,18 +90,6 @@ string_enum! {
109 }90 }
110 }91 }
111 92
112-impl Rank {
113- pub fn label(self) -> &'static str {
114- match self {
115- Rank::Member => "Member",
116- Rank::Moderator => "Moderator",
117- Rank::Admin => "Admin",
118- Rank::Owner => "Owner",
119- Rank::Builder => "Builder",
120- }
121- }
122-}
123-
124 #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]93 #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]
125 pub struct User {94 pub struct User {
126 pub id: Id,95 pub id: Id,
@@ -384,16 +353,6 @@ string_enum! {
384 }353 }
385 }354 }
386 355
387-impl ReportStatus {
388- pub fn label(self) -> &'static str {
389- match self {
390- ReportStatus::Open => "Open",
391- ReportStatus::Resolved => "Resolved",
392- ReportStatus::Dismissed => "Dismissed",
393- }
394- }
395-}
396-
397 #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]356 #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]
398 pub struct Report {357 pub struct Report {
399 pub id: Id,358 pub id: Id,
crates/server/src/files.rsmodified+3 -2
@@ -423,11 +423,11 @@ mod tests {
423 423
424 #[test]424 #[test]
425 fn avatar_checks_jpeg_size() {425 fn avatar_checks_jpeg_size() {
426- let small = check_avatar(&jpeg(AVATAR_SIZE / 2));426+ let large = check_avatar(&jpeg(AVATAR_SIZE * 2));
427 let not_jpeg = check_avatar(b"not a jpeg");427 let not_jpeg = check_avatar(b"not a jpeg");
428 428
429 assert!(matches!(429 assert!(matches!(
430- small,430+ large,
431 Err(ServerError::Wire(CommonError::Invalid {431 Err(ServerError::Wire(CommonError::Invalid {
432 field: Field::Avatar,432 field: Field::Avatar,
433 ..433 ..
@@ -441,6 +441,7 @@ mod tests {
441 }))441 }))
442 ));442 ));
443 assert!(check_avatar(&jpeg(AVATAR_SIZE)).is_ok());443 assert!(check_avatar(&jpeg(AVATAR_SIZE)).is_ok());
444+ assert!(check_avatar(&jpeg(AVATAR_SIZE / 2)).is_ok());
444 }445 }
445 446
446 #[tokio::test]447 #[tokio::test]