pub struct DynamicCatalog { /* private fields */ }Expand description
面向桌面、移动端与 Web 的运行时动态翻译目录(支持运行时热加载 key = value 与扁平 JSON 语言包,零外部 serde 依赖)。
Implementations§
Source§impl DynamicCatalog
impl DynamicCatalog
Sourcepub fn merge_static(&mut self, catalog: &StaticCatalog)
pub fn merge_static(&mut self, catalog: &StaticCatalog)
合并一份编译期 StaticCatalog 至动态目录(便于在此基础上做热覆盖)。
Sourcepub fn insert(
&mut self,
locale: Locale,
key: impl Into<String>,
value: impl Into<String>,
)
pub fn insert( &mut self, locale: Locale, key: impl Into<String>, value: impl Into<String>, )
插入或覆盖一条翻译记录。
Sourcepub fn load_kv(&mut self, locale: Locale, content: &str) -> usize
pub fn load_kv(&mut self, locale: Locale, content: &str) -> usize
加载轻量 key = value(Fluent/Properties 风格,忽略 # / // 注释行)语言包文本,返回成功导入的条目数。
Trait Implementations§
Source§impl Clone for DynamicCatalog
impl Clone for DynamicCatalog
Source§impl Debug for DynamicCatalog
impl Debug for DynamicCatalog
Auto Trait Implementations§
impl Forget for DynamicCatalog
impl Freeze for DynamicCatalog
impl Move for DynamicCatalog
impl RefUnwindSafe for DynamicCatalog
impl Send for DynamicCatalog
impl Sync for DynamicCatalog
impl Unpin for DynamicCatalog
impl UnsafeUnpin for DynamicCatalog
impl UnwindSafe for DynamicCatalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。