Added en-GB and de-DE

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2024-05-21 16:39:11 +02:00
parent 4b56557d15
commit 6ca89b3bd5
16 changed files with 594 additions and 277 deletions

View File

@@ -1,25 +1,28 @@
use dioxus::prelude::*;
use dioxus_sdk::{i18n::use_i18, translate};
use crate::components::H1;
pub fn Footer() -> Element {
let i18 = use_i18();
rsx! {
div {
// ToolsUsed {},
footer {
class:"bg-white rounded-lg shadow dark:bg-gray-800 my-4:wa mb-4",
class:"bg-white rounded-lg shadow dark:bg-gray-800",
div {
class:"w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-between",
class:"w-full mx-auto p-4 flex items-center justify-between",
span {
class:"text-sm text-gray-500 sm:text-center dark:text-gray-400",
"© 2024 ",
a { href: "#", class: "hover:underline", "Tuan-Dat Tran"},
". All Rights Reserved."
{ translate!(i18, "footer.year") },
a { href: "#", class: "hover:underline", { translate!(i18, "footer.name") }},
{ translate!(i18, "footer.rights") }
}
ul {
class:"flex flex-wrap items-center mt-3 text-sm font-medium text-gray-500 dark:text-gray-400 sm:mt-0",
li {
Link { to:"mailto:tuan-dat.tran@tudattr.dev", class:"hover:underline", "Contact" }
Link { to:"mailto:tuan-dat.tran@tudattr.dev", class:"hover:underline", { translate!(i18, "footer.contact") } }
},
}
}

View File

@@ -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") } } }
}
}
}

View File

@@ -10,7 +10,7 @@ use header::Header;
pub fn Layout() -> Element {
rsx! {
div {
class: "flex justify-center",
class: "flex justify-center ",
div {
class: "max-w-screen-xl flex-col" ,
Header {},