Feature: Add support for localization, introduce slang for translations, and integrate German and English locale support throughout the app

This commit is contained in:
2025-09-27 11:58:25 +02:00
parent 3e04b9cbe3
commit 0a0e421158
11 changed files with 627 additions and 44 deletions

View File

@@ -1,9 +1,11 @@
import 'package:app/core/app/router.dart';
import 'package:app/core/app/startup/domain/initialize_app.dart';
import 'package:app/core/i18n/translations.g.dart';
import 'package:app/core/ui/controller/locale_controller.dart';
import 'package:app/core/ui/controller/scale_controller.dart';
import 'package:app/core/ui/controller/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:fluttery/fluttery.dart';
import 'package:fluttery/logger.dart';
import 'package:go_router/go_router.dart';
@@ -37,7 +39,9 @@ Future<void> main() async {
ChangeNotifierProvider(create: (context) => scaleController),
ChangeNotifierProvider(create: (context) => localeController),
],
child: FinlogApp(router: buildAppRouter(startRoute)),
child: TranslationProvider(
child: FinlogApp(router: buildAppRouter(startRoute)),
),
),
);
}
@@ -51,14 +55,14 @@ class FinlogApp extends StatelessWidget {
Widget build(BuildContext context) {
final theme = context.watch<ThemeController>();
final textScale = context.watch<ScaleController>();
final localeCtrl = context.watch<LocaleController>();
return AnimatedBuilder(
animation: theme,
builder: (context, _) => MaterialApp.router(
title: 'Finlog',
locale: localeCtrl.locale,
supportedLocales: const [Locale('de'), Locale('en')],
locale: TranslationProvider.of(context).flutterLocale,
supportedLocales: AppLocaleUtils.supportedLocales,
localizationsDelegates: GlobalMaterialLocalizations.delegates,
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
themeMode: theme.themeMode,