diff options
| author | Andreas Grois <andi@grois.info> | 2021-04-19 14:15:00 +0200 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2021-04-19 14:15:00 +0200 |
| commit | f63ef9e9efdbffe8a639df35d72dbfb9bf7979eb (patch) | |
| tree | 52a2dbf8b35ab8e72af3239819971dcb009e1dcc | |
| parent | 0f7140ff8f2c31abb36bce3e6c9110a06abd7dfb (diff) | |
Add local home directory path support for localization.
| -rw-r--r-- | swaystatus/Cargo.toml | 2 | ||||
| -rw-r--r-- | swaystatus/src/main.rs | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/swaystatus/Cargo.toml b/swaystatus/Cargo.toml index 4728f34..ce213ec 100644 --- a/swaystatus/Cargo.toml +++ b/swaystatus/Cargo.toml @@ -9,7 +9,7 @@ description = "Fully modular status bar text updater, similar to i3bar." [dependencies] crossbeam-utils = "0.8" -gettext-rs = "0.6.0" +gettext-rs = { version = "0.6.0", features = ["gettext-system"] } serde = { version = "1.0", features = ["derive"] } erased-serde = "0.3" toml = "0.5" diff --git a/swaystatus/src/main.rs b/swaystatus/src/main.rs index 90d861d..87608a9 100644 --- a/swaystatus/src/main.rs +++ b/swaystatus/src/main.rs @@ -9,12 +9,17 @@ extern crate gettextrs; use gettextrs::*; use crossbeam_utils::thread; use std::sync::mpsc; +use dirs; #[cfg(test)] pub mod test_plugin; fn main() { - if let Err(_e) = TextDomain::new("swaystatus").prepend("target").init() { + let text_domain = match dirs::data_dir() { + Some (p) => TextDomain::new("swaystatus").prepend("target").push(p), + None => TextDomain::new("swaystatus").prepend("target") + }; + if let Err(_e) = text_domain.init() { eprintln!("Localization could not be loaded. Will use English instead."); } let commandline_parameters = commandline::parse_commandline(); |
