pub struct Loader { /* private fields */ }Expand description
I18n Loader It will load the configuration and i18n json files you can know target and sys language in this struct
Implementations§
Source§impl Loader
impl Loader
Sourcepub fn new(path: Option<&str>) -> Self
pub fn new(path: Option<&str>) -> Self
Build a new Loader with configurations
§params
- path -
Option<&str>: path to load i18n json files (absolute path see following)
§absoulte path
if use absolute path, you should pay attention that the path should write from root
means :
It is an absolute path based on the root directory as the standard
-- your project
|---- src
| |-- main.rs (write Loader::new(Some("./i18n")))
|---- i18n
| |-- en_US.json
| |-- zh_CN.jsonSourcepub fn get_sys_lang() -> I18ns
pub fn get_sys_lang() -> I18ns
get system language from current system
Sourcepub fn get_configuration() -> PathBuf
pub fn get_configuration() -> PathBuf
get configuration and return source dir path
pub fn set_target(&self, target: I18ns)
pub fn target(&self) -> Arc<Mutex<I18ns>>
pub fn sources(&self) -> &Vec<PathBuf>
pub fn sys_lang(&self) -> &I18ns
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Loader
impl RefUnwindSafe for Loader
impl Send for Loader
impl Sync for Loader
impl Unpin for Loader
impl UnwindSafe for Loader
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