diff --git a/crates/im-web/src/i18n.rs b/crates/im-web/src/i18n.rs index 3244b0a..e9879d2 100644 --- a/crates/im-web/src/i18n.rs +++ b/crates/im-web/src/i18n.rs @@ -156,6 +156,7 @@ pub enum Key { ViewPhotoAria, ThisSessionChip, UnknownDevice, + BrowserWord, DeviceLabel, AddressLabel, SignedInLabel, @@ -552,6 +553,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str { (ThisSessionChip, Tr) => "Bu oturum", (UnknownDevice, En) => "Unknown device", (UnknownDevice, Tr) => "Bilinmeyen cihaz", + (BrowserWord, En) => "Browser", + (BrowserWord, Tr) => "Tarayıcı", (DeviceLabel, En) => "Device", (DeviceLabel, Tr) => "Cihaz", (AddressLabel, En) => "Address", @@ -929,6 +932,17 @@ pub fn t(lang: Lang, key: Key) -> &'static str { } } +/// A session's device summary — "Chrome on Linux". The browser and system +/// names are proper nouns and stay as the agent spelled them; only the +/// connector between them follows the viewer's language, and Turkish reads +/// it as a location: "Linux üzerinde Chrome". +pub fn device_summary(lang: Lang, browser: &str, system: &str) -> String { + match lang { + Lang::En => format!("{browser} on {system}"), + Lang::Tr => format!("{system} üzerinde {browser}"), + } +} + /// A user row's "Sessions (N)" disclosure summary, in the viewer's language. pub fn sessions_summary(lang: Lang, n: usize) -> String { match lang { diff --git a/crates/im-web/src/pages.rs b/crates/im-web/src/pages.rs index a87a84c..29f7062 100644 --- a/crates/im-web/src/pages.rs +++ b/crates/im-web/src/pages.rs @@ -493,8 +493,9 @@ pub(crate) fn escape(raw: &str) -> String { /// header. The full string stays one click away in the session's detail. /// Substring matching in precedence order (Edge before Chrome before Safari: /// each carries the later one's token too); shared with the admin panel. -/// Browser and system names are proper nouns and stay untranslated; only the -/// unknown-device fallback follows the viewer's language. +/// Browser and system names are proper nouns and stay as the agent spelled +/// them; the connector and the generic fallback follow the viewer's language +/// (`i18n::device_summary`, `Key::BrowserWord`). pub(crate) fn device_label(agent: Option<&str>, lang: Lang) -> String { let Some(agent) = agent.filter(|agent| !agent.is_empty()) else { return t(lang, Key::UnknownDevice).to_string(); @@ -508,7 +509,7 @@ pub(crate) fn device_label(agent: Option<&str>, lang: Lang) -> String { } else if agent.contains("Safari/") { "Safari" } else { - "Browser" + return t(lang, Key::BrowserWord).to_string(); }; let system = if agent.contains("iPhone") { "iPhone" @@ -527,7 +528,7 @@ pub(crate) fn device_label(agent: Option<&str>, lang: Lang) -> String { } else { return browser.to_string(); }; - format!("{browser} on {system}") + crate::i18n::device_summary(lang, browser, system) } /// `2026-09-04 10:22`: the last-seen stamp. An unrenderable stamp falls back