TranslationService
struct · ferroui-protranslate-core · v0.5.0
struct TranslationService
Members
newwith_optionsculturescurrent_culturecurrent_ui_cultureoptionsset_optionsset_cache_optionsset_diagnostic_sinksubscribesubscribe_diagnosticssubscriber_countclear_cacherefreshcached_lookup_countremove_cached_stringfallback_culturesget_stringget_string_forformatformat_forformat_localizedformat_valueobservetry_observe
new
fn new(provider: Rc<dyn TranslationProvider>, cultures: CultureService) -> Self
with_options
fn with_options(provider: Rc<dyn TranslationProvider>, cultures: CultureService, options: TranslationFallbackOptions, cache_options: TranslationCacheOptions) -> Self
cultures
fn cultures(self: &Self) -> CultureService
current_culture
fn current_culture(self: &Self) -> Culture
current_ui_culture
fn current_ui_culture(self: &Self) -> Culture
options
fn options(self: &Self) -> TranslationFallbackOptions
set_options
fn set_options(self: &Self, options: TranslationFallbackOptions)
set_cache_options
fn set_cache_options(self: &Self, options: TranslationCacheOptions)
set_diagnostic_sink
fn set_diagnostic_sink(self: &Self, sink: Option<Rc<dyn ProTranslateDiagnosticSink>>)
subscribe
fn subscribe(self: &Self, callback: impl Fn(&CultureChangedEventArgs) -> () + 'static) -> Subscription
subscribe_diagnostics
fn subscribe_diagnostics(self: &Self, callback: impl Fn(&ProTranslateDiagnostic) -> () + 'static) -> Subscription
subscriber_count
fn subscriber_count(self: &Self) -> usize
clear_cache
fn clear_cache(self: &Self)
refresh
fn refresh(self: &Self)
Explicitly announces mutable provider data or changed configuration. This also refreshes observable translations without changing culture.
cached_lookup_count
fn cached_lookup_count(self: &Self) -> usize
remove_cached_string
fn remove_cached_string(self: &Self, key: &str, culture: &Culture) -> bool
fallback_cultures
fn fallback_cultures(self: &Self, culture: &Culture) -> Vec<Culture>
get_string
fn get_string(self: &Self, key: &str) -> Result<LocalizedString, TranslationError>
get_string_for
fn get_string_for(self: &Self, key: &str, culture: &Culture) -> Result<LocalizedString, TranslationError>
format
fn format(self: &Self, key: &str, arguments: &[FormatArgument]) -> Result<String, TranslationError>
format_for
fn format_for(self: &Self, key: &str, arguments: &[FormatArgument], culture: &Culture) -> Result<String, TranslationError>
format_localized
fn format_localized(self: &Self, localized: LocalizedString, arguments: &[FormatArgument], culture: &Culture) -> Result<String, TranslationError>
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.
observe
fn observe(self: &Self, key: impl Into<String>, arguments: Vec<FormatArgument>) -> ObservableLocalizedString
try_observe
fn try_observe(self: &Self, key: impl Into<String>, arguments: Vec<FormatArgument>) -> Result<ObservableLocalizedString, TranslationError>
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherClone
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.