Overview
Stringboot makes multi-language support effortless with automatic language detection, smooth language switching, and AI-powered translations from the dashboard. Support global users without complex i18n libraries or language file management.Key Benefits
Auto-Detection
Automatically detects and uses device locale
Instant Switching
Change language without app restart
AI Translations
Generate translations from dashboard with one click
Offline Support
All languages cached locally for offline use
Quick Start
1. Add Languages in Dashboard
Go to Stringboot Dashboard → Languages → Add Language:- Select application
- Choose language (e.g., Spanish -
es) - Enable AI Translation (optional)
- Click Save
2. Use Device Locale
The SDK automatically uses the device’s language:App.kt
3. Display Content
Strings automatically load in the user’s language:Language Detection
Auto-Detect Device Locale
- Uses Android’s
Locale.getDefault().language - Returns ISO 639-1 language code (e.g., “en”, “es”, “fr”)
- Falls back to “en” if device locale not supported
Check Supported Languages
Fallback to Supported Language
Language Switching
Complete Language Switch Flow
MainActivity.kt
- Set locale:
StringProvider.setLocale(newLang) - Preload cache: Avoids UI flashing
- Refresh from network: Get latest translations (non-blocking)
- Update UI: Re-apply tags and restart Flows
- Save preference: Remember user’s choice
Language Picker UI
Show Language Selection Dialog
Language Picker Button
Display Current Language
Show Active Language Name
- English: “Current language: English”
- Spanish: “Idioma actual: Español”
- French: “Langue actuelle: Français”
Persisting Language Preference
Save on Language Change
Load on App Start
Advanced Patterns
Language-Specific Formatting
Different languages have different formatting rules for numbers, dates, and currencies.- English (US): “Price: $29.99”
- Spanish (ES): “Precio: 29,99 €”
- French (FR): “Prix : 29,99 €“
RTL Language Support
Automatically detect and apply RTL layout for Arabic, Hebrew, etc.Pluralization Rules
Handle plurals correctly for different languages. Dashboard Strings:Testing Translations
Preview Different Languages
Test Missing Translations
Best Practices
Always Persist Language Preference
Always Persist Language Preference
Recommended:Users expect their language choice to persist across app sessions.
Preload Before Switching
Preload Before Switching
Recommended:Avoid:Preloading eliminates visual glitches during language switching.
Handle Missing Translations Gracefully
Handle Missing Translations Gracefully
Recommended:If a translation is missing, fall back to English (or another default language).
Sync After Language Switch
Sync After Language Switch
Test All Supported Languages
Test All Supported Languages
Create a debug menu to quickly switch languages:
Common Use Cases
App-Wide Language Switcher
In-App Language Settings Screen
SettingsActivity.kt
Next Steps
Dynamic Strings
Learn about string retrieval and updates
A/B Testing
Optimize messaging with experiments
Best Practices
Production patterns and optimization
API Reference
Language Methods
| Method | Description | Returns |
|---|---|---|
deviceLocale() | Get device’s current language code | String |
setLocale(lang) | Set active language for string retrieval | Unit |
getAvailableLanguages() | Get cached language codes | List<String> |
getAvailableLanguagesFromServer() | Get languages from server | List<ActiveLanguage> |
preloadLanguage(lang, maxStrings?) | Preload language into cache | Unit |
refreshFromNetwork(lang) | Sync language from server | Boolean |
Troubleshooting
Language doesn't switch
Language doesn't switch
Check:
- Did you call
StringProvider.setLocale(newLang)? - Did you re-apply tags with
binding.root.applyStringbootTags()? - Did you restart Flow observations?
UI shows ??keys?? briefly when switching
UI shows ??keys?? briefly when switching
Cause: Cache not preloaded before UI update.Solution:
Translations not showing for a language
Translations not showing for a language
Check:Sync manually:
- Language added in Stringboot Dashboard?
- Strings translated for that language?
- Network sync successful?
Device locale detection not working
Device locale detection not working
Check:Fallback: