From 171d808410a34827568752558a5ecda7b2771362 Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@gmail.com>
Date: Mon, 1 Feb 2021 16:58:08 +1100
Subject: [PATCH] Init basic localizations

---
 lib/main.dart | 16 ++++++++++++++++
 pubspec.lock  |  5 +++++
 pubspec.yaml  |  4 ++--
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/lib/main.dart b/lib/main.dart
index ff7bd8cb..ff94b80f 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,5 +1,7 @@
 import 'dart:async';
 
+import 'package:flutter_localizations/flutter_localizations.dart';
+
 import 'package:InvenTree/widget/category_display.dart';
 import 'package:InvenTree/widget/company_list.dart';
 import 'package:InvenTree/widget/location_display.dart';
@@ -77,6 +79,20 @@ class InvenTreeApp extends StatelessWidget {
         secondaryHeaderColor: Colors.blueGrey,
       ),
       home: MyHomePage(title: 'InvenTree'),
+      localizationsDelegates: [
+        // ... app-specific localization delegate[s] here
+        // TODO: uncomment the line below after codegen
+        // AppLocalizations.delegate,
+        GlobalMaterialLocalizations.delegate,
+        GlobalWidgetsLocalizations.delegate,
+        GlobalCupertinoLocalizations.delegate,
+      ],
+      supportedLocales: [
+        const Locale('en', ''), // English, no country code
+        const Locale('de', ''),
+        const Locale('fr', ''),
+        const Locale('it', ''),
+      ],
     );
   }
 }
diff --git a/pubspec.lock b/pubspec.lock
index 600009f4..389e467d 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -174,6 +174,11 @@ packages:
       url: "https://pub.dartlang.org"
     source: hosted
     version: "0.8.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 7145d90c..c3baeaa6 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -19,9 +19,9 @@ environment:
 dependencies:
   flutter:
     sdk: flutter
+  flutter_localizations:
+    sdk: flutter
 
-  # The following adds the Cupertino Icons font to your application.
-  # Use with the CupertinoIcons class for iOS style icons.
   cupertino_icons: ^0.1.3
   http: ^0.12.1
   shared_preferences: ^0.5.7