Skip to content

Commit

Permalink
Implement MakeWidget for Localize.
Browse files Browse the repository at this point in the history
  • Loading branch information
hydra committed Nov 29, 2024
1 parent 0503968 commit d5d8d3e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/localization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ use std::fmt::{Debug, Formatter};
use std::sync::Arc;
use fluent_bundle::{FluentArgs, FluentBundle, FluentResource, FluentValue};
use unic_langid::LanguageIdentifier;
use cushy::widget::MakeWidget;
use cushy::widgets::Label;
use crate::context::WidgetContext;
use crate::value::{Dynamic, Generation, IntoValue, Value};
use crate::widget::WidgetInstance;
use crate::widgets::label::{DynamicDisplay};

/// The primary of defining localized message
Expand Down Expand Up @@ -190,4 +192,10 @@ impl TranslationState {
);
self.fallback_locale = (**languages.first().unwrap()).clone();
}
}

impl MakeWidget for Localize<'static> {
fn make_widget(self) -> WidgetInstance {
self.into_label().make_widget()
}
}

0 comments on commit d5d8d3e

Please sign in to comment.