From 1666404a1c28203faee12793855768f561c96b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Mon, 31 Aug 2026 07:13:31 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(board):=20the=20seeded=20statu?= =?UTF-8?q?ses=20read=20Turkish=20=E2=80=94=20Bekleyen,=20Devam=20Ediyor,?= =?UTF-8?q?=20=C4=B0ncelemede,=20Tamamland=C4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Column names are stored data, seeded in English, and mail rules match on the stored string, so the translation happens at the render edge: a new i18n::column_name maps the four seeds for Turkish viewers and passes any other name through, wired into the board headers, the move pickers, the detail status field, subtask breadcrumbs, the rules page and the logs. --- crates/izlek-web/src/board.rs | 9 ++++++++- crates/izlek-web/src/detail.rs | 8 +++++++- crates/izlek-web/src/i18n.rs | 37 ++++++++++++++++++++++++++++++++++ crates/izlek-web/src/logs.rs | 9 +++++++-- crates/izlek-web/src/rules.rs | 4 ++-- 5 files changed, 61 insertions(+), 6 deletions(-) diff --git a/crates/izlek-web/src/board.rs b/crates/izlek-web/src/board.rs index bf024f5..84f1fbe 100644 --- a/crates/izlek-web/src/board.rs +++ b/crates/izlek-web/src/board.rs @@ -260,6 +260,7 @@ async fn board_columns( }; }; for column in &mut view_data.columns { + column.column.name = crate::i18n::column_name(lang, &column.column.name); sort_column_cards(&mut column.cards, &sort); if let Some(tag_id) = &tag_filter { column @@ -553,12 +554,18 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result { izlek_core::board::load(store.as_ref(), &user.workspace_id).await? }; let lang = Lang::from_code(&user.language); - let Some(view_data) = view_data else { + let Some(mut view_data) = view_data else { return view! { cx =>

(t(lang, Key::SomethingWentWrong))

}; }; + // Column names are stored data; the viewer reads them in their own + // language, and every name this page derives — headers, the card move + // menus — inherits the translated ones. + for column in &mut view_data.columns { + column.column.name = crate::i18n::column_name(lang, &column.column.name); + } let tags = { let store = accounts(cx).store().clone(); store.tags(&view_data.board.id).await? diff --git a/crates/izlek-web/src/detail.rs b/crates/izlek-web/src/detail.rs index 46029c3..6ead84e 100644 --- a/crates/izlek-web/src/detail.rs +++ b/crates/izlek-web/src/detail.rs @@ -295,7 +295,7 @@ async fn load_snapshot( }; let store = accounts(cx).store().clone(); - let Some(detail) = load(store.as_ref(), &user.workspace_id, task_id).await? else { + let Some(mut detail) = load(store.as_ref(), &user.workspace_id, task_id).await? else { return Ok(Err(Refusal::NotFound)); }; @@ -374,6 +374,12 @@ async fn load_snapshot( let may_administer = user.role.can_administer(); let lang = Lang::from_code(&user.language); let zone = parse_zone(&user.timezone); + // Column names are stored data; the task's own status and the move + // picker's choices read in the viewer's language. + detail.column.name = crate::i18n::column_name(lang, &detail.column.name); + for column in &mut detail.columns { + column.name = crate::i18n::column_name(lang, &column.name); + } let decisions = store.decisions_for_task(&detail.id, 10).await?; let sends = store.sends_for_task(&detail.id, 50).await?; diff --git a/crates/izlek-web/src/i18n.rs b/crates/izlek-web/src/i18n.rs index ce13d76..adeffe4 100644 --- a/crates/izlek-web/src/i18n.rs +++ b/crates/izlek-web/src/i18n.rs @@ -1318,3 +1318,40 @@ pub fn watches_unblock_phrase(lang: Lang) -> &'static str { Lang::Tr => "son engelinin kalkmasını", } } + +/// A board column's name, in the viewer's language. Column names are stored +/// data — the seeded defaults ship in English (`turso_store.rs`'s seed) and +/// mail rules match on the stored string — so translation happens at the +/// edge, like [`activity_kind_word`]: the four seeded names read Turkish, +/// and any other name (a renamed or custom column) passes through as data. +pub fn column_name(lang: Lang, name: &str) -> String { + match (name, lang) { + ("Backlog", Lang::Tr) => "Bekleyen".to_string(), + ("In Progress", Lang::Tr) => "Devam Ediyor".to_string(), + ("Review", Lang::Tr) => "İncelemede".to_string(), + ("Done", Lang::Tr) => "Tamamlandı".to_string(), + (other, _) => other.to_string(), + } +} + +#[cfg(test)] +mod tests { + use super::*; + + /// The four seeded columns read Turkish for a Turkish viewer and stay + /// English otherwise; a column that is not one of the seeds is data and + /// passes through in every language. + #[test] + fn seeded_columns_translate() { + for (stored, tr) in [ + ("Backlog", "Bekleyen"), + ("In Progress", "Devam Ediyor"), + ("Review", "İncelemede"), + ("Done", "Tamamlandı"), + ] { + assert_eq!(column_name(Lang::Tr, stored), tr); + assert_eq!(column_name(Lang::En, stored), stored); + } + assert_eq!(column_name(Lang::Tr, "Shipped"), "Shipped"); + } +} diff --git a/crates/izlek-web/src/logs.rs b/crates/izlek-web/src/logs.rs index bb34004..80617ff 100644 --- a/crates/izlek-web/src/logs.rs +++ b/crates/izlek-web/src/logs.rs @@ -207,7 +207,12 @@ pub(crate) async fn event_happened( Ok(columns .into_iter() .find(|column| column.id == transition.to_column) - .map(|column| crate::i18n::moved_to_label(lang, &column.name))) + .map(|column| { + crate::i18n::moved_to_label( + lang, + &crate::i18n::column_name(lang, &column.name), + ) + })) } Event::Freed(_) => Ok(Some(t(lang, Key::UnblockedWord).to_string())), // Not a wired path yet — S4's work — so this only needs to be @@ -268,7 +273,7 @@ pub(crate) async fn decision_detail( columns .iter() .find(|column| column.id == id) - .map(|column| column.name.clone()) + .map(|column| crate::i18n::column_name(lang, &column.name)) .unwrap_or_else(|| t(lang, Key::AColumn).to_string()) }; if let Some(rest) = detail.strip_prefix("moved:") { diff --git a/crates/izlek-web/src/rules.rs b/crates/izlek-web/src/rules.rs index 4d4cbb4..007f31e 100644 --- a/crates/izlek-web/src/rules.rs +++ b/crates/izlek-web/src/rules.rs @@ -190,7 +190,7 @@ fn sentence_of( .find(|column| &column.id == column_id) // A rule can outlive the column it names. Saying so is // better than printing an id nobody can read. - .map(|column| column.name.clone()) + .map(|column| crate::i18n::column_name(lang, &column.name)) .unwrap_or_else(|| t(lang, Key::ColumnGone).to_string()), ), "status".to_string(), @@ -337,7 +337,7 @@ async fn snapshot_of( .into_iter() .map(|column| ColumnChoice { id: column.id, - name: column.name, + name: crate::i18n::column_name(lang, &column.name), }) .collect(), sender_connected,