Adds Asturianu, translated in full (345 strings), plus the wiring to make a minority language work end to end — the OS language picker is an unreliable way to reach it, so the in-app choice must be explicit and remembered. - Model Asturian as the real `ast` locale (honest, international-by-design), not a fake `es-AST` region — slang rejects a 3-letter region anyway. - Flutter ships no Material/Cupertino/intl localizations for `ast`, so map the framework chrome to Spanish (`materialLocaleFor`); the app's own text stays Asturian via slang. Fixes an "Invalid locale ast" crash when the auto-backup date was formatted with intl. - Persist the picked language in the keystore (LocaleStore) and restore it at startup so it survives restarts and wins over the device locale. - Settings: add the Asturianu tile; compare the full AppLocale so `es` and `ast` aren't both marked selected. Tests: LocaleStore round-trip, locale switch + Spanish-chrome fallback, and a regression for the intl date crash under Asturian.
49 lines
1.8 KiB
Dart
49 lines
1.8 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
import 'app.dart';
|
|
import 'data/species_repository.dart';
|
|
import 'data/variety_repository.dart';
|
|
import 'di/injector.dart';
|
|
import 'i18n/strings.g.dart';
|
|
import 'services/auto_backup_service.dart';
|
|
import 'services/coarse_location.dart';
|
|
import 'services/locale_store.dart';
|
|
import 'services/message_store.dart';
|
|
import 'services/offer_outbox.dart';
|
|
import 'services/onboarding_store.dart';
|
|
import 'services/profile_cache.dart';
|
|
import 'services/profile_store.dart';
|
|
import 'services/social_service.dart';
|
|
import 'services/social_settings.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
// Start from the device language, then let an explicit in-app choice win —
|
|
// it's the only reliable way to reach languages the OS picker doesn't offer
|
|
// (e.g. Asturian). Restored after DI, since the store lives in the keystore.
|
|
LocaleSettings.useDeviceLocaleSync();
|
|
await configureDependencies();
|
|
final savedLocale = await getIt<LocaleStore>().saved();
|
|
if (savedLocale != null) LocaleSettings.setLocaleSync(savedLocale);
|
|
final onboarding = getIt<OnboardingStore>();
|
|
runApp(
|
|
TranslationProvider(
|
|
child: TaneApp(
|
|
repository: getIt<VarietyRepository>(),
|
|
species: getIt<SpeciesRepository>(),
|
|
onboarding: onboarding,
|
|
social: getIt<SocialService>(),
|
|
socialSettings: getIt<SocialSettings>(),
|
|
location: const GeolocatorCoarseLocation(),
|
|
outbox: getIt<OfferOutbox>(),
|
|
messageStore: getIt<MessageStore>(),
|
|
profileStore: getIt<ProfileStore>(),
|
|
profileCache: getIt<ProfileCache>(),
|
|
showIntro: !await onboarding.introSeen(),
|
|
autoBackup: getIt.isRegistered<AutoBackupService>()
|
|
? getIt<AutoBackupService>()
|
|
: null,
|
|
),
|
|
),
|
|
);
|
|
}
|