feat(i18n): add internationalization with DE, FR, ES, PT translations (#12)
Add a compile-time i18n system with 270 translation keys across 5 locales (EN, DE, FR, ES, PT). Translations are embedded via include_str! and parsed lazily into flat HashMaps with English fallback for missing keys. - Add src/i18n module with Locale enum, t()/tw() lookup functions, and tests - Add JSON translation files for all 5 locales under assets/i18n/ - Provide locale Signal via Dioxus context in App, persisted to localStorage - Replace all hardcoded UI strings across 33 component/page files - Add compact locale picker (globe icon + ISO alpha-2 code) in sidebar header - Add click-outside backdrop dismissal for locale dropdown Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Sharang Parnerkar <parnerkarsharang@gmail.com> Reviewed-on: #12
This commit was merged in pull request #12.
This commit is contained in:
@@ -2,6 +2,7 @@ use dioxus::prelude::*;
|
||||
use dioxus_free_icons::icons::bs_icons::BsShieldCheck;
|
||||
use dioxus_free_icons::Icon;
|
||||
|
||||
use crate::i18n::{t, Locale};
|
||||
use crate::Route;
|
||||
|
||||
/// Impressum (legal notice) page required by German/EU law.
|
||||
@@ -10,6 +11,9 @@ use crate::Route;
|
||||
/// accessible without authentication.
|
||||
#[component]
|
||||
pub fn ImpressumPage() -> Element {
|
||||
let locale = use_context::<Signal<Locale>>();
|
||||
let l = *locale.read();
|
||||
|
||||
rsx! {
|
||||
div { class: "legal-page",
|
||||
nav { class: "legal-nav",
|
||||
@@ -21,53 +25,53 @@ pub fn ImpressumPage() -> Element {
|
||||
}
|
||||
}
|
||||
main { class: "legal-content",
|
||||
h1 { "Impressum" }
|
||||
h1 { "{t(l, \"impressum.title\")}" }
|
||||
|
||||
h2 { "Information according to 5 TMG" }
|
||||
h2 { "{t(l, \"impressum.info_tmg\")}" }
|
||||
p {
|
||||
"CERTifAI GmbH"
|
||||
"{t(l, \"impressum.company\")}"
|
||||
br {}
|
||||
"Musterstrasse 1"
|
||||
"{t(l, \"impressum.address_street\")}"
|
||||
br {}
|
||||
"10115 Berlin"
|
||||
"{t(l, \"impressum.address_city\")}"
|
||||
br {}
|
||||
"Germany"
|
||||
"{t(l, \"impressum.address_country\")}"
|
||||
}
|
||||
|
||||
h2 { "Represented by" }
|
||||
p { "Managing Director: [Name]" }
|
||||
h2 { "{t(l, \"impressum.represented_by\")}" }
|
||||
p { "{t(l, \"impressum.managing_director\")}" }
|
||||
|
||||
h2 { "Contact" }
|
||||
h2 { "{t(l, \"impressum.contact\")}" }
|
||||
p {
|
||||
"Email: info@certifai.example"
|
||||
"{t(l, \"impressum.email\")}"
|
||||
br {}
|
||||
"Phone: +49 (0) 30 1234567"
|
||||
"{t(l, \"impressum.phone\")}"
|
||||
}
|
||||
|
||||
h2 { "Commercial Register" }
|
||||
h2 { "{t(l, \"impressum.commercial_register\")}" }
|
||||
p {
|
||||
"Registered at: Amtsgericht Berlin-Charlottenburg"
|
||||
"{t(l, \"impressum.registered_at\")}"
|
||||
br {}
|
||||
"Registration number: HRB XXXXXX"
|
||||
"{t(l, \"impressum.registration_number\")}"
|
||||
}
|
||||
|
||||
h2 { "VAT ID" }
|
||||
p { "VAT identification number according to 27a UStG: DE XXXXXXXXX" }
|
||||
h2 { "{t(l, \"impressum.vat_id\")}" }
|
||||
p { "{t(l, \"impressum.vat_number\")}" }
|
||||
|
||||
h2 { "Responsible for content according to 55 Abs. 2 RStV" }
|
||||
h2 { "{t(l, \"impressum.responsible_content\")}" }
|
||||
p {
|
||||
"[Name]"
|
||||
br {}
|
||||
"CERTifAI GmbH"
|
||||
"{t(l, \"impressum.company\")}"
|
||||
br {}
|
||||
"Musterstrasse 1"
|
||||
"{t(l, \"impressum.address_street\")}"
|
||||
br {}
|
||||
"10115 Berlin"
|
||||
"{t(l, \"impressum.address_city\")}"
|
||||
}
|
||||
}
|
||||
footer { class: "legal-footer",
|
||||
Link { to: Route::LandingPage {}, "Back to Home" }
|
||||
Link { to: Route::PrivacyPage {}, "Privacy Policy" }
|
||||
Link { to: Route::LandingPage {}, "{t(l, \"common.back_to_home\")}" }
|
||||
Link { to: Route::PrivacyPage {}, "{t(l, \"common.privacy_policy\")}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user