diff --git a/l10n.yaml b/l10n.yaml new file mode 100644 index 0000000..8d29a62 --- /dev/null +++ b/l10n.yaml @@ -0,0 +1,3 @@ +arb-dir: lib/locale/l10n +template-arb-file: app_en.arb +output-localization-file: app_localizations.dart diff --git a/lib/locale/l10n/app_de.arb b/lib/locale/l10n/app_de.arb new file mode 100644 index 0000000..ad2e2db --- /dev/null +++ b/lib/locale/l10n/app_de.arb @@ -0,0 +1,3 @@ +{ + "helloWorld": "Hallo Welt" +} diff --git a/lib/locale/l10n/app_en.arb b/lib/locale/l10n/app_en.arb new file mode 100644 index 0000000..84bead2 --- /dev/null +++ b/lib/locale/l10n/app_en.arb @@ -0,0 +1,6 @@ +{ + "helloWorld": "Hello World!", + "@helloWorld": { + "description": "The conventional newborn programmer greeting" + } +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 2f5653f..426bec8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,7 @@ import 'package:camera/camera.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; import 'package:quid_faciam_hodie/constants/themes.dart'; import 'package:quid_faciam_hodie/screens/calendar_screen.dart'; @@ -50,6 +51,8 @@ class _MyAppState extends State { theme: LIGHT_THEME, darkTheme: DARK_THEME, themeMode: ThemeMode.system, + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, routes: { WelcomeScreen.ID: (context) => const WelcomeScreen(), MainScreen.ID: (context) => const MainScreen(), diff --git a/pubspec.lock b/pubspec.lock index 7800d20..f23a00a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -153,6 +153,11 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" flutter_plugin_android_lifecycle: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 08bc1b7..777c8ca 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,6 +29,8 @@ environment: dependencies: flutter: sdk: flutter + flutter_localizations: + sdk: flutter # The following adds the Cupertino Icons font to your application. @@ -68,6 +70,7 @@ dev_dependencies: # The following section is specific to Flutter packages. flutter: + generate: true # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in