FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    TranslationBindingSource

    struct · ferroui-protranslate · v0.5.0

    struct TranslationBindingSource
    

    A replaceable translation service shared by native bindings and attached targets.

    Cloning shares the source, while set_service atomically replaces its service and refreshes existing bindings. The source owns no UI target, and subscription handles unsubscribe both on disposal and on drop.

    View source

    Members

    new

    fn new(service: TranslationService) -> Self
    

    Source

    service

    fn service(self: &Self) -> TranslationService
    

    Source

    set_service

    fn set_service(self: &Self, service: TranslationService)
    

    Source

    culture

    fn culture(self: &Self) -> Culture
    

    Culture used to select resources and resolve text direction.

    Source

    formatting_culture

    fn formatting_culture(self: &Self) -> Culture
    

    Culture used for numeric, date and measurement formatting.

    Source

    set_culture

    fn set_culture(self: &Self, culture: Culture) -> bool
    

    Source

    set_cultures

    fn set_cultures(self: &Self, culture: Culture, ui_culture: Culture) -> bool
    

    Source

    translate

    fn translate(self: &Self, key: &str, arguments: &[FormatArgument]) -> Result<String, TranslationError>
    

    Direct translation preserves the core missing-key and formatting policies.

    Source

    get_value

    fn get_value(self: &Self, key: &str) -> Result<Option<BoxedValue>, TranslationError>
    

    The native binding indexer yields UnsetValue for a missing resource so the binding engine can apply its fallback or the target property's default.

    Source

    is_disposed

    fn is_disposed(self: &Self) -> bool
    

    Source

    dispose

    fn dispose(self: &Self)
    

    Disconnects this source from its service. Dropping its final clone also releases the service subscription without requiring explicit disposal.

    Source

    refresh

    fn refresh(self: &Self)
    

    Explicitly re-evaluates consumers after application-owned catalog updates.

    Source

    subscriber_count

    fn subscriber_count(self: &Self) -> usize
    

    Number of live native consumers, useful for lifecycle diagnostics.

    Source

    subscribe

    fn subscribe(self: &Self, handler: impl Fn() -> () + 'static) -> Rc<dyn IDisposable>
    

    Observes refreshes. A subscription never retains its source.

    Source

    observe

    fn observe(self: &Self, key: impl Into<String>, arguments: Vec<FormatArgument>) -> Rc<dyn IObservable<String>>
    

    A native observable suitable for FerroUI's typed property bindings.

    Source

    default_source

    fn default_source() -> Self
    

    The explicitly configured, UI-thread-local default source. Initially an empty catalog using the framework's current UI culture.

    Source

    use_default_source

    fn use_default_source(source: Self)
    

    Replaces the ambient source and reconnects existing unscoped consumers. Independently scoped users of the old source keep their own source alive.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.