added localization functionality

This commit is contained in:
Myzel394 2022-08-17 11:20:14 +02:00
parent e49c8f8211
commit 08c7436bb3
6 changed files with 23 additions and 0 deletions

3
l10n.yaml Normal file
View File

@ -0,0 +1,3 @@
arb-dir: lib/locale/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart

View File

@ -0,0 +1,3 @@
{
"helloWorld": "Hallo Welt"
}

View File

@ -0,0 +1,6 @@
{
"helloWorld": "Hello World!",
"@helloWorld": {
"description": "The conventional newborn programmer greeting"
}
}

View File

@ -2,6 +2,7 @@ import 'package:camera/camera.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:quid_faciam_hodie/constants/themes.dart'; import 'package:quid_faciam_hodie/constants/themes.dart';
import 'package:quid_faciam_hodie/screens/calendar_screen.dart'; import 'package:quid_faciam_hodie/screens/calendar_screen.dart';
@ -50,6 +51,8 @@ class _MyAppState extends State<MyApp> {
theme: LIGHT_THEME, theme: LIGHT_THEME,
darkTheme: DARK_THEME, darkTheme: DARK_THEME,
themeMode: ThemeMode.system, themeMode: ThemeMode.system,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
routes: { routes: {
WelcomeScreen.ID: (context) => const WelcomeScreen(), WelcomeScreen.ID: (context) => const WelcomeScreen(),
MainScreen.ID: (context) => const MainScreen(), MainScreen.ID: (context) => const MainScreen(),

View File

@ -153,6 +153,11 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_plugin_android_lifecycle: flutter_plugin_android_lifecycle:
dependency: transitive dependency: transitive
description: description:

View File

@ -29,6 +29,8 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_localizations:
sdk: flutter
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
@ -68,6 +70,7 @@ dev_dependencies:
# The following section is specific to Flutter packages. # The following section is specific to Flutter packages.
flutter: flutter:
generate: true
# The following line ensures that the Material Icons font is # The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in # included with your application, so that you can use the icons in