Skip to content

Localization Architecture (i18n)

Localization Architecture (i18n)

PLANOVI is engineered with multi-language support from the ground up, featuring full translation sets for:

  • 🇵🇱 Polish (pl_PL): Primary default locale for cooperative and legal operations.
  • 🇺🇸 English (en_US): Secondary locale for international members and multi-national teams.

Localization Framework

The project utilizes GetX’s translation engine encapsulated within LocalString:


Adding New Translation Keys

When adding UI text, never hardcode strings into widgets. Follow these steps:

1. Declare the key in strings.dart

class AppString {
// ...
static const String lblBatteryLevel = 'lblBatteryLevel';
}

2. Add translations to both language dictionaries in local_string.dart

class LocalString extends Translations {
@override
Map<String, Map<String, String>> get keys => {
'pl_PL': {
// ...
AppString.lblBatteryLevel: 'Poziom naładowania baterii',
},
'en_US': {
// ...
AppString.lblBatteryLevel: 'Battery Charge Level',
},
};
}

3. Consume in Widgets

Text(
AppString.lblBatteryLevel.tr,
style: Theme.of(context).textTheme.bodyMedium,
)

Dynamic Language Switching

Users can switch languages on the fly from the user settings menu or top bar:

final languageService = LanguageService();
await languageService.changeLanguage('pl_PL'); // or 'en_US'

The selected language is persisted in SharedPreferences so it remains active across app restarts.