docsReading time: 2 minutes
General
Basics
- Getting Started
- Game API
- Input API
- Configuration
- Tile Maps
- Resource Management
- Entity Framework
- Control Entities
- User Interface
- utiLITI
- Deployment
- Savegames
- Libraries and Tools
- Glossary
Advanced
- The Particle System
- Dynamic Lighting
- Static Lighting
- Performance Optimization
- Custom MapObjectLoaders
- String Localization
- Object Serialization
- Utility Classes
- Network Communication
- Advanced Entity Knowledge
Tutorials
String Localization
LITIENGINE provides built-in support for string localization, allowing you to create multi-language games.
How Localization Works
- Create properties files for each language (
strings_en.properties,strings_de.properties) - Access strings via
Resources.strings().get("key") - Engine selects appropriate file based on locale
Creating Language Files
Default Language (strings.properties)
game.title=My Game
menu.start=Start Game
menu.settings=Settings
menu.quit=Quit
enemy.goblin=Goblin
item.sword=Iron SwordGerman (strings_de.properties)
game.title=Mein Spiel
menu.start=Spiel starten
menu.settings=Einstellungen
menu.quit=Beenden
enemy.goblin=Goblin
item.sword=EisenschwertLoading Strings
// Get localized string
String title = Resources.strings().get("game.title");
String startText = Resources.strings().get("menu.start");
// Use in UI
Button startButton = new Button(Resources.strings().get("menu.start"));Setting Locale
// Set locale before loading resources
Locale.setDefault(Locale.GERMAN);
// Or configure in code
Resources.strings().setLocale(Locale.FRENCH);Fallback Behavior
If a key is missing in the current locale, the engine falls back to the default strings.properties file.
Best Practices
- Use consistent key naming:
category.subcategory.item - Keep default file complete: All keys should exist in
strings.properties - Don’t concatenate strings: Avoid
"Hello " + name(word order varies by language)
See Also
- Resource Management – Loading resources
- User Interface – Building UIs
Last updated 2 weeks ago
Feedback / Collaborate
