Added en-GB and de-DE
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
@@ -1,26 +1,34 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_sdk::{i18n::*, translate};
|
||||
|
||||
use crate::Route;
|
||||
|
||||
pub fn Header() -> Element {
|
||||
let mut i18 = use_i18();
|
||||
|
||||
let change_to_english = move |_| i18.set_language("en-GB".parse().unwrap());
|
||||
let change_to_german = move |_| i18.set_language("de-DE".parse().unwrap());
|
||||
|
||||
rsx! {
|
||||
nav {
|
||||
div {
|
||||
class: "flex items-center justify-between p-4 w-96",
|
||||
class: "flex items-center justify-between p-4 flex-wrap mx-auto max-w-screen-xl",
|
||||
class: "flex items-center justify-between p-4 space-x-8",
|
||||
Link {
|
||||
to: Route::Home {},
|
||||
class:"flex items-center space-x-3 rtl:space-x-reverse",
|
||||
img { src:"/pictures/ClackCat_t.webp", class:"rounded-full h-8", alt:"Flowbite Logo" },
|
||||
span { class:"self-center text-2xl font-semibold whitespace-nowrap dark:text-white", "" }
|
||||
}
|
||||
div { class:"", id:"navbar-default",
|
||||
ul { class:"flex space-x-8",
|
||||
li { class: "", HeaderLink { url: Route::Home {}, text: "Home" } },
|
||||
li { class: "", HeaderLink { url: Route::CV {}, text: "CV" } },
|
||||
li { class: "", HeaderLink { url: Route::ProjectsPublications {}, text: "Publications/Projects" } },
|
||||
li { class: "", HeaderLink { url: Route::Impressum {}, text: "About" } },
|
||||
}
|
||||
class: "justify-start",
|
||||
img { src:"/pictures/ClackCat_t.webp", class:"rounded-full h-8", alt:"TuDatTr Logo" },
|
||||
},
|
||||
ul {
|
||||
class:"flex space-x-8",
|
||||
li { HeaderLink { url: Route::Home {}, text: translate!(i18, "headers.home")} },
|
||||
li { HeaderLink { url: Route::CV {}, text: translate!(i18, "headers.cv") } },
|
||||
li { HeaderLink { url: Route::PublicationsProjects {}, text: translate!(i18, "headers.publications_projects") } },
|
||||
li { HeaderLink { url: Route::Consulting {}, text: translate!(i18, "headers.consulting") } },
|
||||
li { HeaderLink { url: Route::Impressum {}, text: translate!(i18, "headers.about") } },
|
||||
},
|
||||
ul {
|
||||
button { onclick: change_to_english, label { { translate!(i18, "headers.language_buttons.english") } } },
|
||||
button { onclick: change_to_german, label { { translate!(i18, "headers.language_buttons.german") } } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user