Crates.io | egui-i18n |
lib.rs | egui-i18n |
version | 0.1.2 |
created_at | 2025-06-07 15:51:26.990778+00 |
updated_at | 2025-06-07 16:07:54.28117+00 |
description | egui i18n |
homepage | https://github.com/fewensa/egui-i18n |
repository | https://github.com/fewensa/egui-i18n |
max_upload_size | |
id | 1704171 |
size | 23,436 |
egui-i18n
is an internationalization (i18n) solution designed specifically for the egui framework. It supports both Fluent syntax and traditional key-value translation formats. With flexible resource loading, dynamic parameter interpolation, and performance optimizations, it helps developers easily implement multi-language support in their applications.
egui-i18n
originated from a proposal to add i18n support in the official egui
repository. Since egui
does not currently include a built-in i18n system, this project was developed independently to fulfill real-world needs without modifying egui
's core. The goals include:
.ftl
(Fluent) or .properties
(key-value) files from specified file paths.zh-HK
to zh
).Add the dependency in your Cargo.toml
:
[dependencies]
egui-i18n = "0.1"
[dependencies]
egui-i18n = { version = "0.1", features = ["fluent"] }
use egui_i18n::tr;
fn main() {
let greeting = tr!("greeting", { name: "Alice" });
println!("{}", greeting); // Output: Hello, Alice!
}
Fluent resource file example (en-US.ftl
):
greeting = Hello, { $name }!
use egui_i18n::tr;
fn main() {
let greeting = tr!("classic_greeting");
println!("{}", greeting); // Output: Hello, world!
}
Classic key-value resource example:
classic_greeting = Hello, world!
fluent
: Enables Fluent translation mode.classic
: Enables classic key-value translation mode (enabled by default).This project is open source under the MIT License. Contributions and feedback are welcome!
For more examples, API documentation, or integration guides, check the project source code and the examples
directory. If you encounter any issues or have suggestions, feel free to open an issue or submit a PR!