use bevy::prelude::*; use bevy_easy_localize::{Localize, LocalizeText}; pub fn main() { App::new() .add_plugins( DefaultPlugins .set(AssetPlugin { file_path: "examples/assets".to_string(), ..Default::default() }) .build(), ) .add_plugins(bevy_easy_localize::LocalizePlugin) .insert_resource(Localize::from_asset_path("test.csv")) .add_systems(Startup, setup) .add_systems(Update, change_language) .run(); } fn setup(mut commands: Commands, asset_server: Res) { commands.spawn(Camera2dBundle::default()); commands.spawn(( TextBundle::from_section( "default value", TextStyle { font: asset_server.load("font.ttf"), font_size: 100.0, color: Color::WHITE, }, ), LocalizeText::from_section("hello"), )); } fn change_language(keyboard: Res>, mut localize: ResMut) { if keyboard.just_pressed(KeyCode::KeyE) { localize.set_language("English"); } if keyboard.just_pressed(KeyCode::KeyG) { localize.set_language("German"); } }