π£οΈ Multi-Language Support
Adding New Languages
Step 1: Configure Language Entry
- Navigate to
/config/config.locales.lua - Add a new entry to the
Config.Localesarray:
luaConfig.Locales = { { value = "en", label = "English" }, { value = "es", label = "EspaΓ±ol" }, { value = "fr", label = "FranΓ§ais" }, -- Add your new language here { value = "de", label = "Deutsch" } }
Step 2: Create Language File
- Navigate to
/ui/build/locales/ - Create a new JSON file named exactly the same as the
valuefield from Step 1 - Example: For German, create
de.json
Step 3: Restart Server
Restart the server to apply the language changes.
Language File Structure
Basic Structure
Language files should follow this JSON structure:
json{ "common": { "save": "Save", "cancel": "Cancel", "delete": "Delete", "edit": "Edit", "add": "Add", "close": "Close", "ok": "OK" }, "apps": { "phone": "Phone", "messages": "Messages", "contacts": "Contacts", "settings": "Settings", "camera": "Camera", "gallery": "Gallery" }, "settings": { "general": "General", "display": "Display", "sounds": "Sounds", "privacy": "Privacy" } }
Language Selection
User Language Selection
Players can typically change their language through:
- Settings App: Navigate to Settings -> Language
- Initial Setup: Language selection during first phone setup
Server Default Language
Configure the default server language in config/config.locales.lua:
luaConfig.DefaultLocale = "en" -- Set default language
Advanced Features
Dynamic Language Loading
The system supports dynamic language loading, meaning:
- Languages can be switched without restart
- New translations take effect immediately
- Fallback to default language for missing translations
Translation Fallbacks
If a translation is missing:
- System checks current language file
- Falls back to default language (usually English)
- Shows translation key if no fallback exists
Regional Variants
Support for regional language variants:
luaConfig.Locales = { { value = "en_US", label = "English (US)" }, { value = "en_GB", label = "English (UK)" }, { value = "fr_FR", label = "FranΓ§ais (France)" }, { value = "fr_CA", label = "FranΓ§ais (Canada)" } }
Troubleshooting
Common Issues
- Translations not appearing:
- Check file naming matches
valuefield exactly - Verify JSON syntax is valid
- Ensure server restart was completed
- Check file naming matches
- Partial translations:
- Check for missing translation keys
- Verify JSON structure is complete
- Test fallback language functionality
- Language selection not working:
- Verify locale configuration is correct
- Check player language preference storage
- Test with different language options
Debug Steps
- File Validation: Use JSON validators for syntax checking
- Console Logs: Check for language loading errors
- UI Testing: Test interface with different languages
- Player Testing: Have players test language switching