Skip to content

Latest commit

 

History

History
90 lines (65 loc) · 3.03 KB

en-US.md

File metadata and controls

90 lines (65 loc) · 3.03 KB

Documentation

🔼 | English 🇺🇸 | Русский 🇷🇺

Use

Load asset using AssetServer:

let handle = asset_server.load("locales/en-US/main.ftl.ron");

Load all assets matching the glob using AssetServerExt:

use bevy_fluent::exts::bevy::AssetServerExt;

let handles = asset_server.load_glob("locales/**/main.ftl.ron")?;

Check assets load state:

if let LoadState::Loaded =  asset_server.get_load_state(handle) {
    ...
}

Check assets load state:

if let LoadState::Loaded = asset_server.get_group_load_state(handles) {
    ...
}

Create a bundle fallback chain based on the locale fallback chain using LocalizationBuilder:

let localization = localization_builder.build(handles);

Request content:

let hello_world = bundle_asset.content("hello-world")?;
let hello_world = localization.content("hello-world")?;

Definitions

Localization is a Fluent bundle fallback chain.

Bundle asset - is an abstraction for presentation Fluent bundles. Each bundle asset file has the extension .ftl.ron.

Resource asset - is an abstraction for presentation Fluent resources. Each resource asset file has the extension .ftl. Resource asset is the atomic unit of disk storage for Fluent.

Each resource asset is a set of messages. Message is the basic atomic translation unit for Fluent.

Each message has an identifier.

Messages (and terms, variants, attributes) store their values as patterns.

Formated pattern are called content.

Request is a request to receive content specified by the parameters.