forge
Explore
Log in

Don't you dare go Hollow

The seeded statuses read Turkish — Bekleyen, Devam Ediyor, İncelemede, Tamamlandı

Browse files at this commit

1666404a1c28203faee12793855768f561c96b96Ahmet Kaan GümüşParent: fa7b98e
  • feat
    • the seeded statuses read Turkish — Bekleyen, Devam Ediyor, İncelemede, Tamamlandı
Show full message
✨ feat(board): the seeded statuses read Turkish — Bekleyen, Devam Ediyor, İncelemede, Tamamlandı

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.rsmodified+8 -1
@@ -260,6 +260,7 @@ async fn board_columns(
260 };260 };
261 };261 };
262 for column in &mut view_data.columns {262 for column in &mut view_data.columns {
263+ column.column.name = crate::i18n::column_name(lang, &column.column.name);
263 sort_column_cards(&mut column.cards, &sort);264 sort_column_cards(&mut column.cards, &sort);
264 if let Some(tag_id) = &tag_filter {265 if let Some(tag_id) = &tag_filter {
265 column266 column
@@ -553,12 +554,18 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result {
553 izlek_core::board::load(store.as_ref(), &user.workspace_id).await?554 izlek_core::board::load(store.as_ref(), &user.workspace_id).await?
554 };555 };
555 let lang = Lang::from_code(&user.language);556 let lang = Lang::from_code(&user.language);
556- let Some(view_data) = view_data else {557+ let Some(mut view_data) = view_data else {
557 return view! {558 return view! {
558 cx =>559 cx =>
559 <main class="scaffold-note"><p>(t(lang, Key::SomethingWentWrong))</p></main>560 <main class="scaffold-note"><p>(t(lang, Key::SomethingWentWrong))</p></main>
560 };561 };
561 };562 };
563+ // Column names are stored data; the viewer reads them in their own
564+ // language, and every name this page derives — headers, the card move
565+ // menus — inherits the translated ones.
566+ for column in &mut view_data.columns {
567+ column.column.name = crate::i18n::column_name(lang, &column.column.name);
568+ }
562 let tags = {569 let tags = {
563 let store = accounts(cx).store().clone();570 let store = accounts(cx).store().clone();
564 store.tags(&view_data.board.id).await?571 store.tags(&view_data.board.id).await?
crates/izlek-web/src/detail.rsmodified+7 -1
@@ -295,7 +295,7 @@ async fn load_snapshot(
295 };295 };
296 let store = accounts(cx).store().clone();296 let store = accounts(cx).store().clone();
297 297
298- let Some(detail) = load(store.as_ref(), &user.workspace_id, task_id).await? else {298+ let Some(mut detail) = load(store.as_ref(), &user.workspace_id, task_id).await? else {
299 return Ok(Err(Refusal::NotFound));299 return Ok(Err(Refusal::NotFound));
300 };300 };
301 301
@@ -374,6 +374,12 @@ async fn load_snapshot(
374 let may_administer = user.role.can_administer();374 let may_administer = user.role.can_administer();
375 let lang = Lang::from_code(&user.language);375 let lang = Lang::from_code(&user.language);
376 let zone = parse_zone(&user.timezone);376 let zone = parse_zone(&user.timezone);
377+ // Column names are stored data; the task's own status and the move
378+ // picker's choices read in the viewer's language.
379+ detail.column.name = crate::i18n::column_name(lang, &detail.column.name);
380+ for column in &mut detail.columns {
381+ column.name = crate::i18n::column_name(lang, &column.name);
382+ }
377 383
378 let decisions = store.decisions_for_task(&detail.id, 10).await?;384 let decisions = store.decisions_for_task(&detail.id, 10).await?;
379 let sends = store.sends_for_task(&detail.id, 50).await?;385 let sends = store.sends_for_task(&detail.id, 50).await?;
crates/izlek-web/src/i18n.rsmodified+37 -0
@@ -1318,3 +1318,40 @@ pub fn watches_unblock_phrase(lang: Lang) -> &'static str {
1318 Lang::Tr => "son engelinin kalkmasını",1318 Lang::Tr => "son engelinin kalkmasını",
1319 }1319 }
1320 }1320 }
1321+
1322+/// A board column's name, in the viewer's language. Column names are stored
1323+/// data — the seeded defaults ship in English (`turso_store.rs`'s seed) and
1324+/// mail rules match on the stored string — so translation happens at the
1325+/// edge, like [`activity_kind_word`]: the four seeded names read Turkish,
1326+/// and any other name (a renamed or custom column) passes through as data.
1327+pub fn column_name(lang: Lang, name: &str) -> String {
1328+ match (name, lang) {
1329+ ("Backlog", Lang::Tr) => "Bekleyen".to_string(),
1330+ ("In Progress", Lang::Tr) => "Devam Ediyor".to_string(),
1331+ ("Review", Lang::Tr) => "İncelemede".to_string(),
1332+ ("Done", Lang::Tr) => "Tamamlandı".to_string(),
1333+ (other, _) => other.to_string(),
1334+ }
1335+}
1336+
1337+#[cfg(test)]
1338+mod tests {
1339+ use super::*;
1340+
1341+ /// The four seeded columns read Turkish for a Turkish viewer and stay
1342+ /// English otherwise; a column that is not one of the seeds is data and
1343+ /// passes through in every language.
1344+ #[test]
1345+ fn seeded_columns_translate() {
1346+ for (stored, tr) in [
1347+ ("Backlog", "Bekleyen"),
1348+ ("In Progress", "Devam Ediyor"),
1349+ ("Review", "İncelemede"),
1350+ ("Done", "Tamamlandı"),
1351+ ] {
1352+ assert_eq!(column_name(Lang::Tr, stored), tr);
1353+ assert_eq!(column_name(Lang::En, stored), stored);
1354+ }
1355+ assert_eq!(column_name(Lang::Tr, "Shipped"), "Shipped");
1356+ }
1357+}
crates/izlek-web/src/logs.rsmodified+7 -2
@@ -207,7 +207,12 @@ pub(crate) async fn event_happened(
207 Ok(columns207 Ok(columns
208 .into_iter()208 .into_iter()
209 .find(|column| column.id == transition.to_column)209 .find(|column| column.id == transition.to_column)
210- .map(|column| crate::i18n::moved_to_label(lang, &column.name)))210+ .map(|column| {
211+ crate::i18n::moved_to_label(
212+ lang,
213+ &crate::i18n::column_name(lang, &column.name),
214+ )
215+ }))
211 }216 }
212 Event::Freed(_) => Ok(Some(t(lang, Key::UnblockedWord).to_string())),217 Event::Freed(_) => Ok(Some(t(lang, Key::UnblockedWord).to_string())),
213 // Not a wired path yet — S4's work — so this only needs to be218 // Not a wired path yet — S4's work — so this only needs to be
@@ -268,7 +273,7 @@ pub(crate) async fn decision_detail(
268 columns273 columns
269 .iter()274 .iter()
270 .find(|column| column.id == id)275 .find(|column| column.id == id)
271- .map(|column| column.name.clone())276+ .map(|column| crate::i18n::column_name(lang, &column.name))
272 .unwrap_or_else(|| t(lang, Key::AColumn).to_string())277 .unwrap_or_else(|| t(lang, Key::AColumn).to_string())
273 };278 };
274 if let Some(rest) = detail.strip_prefix("moved:") {279 if let Some(rest) = detail.strip_prefix("moved:") {
crates/izlek-web/src/rules.rsmodified+2 -2
@@ -190,7 +190,7 @@ fn sentence_of(
190 .find(|column| &column.id == column_id)190 .find(|column| &column.id == column_id)
191 // A rule can outlive the column it names. Saying so is191 // A rule can outlive the column it names. Saying so is
192 // better than printing an id nobody can read.192 // better than printing an id nobody can read.
193- .map(|column| column.name.clone())193+ .map(|column| crate::i18n::column_name(lang, &column.name))
194 .unwrap_or_else(|| t(lang, Key::ColumnGone).to_string()),194 .unwrap_or_else(|| t(lang, Key::ColumnGone).to_string()),
195 ),195 ),
196 "status".to_string(),196 "status".to_string(),
@@ -337,7 +337,7 @@ async fn snapshot_of(
337 .into_iter()337 .into_iter()
338 .map(|column| ColumnChoice {338 .map(|column| ColumnChoice {
339 id: column.id,339 id: column.id,
340- name: column.name,340+ name: crate::i18n::column_name(lang, &column.name),
341 })341 })
342 .collect(),342 .collect(),
343 sender_connected,343 sender_connected,