i18n-embed

This library contains traits and macros to conveniently embed the output of cargo-i18n into your application binary in order to localize it at runtime.
Currently this library depends on rust-embed to perform the actual embedding of the language files. This may change in the future to make the library more convenient to use.
Optional Features
The i18n-embed crate has the following optional Cargo features:
desktop-requester- Enables a convenience implementation of
LanguageRequestertrait calledDesktopLanguageRequesterfor the desktop platform (windows, mac, linux),which makes use of the locale_config crate for resolving the current system locale.
- Enables a convenience implementation of
web-sys-requester- Enables a convenience implementation of
LanguageRequestertrait calledWebLanguageRequesterwhich makes use of the web-sys crate for resolving the language being requested by the user's web browser in a WASM context.
- Enables a convenience implementation of
Example
The following is an example for how to derive the required traits on structs, and localize your binary using this library:
use ;
use RustEmbed;
// path to the compiled localization resources
;
;
For more examples, see the documentation for i18n-embed.