hello multilang !

This commit is contained in:
poka 2022-06-16 22:29:42 +02:00
parent 1c3aa6997b
commit b89de85e90
7 changed files with 60 additions and 6 deletions

View File

@ -0,0 +1,3 @@
{
"msg": "hello {} there !"
}

View File

@ -0,0 +1,3 @@
{
"msg": "Salut ici !"
}

View File

@ -45,11 +45,14 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:window_size/window_size.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:easy_localization/easy_localization.dart';
const bool enableSentry = true;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
setWindowTitle('Ğecko');
setWindowMinSize(const Size(400, 700));
@ -97,10 +100,21 @@ Future<void> main() async {
// // ]);
// Catcher(rootWidget: Gecko(endPointGVA, _store), debugConfig: debugOptions);
await SentryFlutter.init((options) {
options.dsn =
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
}, appRunner: () => runApp(Gecko(indexerEndpoint)));
await SentryFlutter.init(
(options) {
options.dsn =
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
},
appRunner: () => runApp(
EasyLocalization(
supportedLocales: const [Locale('en'), Locale('fr')],
path:
'assets/translations', // <-- change the path of the translation files
fallbackLocale: const Locale('fr'),
child: Gecko(indexerEndpoint),
),
),
);
// runZoned<Future<void>>(
// () async {
@ -117,7 +131,15 @@ Future<void> main() async {
} else {
print('Debug mode enabled: No sentry alerte');
runApp(Gecko(indexerEndpoint));
runApp(
EasyLocalization(
supportedLocales: const [Locale('en'), Locale('fr')],
path:
'assets/translations', // <-- change the path of the translation files
fallbackLocale: const Locale('fr'),
child: Gecko(indexerEndpoint),
),
);
}
}
@ -145,6 +167,9 @@ class Gecko extends StatelessWidget {
ChangeNotifierProvider(create: (_) => DuniterIndexer())
],
child: MaterialApp(
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
builder: (context, widget) => ResponsiveWrapper.builder(
BouncingScrollWrapper.builder(context, widget!),
maxWidth: 1200,

View File

@ -1,5 +1,6 @@
import 'package:bubble/bubble.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/stateful_wrapper.dart';
import 'package:gecko/providers/chest_provider.dart';
@ -301,6 +302,7 @@ Widget geckHome(context) {
),
),
const SizedBox(height: 12),
const Text('msg').tr(args: [currencyName]),
Text(
"Rechercher un\nportefeuille",
textAlign: TextAlign.center,

View File

@ -351,7 +351,7 @@ class WalletOptions extends StatelessWidget {
height: 45,
),
const SizedBox(width: 22),
const Text('Activité',
const Text("Voir l'activité",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500)),
]),
),

View File

@ -316,6 +316,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6"
easy_localization:
dependency: "direct main"
description:
name: easy_localization
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
easy_logger:
dependency: transitive
description:
name: easy_logger
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
fake_async:
dependency: transitive
description:
@ -389,6 +403,11 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
flutter_localizations:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_logs:
dependency: "direct main"
description:

View File

@ -72,6 +72,7 @@ dependencies:
web_socket_channel: ^2.2.0
connectivity_plus: ^2.3.3
image_cropper: ^2.0.3
easy_localization: ^3.0.1
dev_dependencies:
# flutter_launcher_icons: ^0.9.2
@ -99,6 +100,7 @@ flutter:
assets:
- config/
- assets/
- assets/translations/
- assets/home/
- assets/avatars/
- assets/chests/