FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    TranslationService

    struct · ferroui-protranslate-core · v0.5.0

    struct TranslationService
    

    View source

    Members

    new

    fn new(provider: Rc<dyn TranslationProvider>, cultures: CultureService) -> Self
    

    Source

    with_options

    fn with_options(provider: Rc<dyn TranslationProvider>, cultures: CultureService, options: TranslationFallbackOptions, cache_options: TranslationCacheOptions) -> Self
    

    Source

    cultures

    fn cultures(self: &Self) -> CultureService
    

    Source

    current_culture

    fn current_culture(self: &Self) -> Culture
    

    Source

    current_ui_culture

    fn current_ui_culture(self: &Self) -> Culture
    

    Source

    options

    fn options(self: &Self) -> TranslationFallbackOptions
    

    Source

    set_options

    fn set_options(self: &Self, options: TranslationFallbackOptions)
    

    Source

    set_cache_options

    fn set_cache_options(self: &Self, options: TranslationCacheOptions)
    

    Source

    set_diagnostic_sink

    fn set_diagnostic_sink(self: &Self, sink: Option<Rc<dyn ProTranslateDiagnosticSink>>)
    

    Source

    subscribe

    fn subscribe(self: &Self, callback: impl Fn(&CultureChangedEventArgs) -> () + 'static) -> Subscription
    

    Source

    subscribe_diagnostics

    fn subscribe_diagnostics(self: &Self, callback: impl Fn(&ProTranslateDiagnostic) -> () + 'static) -> Subscription
    

    Source

    subscriber_count

    fn subscriber_count(self: &Self) -> usize
    

    Source

    clear_cache

    fn clear_cache(self: &Self)
    

    Source

    refresh

    fn refresh(self: &Self)
    

    Explicitly announces mutable provider data or changed configuration. This also refreshes observable translations without changing culture.

    Source

    cached_lookup_count

    fn cached_lookup_count(self: &Self) -> usize
    

    Source

    remove_cached_string

    fn remove_cached_string(self: &Self, key: &str, culture: &Culture) -> bool
    

    Source

    fallback_cultures

    fn fallback_cultures(self: &Self, culture: &Culture) -> Vec<Culture>
    

    Source

    get_string

    fn get_string(self: &Self, key: &str) -> Result<LocalizedString, TranslationError>
    

    Source

    get_string_for

    fn get_string_for(self: &Self, key: &str, culture: &Culture) -> Result<LocalizedString, TranslationError>
    

    Source

    format

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

    Source

    format_for

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

    Source

    format_localized

    fn format_localized(self: &Self, localized: LocalizedString, arguments: &[FormatArgument], culture: &Culture) -> Result<String, TranslationError>
    

    Source

    format_value

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

    Format an adapter-provided fallback or outer format with the configured failure policy and diagnostic sink.

    Source

    observe

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

    Source

    try_observe

    fn try_observe(self: &Self, key: impl Into<String>, arguments: Vec<FormatArgument>) -> Result<ObservableLocalizedString, TranslationError>
    

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone

    Availability

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