Implement comprehensive localization framework with English and Finnish support

- Add flutter_localizations dependency and l10n configuration
- Create ARB files for English (en) and Finnish (fi) translations
- Localize UI strings across all major components:
  * Navigation drawer and page titles
  * Scoring interface (arrows per end, ruleset names)
  * Scorecard headers (End, Arrows, Sum of 3/6, Accumulative)
  * Keypad functional buttons (CLEAR/TYHJENNÄ, CLOSE/SULJE)
  * Settings page placeholder content
  * Dialog messages and confirmation prompts
- Preserve universal archery scoring notation (X, 10, 9, M remain unlocalised)
- Use authentic Finnish archery terminology throughout
- Configure main app with proper localization delegates and supported locales
- Generate localization classes automatically via flutter_localizations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mikkeli Matlock
2025-08-24 20:47:16 +09:00
parent 8f7d870985
commit bb7b1cf6b2
15 changed files with 938 additions and 55 deletions
+64
View File
@@ -0,0 +1,64 @@
{
"@@locale": "en",
"appTitle": "Archery Bookkeeper",
"appVersion": "Alpha 0.1",
"navMainScorer": "Main (Scorer)",
"navSettings": "Settings",
"arrowsPerEnd": "Arrows per end",
"ruleset": "Ruleset",
"rulesetIndoor": "Indoor",
"rulesetOutdoor": "Outdoor",
"endsCount": "{count} ends",
"@endsCount": {
"placeholders": {
"count": {
"type": "int",
"example": "10"
}
}
},
"headerEnd": "End",
"headerArrows": "Arrows",
"headerSumOf3": "Sum of 3",
"headerSumOf6": "Sum of 6",
"headerAccumulative": "Accumulative",
"headerXCount": "X",
"header10Count": "10",
"header9Count": "9",
"scoreTotal": "Total",
"keypadClear": "CLEAR",
"keypadClose": "CLOSE",
"dialogClearScoresTitle": "Clear scores",
"dialogClearScoresMessage": "This will clear all scores for the current session. Continue?",
"dialogArrowChangeTitle": "Change arrow count",
"dialogArrowChangeMessage": "Changing arrow count will clear existing scores. Continue?",
"dialogPreserveScores": "Preserve existing scores when possible?",
"dialogCancel": "Cancel",
"dialogContinue": "Continue",
"dialogYes": "Yes",
"dialogNo": "No",
"settingsTitle": "Settings",
"settingsAppearance": "Appearance",
"settingsScoring": "Scoring",
"settingsExport": "Export",
"settingsAbout": "About",
"settingsPlaceholder": "This is a placeholder settings page.",
"settingsFutureWillInclude": "Future settings will include:",
"settingsColorScheme": "• Color scheme preferences",
"settingsDefaultArrows": "• Default arrow counts",
"settingsScoreInput": "• Score input preferences",
"settingsExportOptions": "• Export settings",
"settingsSessionManagement": "• Session management",
"dialogKeepScoresTitle": "Keep scores?",
"devTodoLocalization": "REPLACE ALL THESE TEXTS WITH LOCALISATION MARKERS!!"
}
+64
View File
@@ -0,0 +1,64 @@
{
"@@locale": "fi",
"appTitle": "Jousiammunnan tuloskirja",
"appVersion": "Alpha 0.1",
"navMainScorer": "Pääsivu (Tuloslaskuri)",
"navSettings": "Asetukset",
"arrowsPerEnd": "Nuolia per päätös",
"ruleset": "Sääntökokoelma",
"rulesetIndoor": "Sisärata",
"rulesetOutdoor": "Ulkorata",
"endsCount": "{count} päätöstä",
"@endsCount": {
"placeholders": {
"count": {
"type": "int",
"example": "10"
}
}
},
"headerEnd": "Päätös",
"headerArrows": "Nuolet",
"headerSumOf3": "Summa 3",
"headerSumOf6": "Summa 6",
"headerAccumulative": "Yhteensä",
"headerXCount": "X",
"header10Count": "10",
"header9Count": "9",
"scoreTotal": "Yhteensä",
"keypadClear": "TYHJENNÄ",
"keypadClose": "SULJE",
"dialogClearScoresTitle": "Tyhjennä pisteet",
"dialogClearScoresMessage": "Tämä tyhjentää kaikki pisteet nykyiseltä kierrokselta. Jatka?",
"dialogArrowChangeTitle": "Muuta nuolien määrää",
"dialogArrowChangeMessage": "Nuolien määrän muuttaminen tyhjentää olemassa olevat pisteet. Jatka?",
"dialogPreserveScores": "Säilytetäänkö olemassa olevat pisteet mahdollisuuksien mukaan?",
"dialogCancel": "Peruuta",
"dialogContinue": "Jatka",
"dialogYes": "Kyllä",
"dialogNo": "Ei",
"settingsTitle": "Asetukset",
"settingsAppearance": "Ulkoasu",
"settingsScoring": "Pisteidenlasku",
"settingsExport": "Vienti",
"settingsAbout": "Tietoja",
"settingsPlaceholder": "Tämä on väliaikainen asetukset-sivu.",
"settingsFutureWillInclude": "Tulevat asetukset sisältävät:",
"settingsColorScheme": "• Väriteeman asetukset",
"settingsDefaultArrows": "• Nuolien oletusmäärät",
"settingsScoreInput": "• Pisteidenluonnin asetukset",
"settingsExportOptions": "• Vientiasetukset",
"settingsSessionManagement": "• Istunnon hallinta",
"dialogKeepScoresTitle": "Säilytetäänkö pisteet?",
"devTodoLocalization": "KORVAA KAIKKI NÄMÄ TEKSTIT LOKALISOINTIMERKINNÖILLÄ!!"
}
@@ -0,0 +1,392 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:intl/intl.dart' as intl;
import 'app_localizations_en.dart';
import 'app_localizations_fi.dart';
// ignore_for_file: type=lint
/// Callers can lookup localized strings with an instance of AppLocalizations
/// returned by `AppLocalizations.of(context)`.
///
/// Applications need to include `AppLocalizations.delegate()` in their app's
/// `localizationDelegates` list, and the locales they support in the app's
/// `supportedLocales` list. For example:
///
/// ```dart
/// import 'generated/app_localizations.dart';
///
/// return MaterialApp(
/// localizationsDelegates: AppLocalizations.localizationsDelegates,
/// supportedLocales: AppLocalizations.supportedLocales,
/// home: MyApplicationHome(),
/// );
/// ```
///
/// ## Update pubspec.yaml
///
/// Please make sure to update your pubspec.yaml to include the following
/// packages:
///
/// ```yaml
/// dependencies:
/// # Internationalization support.
/// flutter_localizations:
/// sdk: flutter
/// intl: any # Use the pinned version from flutter_localizations
///
/// # Rest of dependencies
/// ```
///
/// ## iOS Applications
///
/// iOS applications define key application metadata, including supported
/// locales, in an Info.plist file that is built into the application bundle.
/// To configure the locales supported by your app, you’ll need to edit this
/// file.
///
/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file.
/// Then, in the Project Navigator, open the Info.plist file under the Runner
/// project’s Runner folder.
///
/// Next, select the Information Property List item, select Add Item from the
/// Editor menu, then select Localizations from the pop-up menu.
///
/// Select and expand the newly-created Localizations item then, for each
/// locale your application supports, add a new item and select the locale
/// you wish to add from the pop-up menu in the Value field. This list should
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
/// property.
abstract class AppLocalizations {
AppLocalizations(String locale)
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
final String localeName;
static AppLocalizations? of(BuildContext context) {
return Localizations.of<AppLocalizations>(context, AppLocalizations);
}
static const LocalizationsDelegate<AppLocalizations> delegate =
_AppLocalizationsDelegate();
/// A list of this localizations delegate along with the default localizations
/// delegates.
///
/// Returns a list of localizations delegates containing this delegate along with
/// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
/// and GlobalWidgetsLocalizations.delegate.
///
/// Additional delegates can be added by appending to this list in
/// MaterialApp. This list does not have to be used at all if a custom list
/// of delegates is preferred or required.
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];
/// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[
Locale('en'),
Locale('fi'),
];
/// No description provided for @appTitle.
///
/// In en, this message translates to:
/// **'Archery Bookkeeper'**
String get appTitle;
/// No description provided for @appVersion.
///
/// In en, this message translates to:
/// **'Alpha 0.1'**
String get appVersion;
/// No description provided for @navMainScorer.
///
/// In en, this message translates to:
/// **'Main (Scorer)'**
String get navMainScorer;
/// No description provided for @navSettings.
///
/// In en, this message translates to:
/// **'Settings'**
String get navSettings;
/// No description provided for @arrowsPerEnd.
///
/// In en, this message translates to:
/// **'Arrows per end'**
String get arrowsPerEnd;
/// No description provided for @ruleset.
///
/// In en, this message translates to:
/// **'Ruleset'**
String get ruleset;
/// No description provided for @rulesetIndoor.
///
/// In en, this message translates to:
/// **'Indoor'**
String get rulesetIndoor;
/// No description provided for @rulesetOutdoor.
///
/// In en, this message translates to:
/// **'Outdoor'**
String get rulesetOutdoor;
/// No description provided for @endsCount.
///
/// In en, this message translates to:
/// **'{count} ends'**
String endsCount(int count);
/// No description provided for @headerEnd.
///
/// In en, this message translates to:
/// **'End'**
String get headerEnd;
/// No description provided for @headerArrows.
///
/// In en, this message translates to:
/// **'Arrows'**
String get headerArrows;
/// No description provided for @headerSumOf3.
///
/// In en, this message translates to:
/// **'Sum of 3'**
String get headerSumOf3;
/// No description provided for @headerSumOf6.
///
/// In en, this message translates to:
/// **'Sum of 6'**
String get headerSumOf6;
/// No description provided for @headerAccumulative.
///
/// In en, this message translates to:
/// **'Accumulative'**
String get headerAccumulative;
/// No description provided for @headerXCount.
///
/// In en, this message translates to:
/// **'X'**
String get headerXCount;
/// No description provided for @header10Count.
///
/// In en, this message translates to:
/// **'10'**
String get header10Count;
/// No description provided for @header9Count.
///
/// In en, this message translates to:
/// **'9'**
String get header9Count;
/// No description provided for @scoreTotal.
///
/// In en, this message translates to:
/// **'Total'**
String get scoreTotal;
/// No description provided for @keypadClear.
///
/// In en, this message translates to:
/// **'CLEAR'**
String get keypadClear;
/// No description provided for @keypadClose.
///
/// In en, this message translates to:
/// **'CLOSE'**
String get keypadClose;
/// No description provided for @dialogClearScoresTitle.
///
/// In en, this message translates to:
/// **'Clear scores'**
String get dialogClearScoresTitle;
/// No description provided for @dialogClearScoresMessage.
///
/// In en, this message translates to:
/// **'This will clear all scores for the current session. Continue?'**
String get dialogClearScoresMessage;
/// No description provided for @dialogArrowChangeTitle.
///
/// In en, this message translates to:
/// **'Change arrow count'**
String get dialogArrowChangeTitle;
/// No description provided for @dialogArrowChangeMessage.
///
/// In en, this message translates to:
/// **'Changing arrow count will clear existing scores. Continue?'**
String get dialogArrowChangeMessage;
/// No description provided for @dialogPreserveScores.
///
/// In en, this message translates to:
/// **'Preserve existing scores when possible?'**
String get dialogPreserveScores;
/// No description provided for @dialogCancel.
///
/// In en, this message translates to:
/// **'Cancel'**
String get dialogCancel;
/// No description provided for @dialogContinue.
///
/// In en, this message translates to:
/// **'Continue'**
String get dialogContinue;
/// No description provided for @dialogYes.
///
/// In en, this message translates to:
/// **'Yes'**
String get dialogYes;
/// No description provided for @dialogNo.
///
/// In en, this message translates to:
/// **'No'**
String get dialogNo;
/// No description provided for @settingsTitle.
///
/// In en, this message translates to:
/// **'Settings'**
String get settingsTitle;
/// No description provided for @settingsAppearance.
///
/// In en, this message translates to:
/// **'Appearance'**
String get settingsAppearance;
/// No description provided for @settingsScoring.
///
/// In en, this message translates to:
/// **'Scoring'**
String get settingsScoring;
/// No description provided for @settingsExport.
///
/// In en, this message translates to:
/// **'Export'**
String get settingsExport;
/// No description provided for @settingsAbout.
///
/// In en, this message translates to:
/// **'About'**
String get settingsAbout;
/// No description provided for @settingsPlaceholder.
///
/// In en, this message translates to:
/// **'This is a placeholder settings page.'**
String get settingsPlaceholder;
/// No description provided for @settingsFutureWillInclude.
///
/// In en, this message translates to:
/// **'Future settings will include:'**
String get settingsFutureWillInclude;
/// No description provided for @settingsColorScheme.
///
/// In en, this message translates to:
/// **'• Color scheme preferences'**
String get settingsColorScheme;
/// No description provided for @settingsDefaultArrows.
///
/// In en, this message translates to:
/// **'• Default arrow counts'**
String get settingsDefaultArrows;
/// No description provided for @settingsScoreInput.
///
/// In en, this message translates to:
/// **'• Score input preferences'**
String get settingsScoreInput;
/// No description provided for @settingsExportOptions.
///
/// In en, this message translates to:
/// **'• Export settings'**
String get settingsExportOptions;
/// No description provided for @settingsSessionManagement.
///
/// In en, this message translates to:
/// **'• Session management'**
String get settingsSessionManagement;
/// No description provided for @dialogKeepScoresTitle.
///
/// In en, this message translates to:
/// **'Keep scores?'**
String get dialogKeepScoresTitle;
/// No description provided for @devTodoLocalization.
///
/// In en, this message translates to:
/// **'REPLACE ALL THESE TEXTS WITH LOCALISATION MARKERS!!'**
String get devTodoLocalization;
}
class _AppLocalizationsDelegate
extends LocalizationsDelegate<AppLocalizations> {
const _AppLocalizationsDelegate();
@override
Future<AppLocalizations> load(Locale locale) {
return SynchronousFuture<AppLocalizations>(lookupAppLocalizations(locale));
}
@override
bool isSupported(Locale locale) =>
<String>['en', 'fi'].contains(locale.languageCode);
@override
bool shouldReload(_AppLocalizationsDelegate old) => false;
}
AppLocalizations lookupAppLocalizations(Locale locale) {
// Lookup logic when only language code is specified.
switch (locale.languageCode) {
case 'en':
return AppLocalizationsEn();
case 'fi':
return AppLocalizationsFi();
}
throw FlutterError(
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.',
);
}
@@ -0,0 +1,144 @@
// ignore: unused_import
import 'package:intl/intl.dart' as intl;
import 'app_localizations.dart';
// ignore_for_file: type=lint
/// The translations for English (`en`).
class AppLocalizationsEn extends AppLocalizations {
AppLocalizationsEn([String locale = 'en']) : super(locale);
@override
String get appTitle => 'Archery Bookkeeper';
@override
String get appVersion => 'Alpha 0.1';
@override
String get navMainScorer => 'Main (Scorer)';
@override
String get navSettings => 'Settings';
@override
String get arrowsPerEnd => 'Arrows per end';
@override
String get ruleset => 'Ruleset';
@override
String get rulesetIndoor => 'Indoor';
@override
String get rulesetOutdoor => 'Outdoor';
@override
String endsCount(int count) {
return '$count ends';
}
@override
String get headerEnd => 'End';
@override
String get headerArrows => 'Arrows';
@override
String get headerSumOf3 => 'Sum of 3';
@override
String get headerSumOf6 => 'Sum of 6';
@override
String get headerAccumulative => 'Accumulative';
@override
String get headerXCount => 'X';
@override
String get header10Count => '10';
@override
String get header9Count => '9';
@override
String get scoreTotal => 'Total';
@override
String get keypadClear => 'CLEAR';
@override
String get keypadClose => 'CLOSE';
@override
String get dialogClearScoresTitle => 'Clear scores';
@override
String get dialogClearScoresMessage =>
'This will clear all scores for the current session. Continue?';
@override
String get dialogArrowChangeTitle => 'Change arrow count';
@override
String get dialogArrowChangeMessage =>
'Changing arrow count will clear existing scores. Continue?';
@override
String get dialogPreserveScores => 'Preserve existing scores when possible?';
@override
String get dialogCancel => 'Cancel';
@override
String get dialogContinue => 'Continue';
@override
String get dialogYes => 'Yes';
@override
String get dialogNo => 'No';
@override
String get settingsTitle => 'Settings';
@override
String get settingsAppearance => 'Appearance';
@override
String get settingsScoring => 'Scoring';
@override
String get settingsExport => 'Export';
@override
String get settingsAbout => 'About';
@override
String get settingsPlaceholder => 'This is a placeholder settings page.';
@override
String get settingsFutureWillInclude => 'Future settings will include:';
@override
String get settingsColorScheme => '• Color scheme preferences';
@override
String get settingsDefaultArrows => '• Default arrow counts';
@override
String get settingsScoreInput => '• Score input preferences';
@override
String get settingsExportOptions => '• Export settings';
@override
String get settingsSessionManagement => '• Session management';
@override
String get dialogKeepScoresTitle => 'Keep scores?';
@override
String get devTodoLocalization =>
'REPLACE ALL THESE TEXTS WITH LOCALISATION MARKERS!!';
}
@@ -0,0 +1,145 @@
// ignore: unused_import
import 'package:intl/intl.dart' as intl;
import 'app_localizations.dart';
// ignore_for_file: type=lint
/// The translations for Finnish (`fi`).
class AppLocalizationsFi extends AppLocalizations {
AppLocalizationsFi([String locale = 'fi']) : super(locale);
@override
String get appTitle => 'Jousiammunnan tuloskirja';
@override
String get appVersion => 'Alpha 0.1';
@override
String get navMainScorer => 'Pääsivu (Tuloslaskuri)';
@override
String get navSettings => 'Asetukset';
@override
String get arrowsPerEnd => 'Nuolia per päätös';
@override
String get ruleset => 'Sääntökokoelma';
@override
String get rulesetIndoor => 'Sisärata';
@override
String get rulesetOutdoor => 'Ulkorata';
@override
String endsCount(int count) {
return '$count päätöstä';
}
@override
String get headerEnd => 'Päätös';
@override
String get headerArrows => 'Nuolet';
@override
String get headerSumOf3 => 'Summa 3';
@override
String get headerSumOf6 => 'Summa 6';
@override
String get headerAccumulative => 'Yhteensä';
@override
String get headerXCount => 'X';
@override
String get header10Count => '10';
@override
String get header9Count => '9';
@override
String get scoreTotal => 'Yhteensä';
@override
String get keypadClear => 'TYHJENNÄ';
@override
String get keypadClose => 'SULJE';
@override
String get dialogClearScoresTitle => 'Tyhjennä pisteet';
@override
String get dialogClearScoresMessage =>
'Tämä tyhjentää kaikki pisteet nykyiseltä kierrokselta. Jatka?';
@override
String get dialogArrowChangeTitle => 'Muuta nuolien määrää';
@override
String get dialogArrowChangeMessage =>
'Nuolien määrän muuttaminen tyhjentää olemassa olevat pisteet. Jatka?';
@override
String get dialogPreserveScores =>
'Säilytetäänkö olemassa olevat pisteet mahdollisuuksien mukaan?';
@override
String get dialogCancel => 'Peruuta';
@override
String get dialogContinue => 'Jatka';
@override
String get dialogYes => 'Kyllä';
@override
String get dialogNo => 'Ei';
@override
String get settingsTitle => 'Asetukset';
@override
String get settingsAppearance => 'Ulkoasu';
@override
String get settingsScoring => 'Pisteidenlasku';
@override
String get settingsExport => 'Vienti';
@override
String get settingsAbout => 'Tietoja';
@override
String get settingsPlaceholder => 'Tämä on väliaikainen asetukset-sivu.';
@override
String get settingsFutureWillInclude => 'Tulevat asetukset sisältävät:';
@override
String get settingsColorScheme => '• Väriteeman asetukset';
@override
String get settingsDefaultArrows => '• Nuolien oletusmäärät';
@override
String get settingsScoreInput => '• Pisteidenluonnin asetukset';
@override
String get settingsExportOptions => '• Vientiasetukset';
@override
String get settingsSessionManagement => '• Istunnon hallinta';
@override
String get dialogKeepScoresTitle => 'Säilytetäänkö pisteet?';
@override
String get devTodoLocalization =>
'KORVAA KAIKKI NÄMÄ TEKSTIT LOKALISOINTIMERKINNÖILLÄ!!';
}