Tiny doc update

Tiny doc update
This commit is contained in:
Alexander I. Chebykin 2022-11-12 19:40:13 +03:00
parent 011e79e676
commit 82f1c744dc
3 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,6 @@
//! CAI-Watchdog is a lightweigth watchdog for *nix and Windows
//! Author: Alexander I. Chebykin (CAI) <alex.chebykin@gmail.com>
#[macro_use]
extern crate ini;
extern crate exitcode;

View File

@ -1,3 +1,6 @@
//! CAI-Watchdog filesystem module
//! Author: Alexander I. Chebykin (CAI) <alex.chebykin@gmail.com>
use std::env;
use std::path::PathBuf;

View File

@ -1,3 +1,8 @@
//! CAI-Watchdog localization module
//! Author: Alexander I. Chebykin (CAI) <alex.chebykin@gmail.com>
//!
//! External localizations stored in /locales/ directory
use std::borrow::Borrow;
use std::path::Path;
@ -162,6 +167,18 @@ impl Locale {
}
}
/// Return object with locale data
///
/// If there is no localization file for current system locale, fallback (English) locale will be returned
///
/// # Example
///
/// ```
/// let locale = mod_locales::Locale::new();
///
/// println!("\u{26a0} {}! {}.", locale.t().error, locale.t().cant_find_config_file);
/// println!("{}", locale.t().exiting);
/// ```
pub fn t(&self) -> &Lang {
return self.locale.borrow().clone();
}