Add full DE/EN UI label translations across all pages

Add t() translation function to i18n.rs with ~200 key/value pairs
covering navigation, card headers, field labels, buttons, filters,
planting calendar rows, and general UI text in both German and English.

Updated all 11 source files to use t(&lang, "key") instead of
hardcoded English strings: app.rs (sidebar nav), all 7 page files
(species, cultivars, families, suppliers, home, search, sources),
and all 3 component files (planting_calendar, table_controls,
plant_card). Boolean values (Yes/No/Annual) are also translated.
This commit is contained in:
2026-03-15 17:20:51 +01:00
parent 896b364b09
commit aa36c846d7
11 changed files with 679 additions and 270 deletions
+6 -5
View File
@@ -3,23 +3,24 @@ use dioxus::prelude::*;
use crate::api;
use crate::app::{Lang, Route};
use crate::components::plant_card::PlantCard;
use crate::i18n::pick_name;
use crate::i18n::{pick_name, t};
#[component]
pub fn Home() -> Element {
let lang = use_context::<Lang>().0;
let mut search_query = use_signal(|| String::new());
let species = use_resource(|| async { api::list_species(1, 12, None, None).await });
let l = lang.read().clone();
rsx! {
div { class: "page home-page",
h1 { "HerbAPI" }
p { class: "subtitle", "Trilingual plant reference database" }
p { class: "subtitle", "{t(&l, \"subtitle\")}" }
div { class: "search-bar",
input {
r#type: "text",
placeholder: "Search plants...",
placeholder: "{t(&l, \"search.placeholder\")}",
value: "{search_query}",
oninput: move |e| search_query.set(e.value()),
onkeydown: move |e| {
@@ -31,9 +32,9 @@ pub fn Home() -> Element {
}
}
h2 { "Recent Species" }
h2 { "{t(&l, \"page.recent_species\")}" }
match &*species.read() {
None => rsx! { p { "Loading..." } },
None => rsx! { p { "{t(&l, \"loading\")}" } },
Some(Err(e)) => rsx! { p { class: "error", "Error: {e}" } },
Some(Ok(data)) => rsx! {
div { class: "card-grid",