bevy_easy_localize

Crates.io

A simple crate to localize your game using .csv files.

Features

The .csv file currently must be arranged in this order:

|Keyword|Comments|Language0|Language1|...| |---|---|---|---|---| |word|comment|translation0|translation1|...|

image

In your project: rust use bevy::prelude::*; use bevy_easy_localize::Localize; pub fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugin(bevy_easy_localize::LocalizePlugin) //Insert the resource from an asset path .insert_resource(Localize::from_asset_path("translations.csv")) .add_system(translate) .run(); } fn translate( keyboard:Res<Input<KeyCode>>, mut localize:ResMut<Localize>, ){ //Easily set the language localize.set_language("German"); if keyboard.just_pressed(KeyCode::Space){ //Use the get() method to get a translated word for the specified keyword println!("{}",localize.get("start_game")); } } Using the LocalizeText component: rust commands.spawn(( TextBundle::from_section( "default value", TextStyle { font: asset_server.load("font.ttf"), font_size: 100.0, color: Color::WHITE, }, ), //add this component to automatically translate text LocalizeText::from_section("my_keyword") ));

Examples

|bevy|bevyeasylocalize| |---|---| |0.10|0.2| |0.9|0.1|

About

I made this crate for my personal projects. The obvious alternative is bevy_fluent, but my goal is to just translate some text and I don't need all of the fancy features it offers. I will definitely be updating this crate and if you want to add a feature, please submit a pull request.