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

Replace rust-i18n with phf string maps and simple replaces #1428

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nc7s
Copy link
Contributor

@nc7s nc7s commented Dec 13, 2024

Alternative to #1426 for comparison. Strings are now &'static str as phf::Map entries, placeholder substitution is simply str::replace, no complex logic. Executable size is down 1MB (!).

Downsides are 1. build.rs, 2. str::replace is not enough for complex translations.

Currently both the $kt:ident = $kt:expr and $kt:literal => $kv:expr forms of t! are still supported, but I doubt if they really differ.

@nc7s
Copy link
Contributor Author

nc7s commented Dec 13, 2024

Failure of the build-docker job seems to be a result of the way Dockerfile is written. The "caching" somehow resulted in build.rs being skipped.

@fujiapple852
Copy link
Owner

@nc7s I pushed a commit which fixes the Dockerfile. I've not had time to review the rest of this yet, I will over the weekend.

@fujiapple852
Copy link
Owner

fujiapple852 commented Dec 13, 2024

aside: I think this may be broken on master as well, as the locales directory is not copied into the docker image.

edit: yes, broken:

$ docker run -it fujiapple/trippy 1.1.1.1 --print-locales
TUI locales:

bug: #1431

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants