Registry / utility / fluent

fluent

JSON →
library0.17.0rscratesunverified

An umbrella crate exposing the combined features of fluent-rs crates with additional convenience macros for Project Fluent, a localization system designed to unleash the entire expressive power of natural language translations.

# Cargo.toml [dependencies] fluent = "0.17.0"
INSTALL
IMPORT
SIG · FLUENT
F
fluent
utilityrustv0.17.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FluentBundle
✓ use fluent::FluentBundle;

Creates a Fluent bundle, adds a resource, and formats a message.

use fluent::{FluentBundle, FluentResource}; use std::collections::HashMap; fn main() { let ftl_string = "hello-world = Hello, world!".to_owned(); let res = FluentResource::try_new(ftl_string).expect("Failed to parse FTL."); let mut bundle = FluentBundle::new(vec!["en-US"]); bundle.add_resource(res).expect("Failed to add resource."); let msg = bundle.get_message("hello-world").expect("Message not found."); let mut errors = vec![]; let value = bundle.format_pattern(msg.value().unwrap(), None, &mut errors); println!("{}", value); }
Debug
Known issues
gotchaFluentBundle requires a locale; using an empty locale list may cause panics.
fix
Always provide at least one valid locale string (e.g., "en-US") when creating a FluentBundle.
affects: >=0.14.0
Upgrade
Version history
0.17.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
3
Resources
fluent — cargo add fluent · libregistry