Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: i18n (WIP) #1300

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
329 changes: 310 additions & 19 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repository = "https://github.com/fujiapple852/trippy"
readme = "README.md"
license = "Apache-2.0"
edition = "2021"
rust-version = "1.75"
rust-version = "1.76"
keywords = ["cli", "tui", "traceroute", "ping", "icmp"]
categories = ["command-line-utilities", "network-programming"]

Expand Down Expand Up @@ -61,12 +61,14 @@ petgraph = "0.6.5"
pretty_assertions = "1.4.1"
rand = "0.8.5"
ratatui = "0.28.1"
rust-i18n = "3.1.2"
serde = { version = "1.0.201", default-features = false }
serde_json = { version = "1.0.117", default-features = false }
serde_with = "3.9.0"
serde_yaml = "=0.9.33"
socket2 = "0.5.7"
strum = { version = "0.26.3", default-features = false }
sys-locale = "0.3.1"
test-case = "3.3.1"
thiserror = "1.0.60"
tokio = "1.40.0"
Expand All @@ -76,6 +78,7 @@ tracing = "0.1.40"
tracing-chrome = "0.7.2"
tracing-subscriber = { version = "0.3.18", default-features = false }
tun2 = "2.0.9"
unicode-width = "0.2.0"
widestring = "1.0.2"
windows-sys = "0.52.0"

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.75 as build-env
FROM rust:1.76 as build-env
RUN rustup target add x86_64-unknown-linux-musl
WORKDIR /app
COPY Cargo.toml /app
Expand Down
9 changes: 0 additions & 9 deletions crates/trippy-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ impl PrivilegeMode {
}
}

impl Display for PrivilegeMode {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Self::Privileged => write!(f, "privileged"),
Self::Unprivileged => write!(f, "unprivileged"),
}
}
}

/// The ICMP extension parsing mode.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum IcmpExtensionParseMode {
Expand Down
4 changes: 3 additions & 1 deletion crates/trippy-core/src/net/platform/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,9 @@ mod socket {
// bytes to the `buf`fer, so this casting is safe.
#![allow(unsafe_code)]
fn recv_from_into_buf(&self, buf: &mut [u8]) -> io::Result<(usize, Option<SocketAddr>)> {
let buf = unsafe { &mut *(buf as *mut [u8] as *mut [std::mem::MaybeUninit<u8>]) };
let buf = unsafe {
&mut *(std::ptr::from_mut::<[u8]>(buf) as *mut [std::mem::MaybeUninit<u8>])
};
self.recv_from(buf)
.map(|(size, addr)| (size, addr.as_socket()))
}
Expand Down
3 changes: 3 additions & 0 deletions crates/trippy-tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ itertools.workspace = true
maxminddb.workspace = true
petgraph.workspace = true
ratatui.workspace = true
rust-i18n.workspace = true
serde = { workspace = true, default-features = false, features = [ "derive" ] }
serde_json.workspace = true
serde_with.workspace = true
strum = { workspace = true, default-features = false, features = [ "std", "derive" ] }
sys-locale.workspace = true
thiserror.workspace = true
toml = { workspace = true, default-features = false, features = [ "parse" ] }
tracing-chrome.workspace = true
tracing-subscriber = { workspace = true, default-features = false, features = [ "env-filter", "json" ] }
tracing.workspace = true
unicode-width.workspace = true

[dev-dependencies]
insta = { workspace = true, features = ["serde"] }
Expand Down
2 changes: 2 additions & 0 deletions crates/trippy-tui/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// A no-op build script to trigger a recompilation when the locales change.
fn main() {}
Loading