bevy_locales

Crates.iobevy_locales
lib.rsbevy_locales
version0.1.0
created_at2025-11-24 17:16:31.041356+00
updated_at2025-11-24 17:16:31.041356+00
descriptionA Simple i18n for bevy
homepage
repository
max_upload_size
id1948211
size100,096
kautism (darkautism)

documentation

README

bevy_locale

This project is a wrapper around bevy_fluent, designed to simplify localization in Bevy applications.

Usage

Cargo.toml

[dependencies]
bevy_locale = "0.1.0"

main.rs

app
    .insert_resource(Locale::new(zh::TW).with_default(zh::TW))
    .add_plugins(bevy_locales::I18nPlugin {
        filepath: vec!["locales/zhtw/zhtw.ftl.ron".to_string()],
    });

// ...

locales/zhtw/zhtw.ftl.ron

Your .ron file should look like this:

(
    locale: "zh-TW",
    resources: [
        "card.ftl",
    ]
)

If you support multiple languages, simply create additional .ftl.ron files for each locale.

Fluent Files

The .ftl files follow the standard Fluent syntax, allowing for variables and advanced localization features.

UI Integration

To localize UI elements, use the I18n component like this:

command.spawn((
    Node,
    Text::new(txt.clone()),
    I18n("txtkey"),
));

The system will automatically replace the text with the appropriate translation based on the current locale.

✅ Compatibility

Bevy bevy_locales
0.16.0 0.1.0
Commit count: 0

cargo fmt