mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 14:30:10 +01:00
feat: cross-platform locale
This commit is contained in:
parent
d1b59e984d
commit
a12dd77b63
2 changed files with 4 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ include = [
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
colored = "2.0"
|
colored = "2.0"
|
||||||
|
sys-locale = "0.3.2"
|
||||||
rust-i18n = "3"
|
rust-i18n = "3"
|
||||||
regex-lite = "0.1"
|
regex-lite = "0.1"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
use crate::{shell::command_output, style::highlight_difference};
|
use crate::{shell::command_output, style::highlight_difference};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
|
use sys_locale::get_locale;
|
||||||
|
|
||||||
mod args;
|
mod args;
|
||||||
mod files;
|
mod files;
|
||||||
|
|
@ -29,7 +30,8 @@ i18n!("i18n", fallback = "en", minify_key = true);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
colored::control::set_override(true);
|
colored::control::set_override(true);
|
||||||
let locale = std::env::var("LANG").unwrap_or("en_US".to_string());
|
// let locale = std::env::var("LANG").unwrap_or("en_US".to_string());
|
||||||
|
let locale = get_locale().unwrap_or("en_US".to_string());
|
||||||
rust_i18n::set_locale(&locale[0..2]);
|
rust_i18n::set_locale(&locale[0..2]);
|
||||||
|
|
||||||
args::handle_args();
|
args::handle_args();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue