Skip to content

Commit 1f69ad1

Browse files
committed
sh: use gettext-rs
1 parent 219adc0 commit 1f69ad1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sh/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ use crate::signals::setup_signal_handling;
1515
use crate::utils::is_process_in_foreground;
1616
use cli::terminal::read_nonblocking_char;
1717
use cli::vi::{Action, ViEditor};
18+
use gettextrs::{bind_textdomain_codeset, setlocale, textdomain, LocaleCategory};
1819
use nix::sys::signal::{sigaction, SaFlags, SigAction, SigSet};
1920
use nix::sys::signal::{SigHandler, Signal as NixSignal};
21+
use std::error::Error;
2022
use std::io;
2123
use std::io::Write;
2224
use std::os::fd::AsFd;
@@ -239,7 +241,11 @@ fn interactive_shell(shell: &mut Shell) {
239241
}
240242
}
241243

242-
fn main() {
244+
fn main() -> Result<(), Box<dyn Error>> {
245+
setlocale(LocaleCategory::LcAll, "");
246+
textdomain("posixutils-rs")?;
247+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
248+
243249
let args = parse_args(std::env::args().collect(), is_attached_to_terminal()).unwrap();
244250
let mut shell = Shell::initialize_from_system(
245251
args.program_name,

0 commit comments

Comments
 (0)