♻️ Major code restructuring

This commit is contained in:
Manuel Cillero 2024-02-09 14:05:38 +01:00
parent a96e203bb3
commit fa66d628a0
221 changed files with 228 additions and 315 deletions

View file

@ -0,0 +1,35 @@
use crate::prelude::*;
use crate::BaseHandle;
#[derive(BaseHandle, SmartDefault)]
pub struct Translate(L10n);
impl ComponentTrait for Translate {
fn new() -> Self {
Translate::default()
}
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
PrepareMarkup::With(self.l10n().escaped(cx.langid()))
}
}
impl Translate {
pub fn with(l10n: L10n) -> Self {
Translate(l10n)
}
// Translate BUILDER.
#[fn_with]
pub fn alter_l10n(&mut self, l10n: L10n) -> &mut Self {
self.0 = l10n;
self
}
// Translate GETTERS.
pub fn l10n(&self) -> &L10n {
&self.0
}
}