Skip to content

Commit 908dfc5

Browse files
committed
add gettext module
1 parent 9ad5501 commit 908dfc5

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

Cargo.lock

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ path = "bin/visudo.rs"
3232
[dependencies]
3333
libc = "0.2.152"
3434
glob = "0.3.0"
35+
gettext-sys = { version = ">=0.21.3", features = ["gettext-system"], optional = true }
3536

3637
[features]
3738
default = []
@@ -44,6 +45,9 @@ pam-login = []
4445
# this enables enforcing of AppArmor profiles
4546
apparmor = []
4647

48+
# whether to enable 'gettext' support for giving localized user-facing messages
49+
gettext = ["dep:gettext-sys"]
50+
4751
# enable detailed logging (use for development only) to /tmp
4852
# this will compromise the security of sudo-rs somewhat
4953
dev = []

src/cutils/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ use std::{
66
},
77
};
88

9+
#[cfg(feature = "gettext")]
10+
pub mod gettext;
11+
912
pub fn cerr<Int: Copy + TryInto<libc::c_long>>(res: Int) -> std::io::Result<Int> {
1013
match res.try_into() {
1114
Ok(-1) => Err(std::io::Error::last_os_error()),

0 commit comments

Comments
 (0)