3 KiB
3 KiB
TT-011 — Localisation (i18n)
Type: Story
Priority: Medium
Labels: i18n, l10n, infrastructure
Depends on: TT-001
Blocks: TT-006, TT-007, TT-008, TT-009, TT-010
Summary
Set up flutter_localizations with ARB files for English (en) and German
(de). All UI strings must be externalised — no hardcoded display text in
widget files.
Setup
l10n.yaml (project root)
arb-dir: lib/core/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
output-class: AppLocalizations
File structure
lib/core/l10n/
app_en.arb ← template (English)
app_de.arb ← German translations
Generated: lib/core/l10n/app_localizations.dart (do not edit manually)
Usage in widgets
import 'package:timetrack/core/l10n/app_localizations.dart';
// ...
Text(AppLocalizations.of(context)!.timerStart)
Strings to externalise (minimum set)
Navigation
"navTimer": "Timer",
"navEntries": "Entries",
"navProjects": "Projects",
"navReports": "Reports",
"navSettings": "Settings"
Timer
"timerStart": "Start",
"timerStop": "Stop",
"timerDiscard": "Discard",
"timerDiscardConfirm": "Discard this entry?",
"timerSelectProject": "Select project",
"timerAddNote": "Add a note…",
"timerTodayTotal": "Today: {duration}"
Entries
"entriesTitle": "Entries",
"entriesEmpty": "No entries yet",
"entriesAdd": "Add entry",
"entriesDeleteUndo": "Entry deleted",
"entriesUndo": "Undo"
Projects
"projectsTitle": "Projects",
"projectsEmpty": "No projects yet",
"projectsAdd": "Add project",
"projectsActive": "Active",
"projectsArchived": "Archived",
"projectsName": "Name",
"projectsDescription": "Description",
"projectsArchive": "Archive",
"projectsDeleteBlocked": "Cannot delete — project has entries"
Reports
"reportsTitle": "Reports",
"reportsDay": "Day",
"reportsWeek": "Week",
"reportsMonth": "Month",
"reportsTotal": "Total",
"reportsNoData": "No data for this period"
Settings / Export
"settingsTitle": "Settings",
"settingsTheme": "Theme",
"settingsThemeSystem": "System",
"settingsThemeLight": "Light",
"settingsThemeDark": "Dark",
"settingsLanguage": "Language",
"settingsExport": "Export data",
"exportFormat": "Format",
"exportRange": "Date range",
"exportShare": "Share"
Common
"cancel": "Cancel",
"save": "Save",
"delete": "Delete",
"edit": "Edit",
"confirm": "Confirm"
Acceptance Criteria
l10n.yamlpresent at project rootapp_en.arbcontains all strings listed aboveapp_de.arbcontains all German translations (no English fallback strings)flutter gen-l10n(orflutter pub get) generatesapp_localizations.dart- Zero hardcoded display strings in any
presentation/file - Switching language in Settings updates all visible strings immediately
- Widget test: locale override renders German strings
Files to create
l10n.yamllib/core/l10n/app_en.arblib/core/l10n/app_de.arb